Advertisement
Guest User

Untitled

a guest
Nov 15th, 2018
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. void ProtocolGame::GetTileDescription(const Tile* tile, NetworkMessage_ptr msg)
  2. {
  3.     if(tile){
  4.         int count = 0;
  5.         if(tile->ground){
  6.             msg->AddItem(tile->ground);
  7.             count++;
  8.         }
  9.  
  10.         const TileItemVector* items = tile->getItemList();
  11.         const CreatureVector* creatures = tile->getCreatures();
  12.  
  13.         ItemVector::const_iterator it;
  14.         if(items){
  15.             for(it = items->getBeginTopItem(); ((it != items->getEndTopItem()) && (count < 10)); ++it){
  16.                 msg->AddItem(*it);
  17.                 count++;
  18.             }
  19.         }
  20.  
  21.         if(creatures){
  22.             CreatureVector::const_iterator cit;
  23.             for(cit = creatures->begin(); ((cit != creatures->end()) && (count < 10)); ++cit){
  24.                 if(player->canSeeCreature(*cit)){
  25.                     bool known;
  26.                     uint32_t removedKnown;
  27.                     checkCreatureAsKnown((*cit)->getID(), known, removedKnown);
  28.                     AddCreature(msg, *cit, known, removedKnown);
  29.                     count++;
  30.                 }
  31.             }
  32.         }
  33.  
  34.         if(items){
  35.             for(it = items->getBeginDownItem(); ((it != items->getEndDownItem()) && (count < 10)); ++it){
  36.                 msg->AddItem(*it);
  37.                 count++;
  38.             }
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement