From e7708c173a04372c58664da368a2ede5a1214836 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 6 Apr 2017 01:08:02 +0200 Subject: [PATCH] fixed crash bug when playing MM style tapes in headless mode --- src/libgame/system.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libgame/system.c b/src/libgame/system.c index 6f063d1c..aa9a4de1 100644 --- 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; + if (program.headless) + return; + 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) { + if (program.headless) + 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) { + if (program.headless) + return BLACK_PIXEL; + return SDL_MapRGB(bitmap->surface->format, color_r, color_g, color_b); } -- 2.34.1