From 70219003e949b884ceaf1215bfc13f5814aacdbe Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Wed, 29 May 2013 05:28:28 +0200 Subject: [PATCH 1/1] Renamed functions to reflect change from seed files system to game save files system. --- roguelike.c | 8 ++++---- roguelike.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/roguelike.c b/roguelike.c index c68e983..c5c1309 100644 --- a/roguelike.c +++ b/roguelike.c @@ -54,7 +54,7 @@ void write_uint32_bigendian(uint32_t x, FILE * file) { fputc(c, file); fputc(d, file); } -void load_seed(struct World * world) { +void load_game(struct World * world) { // Load seed integer from seed file. FILE * file = fopen("savefile", "r"); world->seed = read_uint32_bigendian(file); @@ -65,7 +65,7 @@ void load_seed(struct World * world) { world->monster->x = read_uint16_bigendian(file); fclose(file); } -void save_seed(struct World * world) { +void save_game(struct World * world) { // Save seed integer to seed file. FILE * file = fopen("savefile", "w"); write_uint32_bigendian(world->seed, file); @@ -225,7 +225,7 @@ int main (int argc, char *argv[]) { struct Monster monster; world.monster = &monster; if (0 == access("savefile", F_OK)) - load_seed(&world); + load_game(&world); else { player.y = 8; player.x = 8; @@ -256,7 +256,7 @@ int main (int argc, char *argv[]) { uint32_t last_turn = 0; while (1) { if (last_turn != world.turn) { - save_seed(&world); + save_game(&world); last_turn = world.turn; } draw_all_windows (&win_meta); key = getch(); diff --git a/roguelike.h b/roguelike.h index 2bfa449..0d0ce86 100644 --- a/roguelike.h +++ b/roguelike.h @@ -28,8 +28,8 @@ uint16_t read_uint16_bigendian(FILE * file); void write_uint16_bigendian(uint16_t x, FILE * file); uint32_t read_uint32_bigendian(FILE * file); void write_uint32_bigendian(uint32_t x, FILE * file); -void load_seed(struct World *); -void save_seed(struct World *); +void load_game(struct World *); +void save_game(struct World *); void toggle_window (struct WinMeta *, struct Win *); void growshrink_active_window (struct WinMeta *, char); struct Map init_map (); -- 2.30.2