X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdeck_id%7D%7D/cards/%7B%7B%20card_id%20%7D%7D/delete?a=blobdiff_plain;f=src%2Froguelike.c;h=7cc50d6443c00b3ab606c599697042acc9ce14ed;hb=b4bb10b6e9089bd267a513dbf37543c318b5eb1e;hp=3604fbd3cc2981380fc9ec9112deefb647b62f1a;hpb=5fc067b01c4651afec131a6c9f79c4cdd336e5c8;p=plomrogue diff --git a/src/roguelike.c b/src/roguelike.c index 3604fbd..7cc50d6 100644 --- a/src/roguelike.c +++ b/src/roguelike.c @@ -100,7 +100,8 @@ void save_game(struct World * world) { for (monster = world->monster; monster != 0; monster = monster->next) { write_uint16_bigendian(monster->pos.y + 1, file); write_uint16_bigendian(monster->pos.x + 1, file); - fputc(monster->name, file); } + fputc(monster->name, file); + fputc(monster->hitpoints, file); } write_uint16_bigendian(0, file); struct Item * item; for (item = world->item; item != 0; item = item->next) { @@ -236,7 +237,8 @@ int main (int argc, char *argv[]) { monster = monster->next; } monster->pos.y = test - 1; monster->pos.x = read_uint16_bigendian(file) - 1; - monster->name = fgetc(file); } + monster->name = fgetc(file); + monster->hitpoints = fgetc(file); } if (!start) monster->next = 0; start = 1; @@ -293,7 +295,8 @@ int main (int argc, char *argv[]) { monster->next = malloc(sizeof(struct Monster)); monster = monster->next; } monster->pos = find_passable_pos(&map); - monster->name = 'A' + (rrand(0, 0) % 8); } + monster->name = 'A' + (rrand(0, 0) % 8); + monster->hitpoints = 5; } if (!start) monster->next = 0; start = 1;