From ad9fa0631a0c7f33692cee330579a5ac9af93bbc Mon Sep 17 00:00:00 2001 From: David Cernat Date: Thu, 13 Jul 2017 20:13:28 +0300 Subject: [PATCH] [General] Rename jailText to jailEndText and add jailProgressText in PlayerJail --- apps/openmw-mp/Script/Functions/Mechanics.cpp | 6 +++-- apps/openmw-mp/Script/Functions/Mechanics.hpp | 3 ++- apps/openmw/mwgui/jailscreen.cpp | 22 ++++++++++++++----- apps/openmw/mwmp/LocalPlayer.cpp | 3 ++- components/openmw-mp/Base/BasePlayer.hpp | 3 ++- .../Packets/Player/PacketPlayerJail.cpp | 3 ++- 6 files changed, 28 insertions(+), 12 deletions(-) diff --git a/apps/openmw-mp/Script/Functions/Mechanics.cpp b/apps/openmw-mp/Script/Functions/Mechanics.cpp index df36bbe8c..b0a430c22 100644 --- a/apps/openmw-mp/Script/Functions/Mechanics.cpp +++ b/apps/openmw-mp/Script/Functions/Mechanics.cpp @@ -7,7 +7,8 @@ #include using namespace std; -void MechanicsFunctions::Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation, bool ignoreJailSkillIncreases, const char* jailText) noexcept +void MechanicsFunctions::Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation, bool ignoreJailSkillIncreases, + const char* jailProgressText, const char* jailEndText) noexcept { Player *player; GET_PLAYER(pid, player, ); @@ -15,7 +16,8 @@ void MechanicsFunctions::Jail(unsigned short pid, int jailDays, bool ignoreJailT player->jailDays = jailDays; player->ignoreJailTeleportation = ignoreJailTeleportation; player->ignoreJailSkillIncreases = ignoreJailSkillIncreases; - player->jailText = jailText; + player->jailProgressText = jailProgressText; + player->jailEndText = jailEndText; mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_JAIL)->setPlayer(player); mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_PLAYER_JAIL)->Send(false); diff --git a/apps/openmw-mp/Script/Functions/Mechanics.hpp b/apps/openmw-mp/Script/Functions/Mechanics.hpp index 5a996dcf2..05e2bda68 100644 --- a/apps/openmw-mp/Script/Functions/Mechanics.hpp +++ b/apps/openmw-mp/Script/Functions/Mechanics.hpp @@ -11,7 +11,8 @@ class MechanicsFunctions { public: - static void Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation = false, bool ignoreJailSkillIncreases = false, const char* jailText = "") noexcept; + static void Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation = false, bool ignoreJailSkillIncreases = false, + const char* jailProgressText = "", const char* jailEndText = "") noexcept; static void Resurrect(unsigned short pid, unsigned int type) noexcept; }; diff --git a/apps/openmw/mwgui/jailscreen.cpp b/apps/openmw/mwgui/jailscreen.cpp index 99404a5d7..14b715c7f 100644 --- a/apps/openmw/mwgui/jailscreen.cpp +++ b/apps/openmw/mwgui/jailscreen.cpp @@ -56,6 +56,17 @@ namespace MWGui mProgressBar->setScrollRange(100+1); mProgressBar->setScrollPosition(0); mProgressBar->setTrackSize(0); + + /* + Start of tes3mp addition + + If we've received a packet overriding the default jail progress text, use the new text + */ + if (!mwmp::Main::get().getLocalPlayer()->jailProgressText.empty()) + setText("LoadingText", mwmp::Main::get().getLocalPlayer()->jailProgressText); + /* + End of tes3mp addition + */ } void JailScreen::onFrame(float dt) @@ -139,12 +150,10 @@ namespace MWGui /* Start of tes3mp addition - If we've received a packet overriding the default jail text, use the new text + If we've received a packet overriding the default jail end text, use the new text */ - if (!mwmp::Main::get().getLocalPlayer()->jailText.empty()) - { - message = mwmp::Main::get().getLocalPlayer()->jailText; - } + if (!mwmp::Main::get().getLocalPlayer()->jailEndText.empty()) + message = mwmp::Main::get().getLocalPlayer()->jailEndText; /* End of tes3mp addition */ @@ -187,7 +196,8 @@ namespace MWGui */ mwmp::Main::get().getLocalPlayer()->ignoreJailTeleportation = false; mwmp::Main::get().getLocalPlayer()->ignoreJailSkillIncreases = false; - mwmp::Main::get().getLocalPlayer()->jailText = ""; + mwmp::Main::get().getLocalPlayer()->jailProgressText = ""; + mwmp::Main::get().getLocalPlayer()->jailEndText = ""; /* End of tes3mp addition */ diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index c7418c72b..a84543978 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -59,7 +59,8 @@ LocalPlayer::LocalPlayer() deathReason = "suicide"; isChangingRegion = false; - jailText = ""; + jailProgressText = ""; + jailEndText = ""; } LocalPlayer::~LocalPlayer() diff --git a/components/openmw-mp/Base/BasePlayer.hpp b/components/openmw-mp/Base/BasePlayer.hpp index 15862de98..1f40f34f6 100644 --- a/components/openmw-mp/Base/BasePlayer.hpp +++ b/components/openmw-mp/Base/BasePlayer.hpp @@ -256,7 +256,8 @@ namespace mwmp int jailDays; bool ignoreJailTeleportation; bool ignoreJailSkillIncreases; - std::string jailText; + std::string jailProgressText; + std::string jailEndText; unsigned int resurrectType; }; diff --git a/components/openmw-mp/Packets/Player/PacketPlayerJail.cpp b/components/openmw-mp/Packets/Player/PacketPlayerJail.cpp index ce0314697..a265314f2 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerJail.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerJail.cpp @@ -16,5 +16,6 @@ void PacketPlayerJail::Packet(RakNet::BitStream *bs, bool send) RW(player->jailDays, send); RW(player->ignoreJailTeleportation, send); RW(player->ignoreJailSkillIncreases, send); - RW(player->jailText, send, 1); + RW(player->jailProgressText, send, 1); + RW(player->jailEndText, send, 1); }