From: Christian Heller Date: Wed, 10 Jul 2013 22:24:06 +0000 (+0200) Subject: Actually save player's hitpoints to savefile (instead of, bug, resetting them on... X-Git-Tag: tce~1158 X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/%7B%7Bprefix%7D%7D/balance2?a=commitdiff_plain;h=f29ca8b607b7e7cdb23ba90c491aaee2e294633d;p=plomrogue Actually save player's hitpoints to savefile (instead of, bug, resetting them on each game load). --- diff --git a/src/roguelike.c b/src/roguelike.c index b44086a..0ec8194 100644 --- a/src/roguelike.c +++ b/src/roguelike.c @@ -72,6 +72,7 @@ void save_game(struct World * world) { write_uint32_bigendian(world->turn, file); write_uint16_bigendian(world->player->pos.y + 1, file); write_uint16_bigendian(world->player->pos.x + 1, file); + fputc(world->player->hitpoints, file); write_map_objects (world->monster, file, write_map_objects_monsterdata); write_map_objects (world->item, file, readwrite_map_objects_dummy); fclose(file); } @@ -188,6 +189,7 @@ int main (int argc, char *argv[]) { world.turn = read_uint32_bigendian(file); player.pos.y = read_uint16_bigendian(file) - 1; player.pos.x = read_uint16_bigendian(file) - 1; + player.hitpoints = fgetc(file); read_map_objects (&world.monster, file, sizeof(struct Monster), read_map_objects_monsterdata); read_map_objects (&world.item, file, sizeof(struct Item), readwrite_map_objects_dummy); fclose(file); }