Fixed bug when client would recieve input command from an entity that the client didn't know about
This commit is contained in:
@@ -287,10 +287,14 @@ void Client::parseSnapshot(Packet& packet)
|
|||||||
Events::InputCommand e;
|
Events::InputCommand e;
|
||||||
e.PlayerID = packet.ReadPrimitive<EntityID>();
|
e.PlayerID = packet.ReadPrimitive<EntityID>();
|
||||||
EntityID player = packet.ReadPrimitive<EntityID>();
|
EntityID player = packet.ReadPrimitive<EntityID>();
|
||||||
e.Player = EntityWrapper(m_World, m_ServerIDToClientID.at(player));
|
std::string command = packet.ReadString();
|
||||||
e.Command = packet.ReadString();
|
float value = packet.ReadPrimitive<float>();
|
||||||
e.Value = packet.ReadPrimitive<float>();
|
if (m_ServerIDToClientID.find(player) != m_ServerIDToClientID.end()) {
|
||||||
m_EventBroker->Publish(e);
|
e.Player = EntityWrapper(m_World, m_ServerIDToClientID.at(player));
|
||||||
|
e.Command = command;
|
||||||
|
e.Value = value;
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read world state
|
// Read world state
|
||||||
|
|||||||
Reference in New Issue
Block a user