diff --git a/src/defs.h b/src/defs.h index 7e5bf08..5f1efb3 100644 --- a/src/defs.h +++ b/src/defs.h @@ -39,6 +39,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define TO_RAIDANS(angleDegrees) (angleDegrees * PI / 180.0) #define TO_DEGREES(angleRadians) (angleRadians * 180.0 / PI) +#define SAVE_FILENAME "game.save" +#define CONFIG_FILENAME "config.json" + #define SCREEN_WIDTH 1280 #define SCREEN_HEIGHT 720 diff --git a/src/main.c b/src/main.c index 1ef7a21..30feb82 100644 --- a/src/main.c +++ b/src/main.c @@ -183,7 +183,7 @@ static void handleArguments(int argc, char *argv[]) if (!testingMission) { - if (fileExists(getSaveFilePath("game.save"))) + if (fileExists(getSaveFilePath(SAVE_FILENAME))) { loadGame(); } diff --git a/src/system/init.c b/src/system/init.c index cceae6e..ebdfe93 100644 --- a/src/system/init.c +++ b/src/system/init.c @@ -207,7 +207,7 @@ static void loadConfig(void) cJSON *root, *controlsJSON, *node; char *text, *configFilename; - configFilename = getSaveFilePath("config.json"); + configFilename = getSaveFilePath(CONFIG_FILENAME); if (fileExists(configFilename)) { @@ -215,7 +215,7 @@ static void loadConfig(void) } else { - text = readFile("data/app/config.json"); + text = readFile("data/app/"CONFIG_FILENAME); } root = cJSON_Parse(text); @@ -263,7 +263,7 @@ void saveConfig(void) char *out, *configFilename; cJSON *root, *controlsJSON, *keysJSON, *mouseJSON; - configFilename = getSaveFilePath("config.json"); + configFilename = getSaveFilePath(CONFIG_FILENAME); SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Saving config ..."); diff --git a/src/system/load.c b/src/system/load.c index 0ca8612..1e527e8 100644 --- a/src/system/load.c +++ b/src/system/load.c @@ -30,7 +30,7 @@ void loadGame(void) cJSON *root, *gameJSON; char *text; - text = readFile(getSaveFilePath("game.save")); + text = readFile(getSaveFilePath(SAVE_FILENAME)); root = cJSON_Parse(text); gameJSON = cJSON_GetObjectItem(root, "game"); diff --git a/src/system/save.c b/src/system/save.c index e0bdb2b..3b568d2 100644 --- a/src/system/save.c +++ b/src/system/save.c @@ -46,7 +46,7 @@ void saveGame(void) out = cJSON_Print(root); - writeFile(getSaveFilePath("game.save"), out); + writeFile(getSaveFilePath(SAVE_FILENAME), out); cJSON_Delete(root); free(out);