chore: Move static Player functions and internal linkage to manager class (#1412)

* 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

* Add a player manager

Used for the static Player functions.  Further removes stuff from the Player class/file.
This commit is contained in:
David Markowitz
2024-01-13 01:40:56 -08:00
committed by GitHub
parent 0bc12141c3
commit a62f6d63c6
12 changed files with 129 additions and 86 deletions

View File

@@ -10,6 +10,7 @@
#include "UserManager.h"
#include "dConfig.h"
#include <optional>
#include "PlayerManager.h"
Entity* GetPossessedEntity(const LWOOBJID& objId) {
auto* entity = Game::entityManager->GetEntity(objId);
@@ -49,7 +50,7 @@ void LogAndSaveFailedAntiCheatCheck(const LWOOBJID& id, const SystemAddress& sys
User* toReport = nullptr;
switch (checkType) {
case CheckType::Entity: {
auto* player = Player::GetPlayer(sysAddr);
auto* player = PlayerManager::GetPlayer(sysAddr);
auto* entity = GetPossessedEntity(id);
// If player exists and entity exists in world, use both for logging info.