mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 17:54:01 +00:00
chore: Simplify and move Player functionality to relevant component (#1408)
* Moving and organizing Player code - Move code to CharacterComponent - Remove extraneous interfaces - Simplify some code greatly - Change some types to return and take in const ref (only structs larger than 8 bytes benefit from this change.) - Update code to use CharacterComponent for sending to zone instead of Player*. * Moving and organizing Player code - Move code to CharacterComponent - Remove extraneous interfaces - Simplify some code greatly - Change some types to return and take in const ref (only structs larger than 8 bytes benefit from this change.) - Update code to use CharacterComponent for sending to zone instead of Player*. - Remove static storage container (static containers can be destroyed before exit/terminate handler executes) * remove player cast * Remove extra includes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "BaseConsoleTeleportServer.h"
|
||||
#include "GameMessages.h"
|
||||
#include "Player.h"
|
||||
#include "CharacterComponent.h"
|
||||
#include "RenderComponent.h"
|
||||
#include "EntityManager.h"
|
||||
#include "eTerminateType.h"
|
||||
@@ -94,7 +94,9 @@ void BaseConsoleTeleportServer::TransferPlayer(Entity* self, Entity* player, int
|
||||
|
||||
const auto& teleportZone = self->GetVar<std::u16string>(u"transferZoneID");
|
||||
|
||||
static_cast<Player*>(player)->SendToZone(std::stoi(GeneralUtils::UTF16ToWTF8(teleportZone)));
|
||||
auto* characterComponent = player->GetComponent<CharacterComponent>();
|
||||
|
||||
if (characterComponent) characterComponent->SendToZone(std::stoi(GeneralUtils::UTF16ToWTF8(teleportZone)));
|
||||
|
||||
UpdatePlayerTable(self, player, false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user