Ticket #2676: NetServer.cpp.patch

File NetServer.cpp.patch, 1.0 KB (added by historic_bruno, 7 years ago)

WIP patch

  • NetServer.cpp

     
    837837    {
    838838        CSimulationMessage* simMessage = static_cast<CSimulationMessage*> (message);
    839839
     840        // Ignore messages sent by one player on behalf of another player
     841        PlayerAssignmentMap::iterator it = server.m_PlayerAssignments.find(session->GetGUID());
     842        if (it == server.m_PlayerAssignments.end() || it->second.m_PlayerID != simMessage->m_Player)
     843            return true;
     844
    840845        // Send it back to all clients immediately
    841846        server.Broadcast(simMessage);
    842847
     
    845850            server.m_SavedCommands.resize(simMessage->m_Turn + 1);
    846851        server.m_SavedCommands[simMessage->m_Turn].push_back(*simMessage);
    847852
    848         // TODO: we should do some validation of ownership (clients can't send commands on behalf of opposing players)
    849 
    850853        // TODO: we shouldn't send the message back to the client that first sent it
    851854    }
    852855    else if (message->GetType() == (uint)NMT_SYNC_CHECK)