void Game::complete_player_activity() { Player_activity *act = &(player->activity); switch (act->type) { case PLAYER_ACTIVITY_NULL: case PLAYER_ACTIVITY_WAIT: break; // Nothing happens case PLAYER_ACTIVITY_RELOAD: { Item *reloaded = player->ref_item_uid(act->primary_item_uid); if (!reloaded) { debugmsg("Completed reload, but the item wasn't there!"); return; } add_msg("You reload your %s.", reloaded->get_name().c_str()); reloaded->reload(player, act->secondary_item_uid); } break; default: debugmsg("Our switch doesn't know how to handle action %d, '%s'", act->type, act->get_name().c_str()); } player->activity = Player_activity(); }
void Entity::set_activity(Player_activity_type type, int duration, int primary_uid, int secondary_uid) { // TODO: Error or something if we have an activity? activity = Player_activity(type, duration, primary_uid, secondary_uid); }