1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-04-01 08:06:45 +00:00

Rename server's GetController() method into GetPlayerController()

This commit is contained in:
David Cernat 2016-10-19 16:54:39 +03:00
parent d2212ef80b
commit bda1f867fd
9 changed files with 55 additions and 55 deletions

View file

@ -26,9 +26,9 @@ Networking::Networking(RakNet::RakPeerInterface *peer)
this->peer = peer; this->peer = peer;
players = Players::GetPlayers(); players = Players::GetPlayers();
controller = new PlayerPacketController(peer); playerController = new PlayerPacketController(peer);
controller->SetStream(0, &bsOut); // set send stream playerController->SetStream(0, &bsOut); // set send stream
running = true; running = true;
exitCode = 0; exitCode = 0;
@ -41,7 +41,7 @@ Networking::~Networking()
Script::Call<Script::CallbackIdentity("OnServerExit")>(false); Script::Call<Script::CallbackIdentity("OnServerExit")>(false);
sThis = 0; sThis = 0;
delete controller; delete playerController;
LOG_QUIT(); LOG_QUIT();
} }
@ -57,18 +57,18 @@ void Networking::Update(RakNet::Packet *packet)
(void)ignoredGUID; (void)ignoredGUID;
} }
controller->SetStream(&bsIn, 0); playerController->SetStream(&bsIn, 0);
if (player == 0) if (player == 0)
{ {
controller->GetPacket(ID_HANDSHAKE)->RequestData(packet->guid); playerController->GetPacket(ID_HANDSHAKE)->RequestData(packet->guid);
Players::NewPlayer(packet->guid); Players::NewPlayer(packet->guid);
player = Players::GetPlayer(packet->guid); player = Players::GetPlayer(packet->guid);
controller->GetPacket(ID_USER_MYID)->Send(Players::GetPlayer(packet->guid), false); playerController->GetPacket(ID_USER_MYID)->Send(Players::GetPlayer(packet->guid), false);
return; return;
} }
PlayerPacket *myPacket = controller->GetPacket(packet->data[0]); PlayerPacket *myPacket = playerController->GetPacket(packet->data[0]);
if (packet->data[0] == ID_HANDSHAKE) if (packet->data[0] == ID_HANDSHAKE)
{ {
@ -116,7 +116,7 @@ void Networking::Update(RakNet::Packet *packet)
if (!result) if (!result)
{ {
controller->GetPacket(ID_USER_DISCONNECTED)->Send(Players::GetPlayer(packet->guid), false); playerController->GetPacket(ID_USER_DISCONNECTED)->Send(Players::GetPlayer(packet->guid), false);
Players::DeletePlayer(packet->guid); Players::DeletePlayer(packet->guid);
return; return;
} }
@ -263,7 +263,7 @@ void Networking::Update(RakNet::Packet *packet)
} }
myPacket->Send(player, true); myPacket->Send(player, true);
controller->GetPacket(ID_GAME_DYNAMICSTATS)->RequestData(player->GetAttack()->target); playerController->GetPacket(ID_GAME_DYNAMICSTATS)->RequestData(player->GetAttack()->target);
} }
break; break;
} }
@ -308,8 +308,8 @@ void Networking::Update(RakNet::Packet *packet)
//packetResurrect.Read(player); //packetResurrect.Read(player);
player->CreatureStats()->mDead = false; player->CreatureStats()->mDead = false;
myPacket->Send(player, true); myPacket->Send(player, true);
controller->GetPacket(ID_GAME_POS)->RequestData(player->guid); playerController->GetPacket(ID_GAME_POS)->RequestData(player->guid);
controller->GetPacket(ID_GAME_CELL)->RequestData(player->guid); playerController->GetPacket(ID_GAME_CELL)->RequestData(player->guid);
Script::Call<Script::CallbackIdentity("OnPlayerResurrect")>(player->GetID()); Script::Call<Script::CallbackIdentity("OnPlayerResurrect")>(player->GetID());
@ -378,23 +378,23 @@ void Networking::Update(RakNet::Packet *packet)
void Networking::NewPlayer(RakNet::RakNetGUID guid) void Networking::NewPlayer(RakNet::RakNetGUID guid)
{ {
controller->GetPacket(ID_GAME_BASE_INFO)->RequestData(guid); playerController->GetPacket(ID_GAME_BASE_INFO)->RequestData(guid);
controller->GetPacket(ID_GAME_DYNAMICSTATS)->RequestData(guid); playerController->GetPacket(ID_GAME_DYNAMICSTATS)->RequestData(guid);
controller->GetPacket(ID_GAME_POS)->RequestData(guid); playerController->GetPacket(ID_GAME_POS)->RequestData(guid);
controller->GetPacket(ID_GAME_CELL)->RequestData(guid); playerController->GetPacket(ID_GAME_CELL)->RequestData(guid);
controller->GetPacket(ID_GAME_EQUIPMENT)->RequestData(guid); playerController->GetPacket(ID_GAME_EQUIPMENT)->RequestData(guid);
for (TPlayers::iterator pl = players->begin(); pl != players->end(); pl++) //sending other players to new player for (TPlayers::iterator pl = players->begin(); pl != players->end(); pl++) //sending other players to new player
{ {
if (pl->first == guid) continue; if (pl->first == guid) continue;
controller->GetPacket(ID_GAME_BASE_INFO)->Send(pl->second, guid); playerController->GetPacket(ID_GAME_BASE_INFO)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_DYNAMICSTATS)->Send(pl->second, guid); playerController->GetPacket(ID_GAME_DYNAMICSTATS)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_ATTRIBUTE)->Send(pl->second, guid); playerController->GetPacket(ID_GAME_ATTRIBUTE)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_SKILL)->Send(pl->second, guid); playerController->GetPacket(ID_GAME_SKILL)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_POS)->Send(pl->second, guid); playerController->GetPacket(ID_GAME_POS)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_CELL)->Send(pl->second, guid); playerController->GetPacket(ID_GAME_CELL)->Send(pl->second, guid);
controller->GetPacket(ID_GAME_EQUIPMENT)->Send(pl->second, guid); playerController->GetPacket(ID_GAME_EQUIPMENT)->Send(pl->second, guid);
} }
} }
@ -407,13 +407,13 @@ void Networking::DisconnectPlayer(RakNet::RakNetGUID guid)
if (!player) if (!player)
return; return;
Script::Call<Script::CallbackIdentity("OnPlayerDisconnect")>(player->GetID()); Script::Call<Script::CallbackIdentity("OnPlayerDisconnect")>(player->GetID());
controller->GetPacket(ID_USER_DISCONNECTED)->Send(player, true); playerController->GetPacket(ID_USER_DISCONNECTED)->Send(player, true);
Players::DeletePlayer(guid); Players::DeletePlayer(guid);
} }
PlayerPacketController *Networking::GetController() const PlayerPacketController *Networking::GetPlayerController() const
{ {
return controller; return playerController;
} }
const Networking &Networking::Get() const Networking &Networking::Get()

View file

@ -27,7 +27,7 @@ namespace mwmp
void StopServer(int code); void StopServer(int code);
PlayerPacketController *GetController() const; PlayerPacketController *GetPlayerController() const;
static const Networking &Get(); static const Networking &Get();
static Networking *GetPtr(); static Networking *GetPtr();
@ -37,7 +37,7 @@ namespace mwmp
RakNet::BitStream bsOut; RakNet::BitStream bsOut;
TPlayers *players; TPlayers *players;
PlayerPacketController *controller; PlayerPacketController *playerController;
bool running; bool running;
int exitCode; int exitCode;

View file

@ -15,7 +15,7 @@ void CharClassFunctions::SendClass(unsigned short pid) noexcept
Player *player; Player *player;
GET_PLAYER(pid, player,); GET_PLAYER(pid, player,);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_CHARCLASS)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_CHARCLASS)->Send(player, false);
} }
void CharClassFunctions::SetDefaultClass(unsigned short pid, const char *id) noexcept void CharClassFunctions::SetDefaultClass(unsigned short pid, const char *id) noexcept

View file

@ -15,9 +15,9 @@ void ScriptFunctions::SendMessage(unsigned short pid, const char *message, bool
DEBUG_PRINTF("System: %s", message); DEBUG_PRINTF("System: %s", message);
mwmp::Networking::Get().GetController()->GetPacket(ID_CHAT_MESSAGE)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_CHAT_MESSAGE)->Send(player, false);
if (broadcast) if (broadcast)
mwmp::Networking::Get().GetController()->GetPacket(ID_CHAT_MESSAGE)->Send(player, true); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_CHAT_MESSAGE)->Send(player, true);
} }
void ScriptFunctions::CleanChat(unsigned short pid) void ScriptFunctions::CleanChat(unsigned short pid)

View file

@ -18,7 +18,7 @@ void GUIFunctions::_MessageBox(unsigned short pid, int id, const char *label) no
player->guiMessageBox.label = label; player->guiMessageBox.label = label;
player->guiMessageBox.type = Player::GUIMessageBox::MessageBox; player->guiMessageBox.type = Player::GUIMessageBox::MessageBox;
mwmp::Networking::Get().GetController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false);
} }
void GUIFunctions::CustomMessageBox(unsigned short pid, int id, const char *label, const char *buttons) noexcept void GUIFunctions::CustomMessageBox(unsigned short pid, int id, const char *label, const char *buttons) noexcept
@ -31,7 +31,7 @@ void GUIFunctions::CustomMessageBox(unsigned short pid, int id, const char *labe
player->guiMessageBox.buttons = buttons; player->guiMessageBox.buttons = buttons;
player->guiMessageBox.type = Player::GUIMessageBox::CustomMessageBox; player->guiMessageBox.type = Player::GUIMessageBox::CustomMessageBox;
mwmp::Networking::Get().GetController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false);
} }
void GUIFunctions::InputDialog(unsigned short pid, int id, const char *label) noexcept void GUIFunctions::InputDialog(unsigned short pid, int id, const char *label) noexcept
@ -43,7 +43,7 @@ void GUIFunctions::InputDialog(unsigned short pid, int id, const char *label) no
player->guiMessageBox.label = label; player->guiMessageBox.label = label;
player->guiMessageBox.type = Player::GUIMessageBox::InputDialog; player->guiMessageBox.type = Player::GUIMessageBox::InputDialog;
mwmp::Networking::Get().GetController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(player, false);
} }
void GUIFunctions::SetMapVisibility(unsigned short targetPID, unsigned short affectedPID, unsigned short state) noexcept void GUIFunctions::SetMapVisibility(unsigned short targetPID, unsigned short affectedPID, unsigned short state) noexcept

View file

@ -65,6 +65,6 @@ void ItemFunctions::SendEquipment(unsigned short pid) noexcept
Player *player; Player *player;
GET_PLAYER(pid, player, ); GET_PLAYER(pid, player, );
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_EQUIPMENT)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_EQUIPMENT)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_EQUIPMENT)->Send(player, true); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_EQUIPMENT)->Send(player, true);
} }

View file

@ -454,14 +454,14 @@ void StatsFunctions::SetCharGenStage(unsigned short pid, int start, int end) noe
player->CharGenStage()->current = start; player->CharGenStage()->current = start;
player->CharGenStage()->end = end; player->CharGenStage()->end = end;
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_CHARGEN)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_CHARGEN)->Send(player, false);
} }
void StatsFunctions::Resurrect(unsigned short pid) void StatsFunctions::Resurrect(unsigned short pid)
{ {
Player *player; Player *player;
GET_PLAYER(pid, player,); GET_PLAYER(pid, player,);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_RESURRECT)->RequestData(player->guid); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_RESURRECT)->RequestData(player->guid);
} }
void StatsFunctions::SendBaseInfo(unsigned short pid) noexcept void StatsFunctions::SendBaseInfo(unsigned short pid) noexcept
@ -469,16 +469,16 @@ void StatsFunctions::SendBaseInfo(unsigned short pid) noexcept
Player *player; Player *player;
GET_PLAYER(pid, player,); GET_PLAYER(pid, player,);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_BASE_INFO)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_BASE_INFO)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_BASE_INFO)->Send(player, true); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_BASE_INFO)->Send(player, true);
} }
void StatsFunctions::SendDynamicStats(unsigned short pid) noexcept void StatsFunctions::SendDynamicStats(unsigned short pid) noexcept
{ {
Player *player; Player *player;
GET_PLAYER(pid, player, ); GET_PLAYER(pid, player, );
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_DYNAMICSTATS)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_DYNAMICSTATS)->Send(player, true); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_DYNAMICSTATS)->Send(player, true);
} }
void StatsFunctions::SendAttributes(unsigned short pid) noexcept void StatsFunctions::SendAttributes(unsigned short pid) noexcept
@ -486,8 +486,8 @@ void StatsFunctions::SendAttributes(unsigned short pid) noexcept
Player *player; Player *player;
GET_PLAYER(pid, player,); GET_PLAYER(pid, player,);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_ATTRIBUTE)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_ATTRIBUTE)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_ATTRIBUTE)->Send(player, true); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_ATTRIBUTE)->Send(player, true);
} }
void StatsFunctions::SendSkills(unsigned short pid) noexcept void StatsFunctions::SendSkills(unsigned short pid) noexcept
@ -495,8 +495,8 @@ void StatsFunctions::SendSkills(unsigned short pid) noexcept
Player *player; Player *player;
GET_PLAYER(pid, player,); GET_PLAYER(pid, player,);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_SKILL)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_SKILL)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_SKILL)->Send(player, true); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_SKILL)->Send(player, true);
} }
void StatsFunctions::SendLevel(unsigned short pid) noexcept void StatsFunctions::SendLevel(unsigned short pid) noexcept
@ -504,6 +504,6 @@ void StatsFunctions::SendLevel(unsigned short pid) noexcept
Player *player; Player *player;
GET_PLAYER(pid, player, ); GET_PLAYER(pid, player, );
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_LEVEL)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_LEVEL)->Send(player, false);
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_LEVEL)->Send(player, true); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_LEVEL)->Send(player, true);
} }

View file

@ -58,7 +58,7 @@ void TranslocationFunctions::SetPos(unsigned short pid, double x, double y, doub
player->Position()->pos[1] = y; player->Position()->pos[1] = y;
player->Position()->pos[2] = z; player->Position()->pos[2] = z;
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_POS)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_POS)->Send(player, false);
} }
void TranslocationFunctions::SetCell(unsigned short pid, const char *name) noexcept void TranslocationFunctions::SetCell(unsigned short pid, const char *name) noexcept
@ -80,7 +80,7 @@ void TranslocationFunctions::SetCell(unsigned short pid, const char *name) noexc
player->GetCell()->mName = name; player->GetCell()->mName = name;
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_CELL)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_CELL)->Send(player, false);
} }
const char* TranslocationFunctions::GetCell(unsigned short pid) noexcept const char* TranslocationFunctions::GetCell(unsigned short pid) noexcept
@ -111,7 +111,7 @@ void TranslocationFunctions::SetExterior(unsigned short pid, int x, int y) noexc
player->GetCell()->mCellId.mIndex.mX = x; player->GetCell()->mCellId.mIndex.mX = x;
player->GetCell()->mCellId.mIndex.mY = y; player->GetCell()->mCellId.mIndex.mY = y;
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_CELL)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_CELL)->Send(player, false);
} }
int TranslocationFunctions::GetExteriorX(unsigned short pid) noexcept int TranslocationFunctions::GetExteriorX(unsigned short pid) noexcept
@ -183,5 +183,5 @@ void TranslocationFunctions::SetAngle(unsigned short pid, double x, double y, do
player->Position()->rot[1] = y; player->Position()->rot[1] = y;
player->Position()->rot[2] = z; player->Position()->rot[2] = z;
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_POS)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_POS)->Send(player, false);
} }

View file

@ -17,7 +17,7 @@ void WorldFunctions::SetHour(unsigned short pid, double hour) noexcept
player->month = -1; player->month = -1;
player->day = -1; player->day = -1;
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_TIME)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_TIME)->Send(player, false);
} }
void WorldFunctions::SetMonth(unsigned short pid, int month) noexcept void WorldFunctions::SetMonth(unsigned short pid, int month) noexcept
@ -29,7 +29,7 @@ void WorldFunctions::SetMonth(unsigned short pid, int month) noexcept
player->month = month; player->month = month;
player->day = -1; player->day = -1;
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_TIME)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_TIME)->Send(player, false);
} }
@ -42,5 +42,5 @@ void WorldFunctions::SetDay(unsigned short pid, int day) noexcept
player->month = -1; player->month = -1;
player->day = day; player->day = day;
mwmp::Networking::Get().GetController()->GetPacket(ID_GAME_TIME)->Send(player, false); mwmp::Networking::Get().GetPlayerController()->GetPacket(ID_GAME_TIME)->Send(player, false);
} }