- char * hit_dsc = " hits you";
- char msg[strlen(dsc_monster) + strlen(hit_dsc) + 3];
- sprintf(msg, "\n%s%s.", dsc_monster, hit_dsc);
- update_log(world, msg);
- world->player->hitpoints--;
-
- if (0 == world->player->hitpoints)
- {
- update_log(world, "\nYou are dead.");
- }
-}
-
-
-
-static void player_hits_monster(struct World * world, struct MapObj * monster)
-{
- struct MapObjDef * mod = get_map_object_def(world, monster->type);
- char * hit_dsc = "You hit the ";
- char * monster_dsc = mod->name;
- char hitmsg[strlen(hit_dsc) + strlen(monster_dsc) + 3];
- sprintf(hitmsg, "\n%s%s.", hit_dsc, monster_dsc);
- update_log(world, hitmsg);
- monster->lifepoints--;
- if (0 == monster->lifepoints)
- {
- hit_dsc = "You kill the ";
- char kill_msg[strlen(hit_dsc) + strlen(monster_dsc) + 3];
- sprintf(kill_msg, "\n%s%s.", hit_dsc, monster_dsc);
- update_log(world, kill_msg);
- struct MapObjDef * md = mod;
- monster->type = md->corpse_id;
- uint8_t score = md->lifepoints;
- world->score = world->score + score;
- }
-}
-
-
-
-static void try_player_move(struct World * world,
- enum dir d, struct yx_uint16 target)
-{
- char * dsc_dir;
- if (NORTH == d)
- {
- dsc_dir = "north";
- }
- else if (EAST == d)
- {
- dsc_dir = "east" ;
- }
- else if (SOUTH == d)