projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1307370
)
fixed crash bug when playing MM style tapes in headless mode
author
Holger Schemel
<info@artsoft.org>
Wed, 5 Apr 2017 23:08:02 +0000
(
01:08
+0200)
committer
Holger Schemel
<info@artsoft.org>
Fri, 23 Mar 2018 22:21:12 +0000
(23:21 +0100)
src/libgame/system.c
patch
|
blob
|
history
diff --git
a/src/libgame/system.c
b/src/libgame/system.c
index 6f063d1c01b0d79df41f2989b8d4dec35bae12a0..aa9a4de14c44f06717528e76d269fa2abc388bde 100644
(file)
--- a/
src/libgame/system.c
+++ b/
src/libgame/system.c
@@
-914,6
+914,9
@@
void DrawLine(Bitmap *bitmap, int from_x, int from_y,
{
int x, y;
{
int x, y;
+ if (program.headless)
+ return;
+
for (x = 0; x < line_width; x++)
{
for (y = 0; y < line_width; y++)
for (x = 0; x < line_width; x++)
{
for (y = 0; y < line_width; y++)
@@
-949,6
+952,9
@@
void DrawLines(Bitmap *bitmap, struct XY *points, int num_points, Pixel pixel)
Pixel GetPixel(Bitmap *bitmap, int x, int y)
{
Pixel GetPixel(Bitmap *bitmap, int x, int y)
{
+ if (program.headless)
+ return BLACK_PIXEL;
+
if (x < 0 || x >= bitmap->width ||
y < 0 || y >= bitmap->height)
return BLACK_PIXEL;
if (x < 0 || x >= bitmap->width ||
y < 0 || y >= bitmap->height)
return BLACK_PIXEL;
@@
-959,6
+965,9
@@
Pixel GetPixel(Bitmap *bitmap, int x, int y)
Pixel GetPixelFromRGB(Bitmap *bitmap, unsigned int color_r,
unsigned int color_g, unsigned int color_b)
{
Pixel GetPixelFromRGB(Bitmap *bitmap, unsigned int color_r,
unsigned int color_g, unsigned int color_b)
{
+ if (program.headless)
+ return BLACK_PIXEL;
+
return SDL_MapRGB(bitmap->surface->format, color_r, color_g, color_b);
}
return SDL_MapRGB(bitmap->surface->format, color_r, color_g, color_b);
}