home
·
contact
·
privacy
projects
/
plomrogue
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8e2ccd2
)
Actually save player's hitpoints to savefile (instead of, bug, resetting them on...
author
Christian Heller
<c.heller@plomlompom.de>
Wed, 10 Jul 2013 22:24:06 +0000
(
00:24
+0200)
committer
Christian Heller
<c.heller@plomlompom.de>
Wed, 10 Jul 2013 22:24:06 +0000
(
00:24
+0200)
src/roguelike.c
patch
|
blob
|
history
diff --git
a/src/roguelike.c
b/src/roguelike.c
index b44086aded843a3857baaf1872e7b54b67a06eb6..0ec8194fb75d27031e6efdbf6bc90e1d1125e83c 100644
(file)
--- 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);
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); }
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;
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); }
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); }