Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/network/protocols/game_events_protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ bool GameEventsProtocol::notifyEvent(Event* event)
return true;
}
uint8_t type = data.getUInt8();
// Only startup boost is sent from a client. All other game events are
// notifications sent by the server.
if (NetworkConfig::get()->isServer() && type != GE_STARTUP_BOOST)
{
Log::warn("GameEventsProtocol",
"Ignoring client game event %d from %s.", type,
event->getPeer()->getAddress().toString().c_str());
return true;
}
CaptureTheFlag* ctf = dynamic_cast<CaptureTheFlag*>(World::getWorld());
FreeForAll* ffa = dynamic_cast<FreeForAll*>(World::getWorld());
SoccerWorld* sw = dynamic_cast<SoccerWorld*>(World::getWorld());
Expand Down Expand Up @@ -105,6 +114,12 @@ bool GameEventsProtocol::notifyEvent(Event* event)
{
if (NetworkConfig::get()->isServer())
{
if (data.size() < 1)
{
Log::warn("GameEventsProtocol",
"Too short startup boost request.");
return true;
}
uint8_t kart_id = data.getUInt8();
if (!event->getPeer()->availableKartID(kart_id))
{
Expand Down