moving some code to make the server execute it

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/hilnius@13423 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hilnius 2013-08-06 20:59:19 +00:00
parent 67c2cb2395
commit 149875d83c
2 changed files with 4 additions and 2 deletions

View File

@ -51,6 +51,7 @@ bool GameEventsProtocol::notifyEvent(Event* event)
ItemManager::get()->getItem(item_id),
kart,
powerup_type);
Log::info("GameEventsProtocol", "Item picked by a player.");
} break;
default:
Log::warn("GameEventsProtocol", "Unkown message type.");
@ -81,5 +82,6 @@ void GameEventsProtocol::collectedItem(Item* item, AbstractKart* kart)
// 0x01 : item picked : send item id, powerup type and kart race id
ns.ai8(0x01).ai32(item->getItemId()).ai8((int)(kart->getPowerup()->getType())).ai8(player_profile->race_id); // send item,
m_listener->sendMessage(this, peers[i], ns, true); // reliable
Log::info("GameEventsProtocol", "Notified a peer that a kart collected an item.");
}
}

View File

@ -179,6 +179,8 @@ void StartGameProtocol::update()
}
else if (m_state == READY)
{
// set karts into the network game setup
NetworkManager::getInstance()->getGameSetup()->bindKartsToProfiles();
m_state = EXITING;
m_listener->requestTerminate(this);
}
@ -193,8 +195,6 @@ void StartGameProtocol::ready() // on clients, means the loading is finished
ns.ai32(NetworkManager::getInstance()->getPeers()[0]->getClientServerToken()).ai8(1);
Log::info("StartGameProtocol", "Player ready, notifying server.");
m_listener->sendMessage(this, ns, true);
// set karts into the network game setup
NetworkManager::getInstance()->getGameSetup()->bindKartsToProfiles();
m_state = READY;
m_ready = true;
return;