Added PushEntity() & PopEntity() to RoomManager
Calling them from server_character_methods.cpp.
This commit is contained in:
@@ -45,6 +45,9 @@ void ServerApplication::HandleCharacterCreate(CharacterPacket* const argPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
//push this character to the rooms
|
||||
roomMgr.PushEntity(characterMgr.Get(characterIndex));
|
||||
|
||||
//pump this character to all clients
|
||||
CharacterPacket newPacket;
|
||||
CopyCharacterToPacket(&newPacket, characterIndex);
|
||||
@@ -87,6 +90,7 @@ void ServerApplication::HandleCharacterDelete(CharacterPacket* const argPacket)
|
||||
}
|
||||
|
||||
//delete the character
|
||||
roomMgr.PopEntity(characterMgr.Get(characterIndex));
|
||||
characterMgr.Delete(characterIndex);
|
||||
|
||||
//pump character delete
|
||||
@@ -119,6 +123,9 @@ void ServerApplication::HandleCharacterLoad(CharacterPacket* const argPacket) {
|
||||
return;
|
||||
}
|
||||
|
||||
//push this character to the rooms
|
||||
roomMgr.PushEntity(characterMgr.Get(characterIndex));
|
||||
|
||||
//pump this character to all clients
|
||||
CharacterPacket newPacket;
|
||||
CopyCharacterToPacket(&newPacket, characterIndex);
|
||||
@@ -150,6 +157,7 @@ void ServerApplication::HandleCharacterUnload(CharacterPacket* const argPacket)
|
||||
}
|
||||
|
||||
//unload the character
|
||||
roomMgr.PopEntity(characterData);
|
||||
characterMgr.Unload(argPacket->characterIndex);
|
||||
|
||||
//pump character delete
|
||||
@@ -190,11 +198,17 @@ void ServerApplication::HandleCharacterSetRoom(CharacterPacket* const argPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
//pop from the rooms
|
||||
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 rooms
|
||||
roomMgr.PushEntity(characterData);
|
||||
|
||||
//update the clients
|
||||
CharacterPacket newPacket;
|
||||
CopyCharacterToPacket(&newPacket, argPacket->characterIndex);
|
||||
|
||||
Reference in New Issue
Block a user