Пример #1
0
void Game::process()
{
   Admin* admin;
   Client * player;
   Clients* clients = mClientMgr.list();
   bool worldSave = false;
   for (Clients::iterator client=clients->begin(); client != clients->end(); client++)
   {
      player = client->second;
      if (player->isAdmin())
      {
         admin = player->getAdmin();

         /* Add any buildings that an admin has placed down. */
         processBuildingReqs(admin);

         /* Check if the save command was issued */
         if (admin->getWorldSaveReq())
         {
            worldSave = true;
         }
      }
   }

   if (worldSave)
   {
      mZoneMgr.saveWorld();
   }
}
Пример #2
0
std::string get_name_by_sock(Clients clients, int sockfd)
{
   /* cauta numele dupa socket */
   std::map <std::string, ClientInfo> ::iterator it;
   
   for (it = clients.begin(); it != clients.end(); it++)
      if ((*it).second.getSock() == sockfd)
	 return (*it).first;
      
   return "anonymous";
}
Пример #3
0
void BellServer::handleButton(uint8 buttonNo)
{
	switch(buttonNo)
	{
		case 6:
			printf("Call all\n");
		break;
		default:
			uint32 key = indexToKey(buttonNo);
			printf("Calling client %i with key: %08X\n", buttonNo, key);
			Clients *bells = &clientBells_[key];
			
			// Go through all client attached to this bell
			for(ClientsIt it=bells->begin(); it!=bells->end(); it++)
			{
				if(it->first == 0) continue;
				BellSocket *socket = it->second;
				socket->handleCall();
			}
		break;
	}
}