home · contact · privacy
Addendum to previous commit: Added files mentioned but forgotten.
[plomrogue] / src / objects_on_map.c
index 70d4378ade18f3996c0a4752b69e24bb64ea9e71..a7d9c32a75b4e78a9b9e3ff7970aa618bd03c560 100644 (file)
@@ -4,6 +4,7 @@
 #include "yx_uint16.h"
 #include "readwrite.h"
 #include "roguelike.h"
+#include "map.h"
 
 static struct ChainMapObject * get_next_cmo (void *, char *, size_t, struct ChainMapObject *);
 
@@ -105,6 +106,9 @@ extern void move_monster (struct World * world, struct Monster * monster) {
   struct yx_uint16 t = mv_yx_in_dir (d, monster->cmo.pos);
   if (yx_uint16_cmp (t, world->player->pos)) {
     update_log (world, "\nThe monster hits you.");
+    world->player->hitpoints--;
+    if (0 == world->player->hitpoints)
+      update_log (world, "\nYou are dead.");
     return; }
   struct Monster * other_monster;
   for (other_monster = world->monster; other_monster != 0; other_monster = other_monster->cmo.next) {