engine/maps/source/MapUtils.cpp
// Add a message if the creature is the player, and if there are items on
// the tile.
Add a message if the creature is the player, and if there are items on
the tile.
Add a message if the creature is the player and if there are items on the tile .
bool MapUtils::add_message_about_items_on_tile_if_necessary(CreaturePtr creature, TilePtr tile)
{
  bool msg_added = false;
  if (creature && creature->get_is_player())
  {
    IInventoryPtr tile_items = tile->get_items();
    if (!tile_items->empty())
    {
      string item_message;
      if (tile_items->size() == 1)
      {
        ItemPtr item_on_tile = tile_items->at(0);
        if (item_on_tile)
        {
          CurrentCreatureAbilities cca;
          item_message = TextMessages::get_item_on_ground_description_message(!cca.can_see(creature), item_on_tile);
        }
      }
      else
      {
        item_message = StringTable::get(MovementTextKeys::ITEMS_ON_TILE);
      }
      if (!item_message.empty())
      {
        IMessageManager& manager = MM::instance();
        manager.add_new_message(item_message);
        msg_added = true;
      }
    }
  }
  return msg_added;
}
bool MapUtils :: add_message_about_items_on_tile_if_necessary ( CreaturePtr creature , TilePtr tile ) { bool msg_added = false ; if ( creature && creature -> get_is_player ( ) ) { IInventoryPtr tile_items = tile -> get_items ( ) ; if ( ! tile_items -> empty ( ) ) { string item_message ; if ( tile_items -> size ( ) == 1 ) { ItemPtr item_on_tile = tile_items -> at ( 0 ) ; if ( item_on_tile ) { CurrentCreatureAbilities cca ; item_message = TextMessages :: get_item_on_ground_description_message ( ! cca . can_see ( creature ) , item_on_tile ) ; } } else { item_message = StringTable :: get ( MovementTextKeys :: ITEMS_ON_TILE ) ; } if ( ! item_message . empty ( ) ) { IMessageManager & manager = MM :: instance ( ) ; manager . add_new_message ( item_message ) ; msg_added = true ; } } } return msg_added ; }
Add a message if the creature is the player, and if there are items on
the tile.
Add a message if the creature is the player and if there are items on the tile .
// One item // Multiple items // Send the message