From 0403f26f6638ec0701a3fba8fe1bb125cf9c41bd Mon Sep 17 00:00:00 2001 From: Clownacy Date: Fri, 15 Feb 2019 20:52:03 +0000 Subject: [PATCH] Two fixes Made InitBack work with .bmp backgrounds, and fixed a file not being closed in Draw.cpp --- src/Back.cpp | 9 +++++++-- src/Draw.cpp | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Back.cpp b/src/Back.cpp index 8b2d5fa5..4c7f0651 100644 --- a/src/Back.cpp +++ b/src/Back.cpp @@ -20,8 +20,13 @@ bool InitBack(char *fName, int type) SDL_Surface *temp = SDL_LoadBMP(path); if (!temp) - return false; - + { + sprintf(path, "%s/%s.bmp", gDataPath, fName); + temp = SDL_LoadBMP(path); + if (!temp) + return false; + } + gBack.partsW = temp->w; gBack.partsH = temp->h; diff --git a/src/Draw.cpp b/src/Draw.cpp index 016b4a7b..8e7a6bab 100644 --- a/src/Draw.cpp +++ b/src/Draw.cpp @@ -305,6 +305,7 @@ static bool LoadBitmap_File(const char *name, int surf_no, bool create_surface) if (!IsEnableBitmap(fp)) { printf("Tried to load bitmap to surface %d, but it's missing the '(C)Pixel' string\n", surf_no); + fp->close(fp); } else {