Reimplemented the push/pop entity methods in RoomManager
Some accessors in Entity had to be made const, as they were being called from lambdas with const parameters.
This commit is contained in:
@@ -45,6 +45,9 @@ void ServerApplication::HandleCharacterCreate(CharacterPacket* const argPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
//push to the rooms
|
||||
roomMgr.PushEntity(characterMgr.Get(characterIndex));
|
||||
|
||||
//pump this character to all clients
|
||||
CharacterPacket newPacket;
|
||||
CopyCharacterToPacket(&newPacket, characterIndex);
|
||||
@@ -86,6 +89,9 @@ void ServerApplication::HandleCharacterDelete(CharacterPacket* const argPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
//pop from the rooms
|
||||
roomMgr.PopEntity(characterMgr.Get(characterIndex));
|
||||
|
||||
//delete the character
|
||||
characterMgr.Delete(characterIndex);
|
||||
|
||||
@@ -119,6 +125,9 @@ void ServerApplication::HandleCharacterLoad(CharacterPacket* const argPacket) {
|
||||
return;
|
||||
}
|
||||
|
||||
//push to the rooms
|
||||
roomMgr.PushEntity(characterMgr.Get(characterIndex));
|
||||
|
||||
//pump this character to all clients
|
||||
CharacterPacket newPacket;
|
||||
CopyCharacterToPacket(&newPacket, characterIndex);
|
||||
@@ -149,6 +158,9 @@ void ServerApplication::HandleCharacterUnload(CharacterPacket* const argPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
//pop from the rooms
|
||||
roomMgr.PopEntity(characterData);
|
||||
|
||||
//unload the character
|
||||
characterMgr.Unload(argPacket->characterIndex);
|
||||
|
||||
@@ -190,11 +202,17 @@ void ServerApplication::HandleCharacterSetRoom(CharacterPacket* const argPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
//pop from the old room
|
||||
roomMgr.PopEntity(characterData);
|
||||
|
||||
//set the character's room, zero it's origin, zero it's motion
|
||||
characterData->SetRoomIndex(argPacket->roomIndex);
|
||||
characterData->SetOrigin({0, 0});
|
||||
characterData->SetMotion({0, 0});
|
||||
|
||||
//push to the new room
|
||||
roomMgr.PushEntity(characterData);
|
||||
|
||||
//update the clients
|
||||
CharacterPacket newPacket;
|
||||
CopyCharacterToPacket(&newPacket, argPacket->characterIndex);
|
||||
|
||||
Reference in New Issue
Block a user