+/* Log monster bumping into monster. */
+static void monster_bumps_monster(struct World * world, char * desc_monster1,
+ struct Monster * monster2);
+
+/* Decrement player HPs due to attack of monster, kill him if necessary and log
+ * the whole action.
+ */
+static void monster_hits_player(struct World * world, char * desc_monster);
+
+
+
+static void monster_bumps_monster(struct World * world, char * desc_monster1,
+ struct Monster * monster2)
+{
+ char * bumpdesc = " bumps into ";
+ struct MapObjDef * mod = get_map_obj_def(world, monster2->map_obj.type);
+ char * msg = malloc(strlen(desc_monster1) + strlen(bumpdesc)
+ + strlen(mod->desc) + 3);
+ sprintf(msg, "\n%s%s%s.", desc_monster1, bumpdesc, mod->desc);
+ update_log(world, msg);
+ free(msg);
+}
+
+
+
+static void monster_hits_player(struct World * world, char * desc_monster)
+{
+ char * hitdesc = " hits you.";
+ char * msg = malloc(strlen(desc_monster) + strlen(hitdesc) + 2);
+ sprintf(msg, "\n%s%s", desc_monster, hitdesc);
+ update_log(world, msg);
+ free(msg);
+ world->player->hitpoints--;
+ if (0 == world->player->hitpoints)
+ {
+ update_log(world, "\nYou are dead.");
+ }
+}
+
+
+