diff --git a/apps/openmw-mp/Script/Functions/Mechanics.cpp b/apps/openmw-mp/Script/Functions/Mechanics.cpp index fd78299af..90d5c0a3f 100644 --- a/apps/openmw-mp/Script/Functions/Mechanics.cpp +++ b/apps/openmw-mp/Script/Functions/Mechanics.cpp @@ -7,13 +7,14 @@ #include using namespace std; -void MechanicsFunctions::Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation) noexcept +void MechanicsFunctions::Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation, const char* jailText) noexcept { Player *player; GET_PLAYER(pid, player, ); player->jailDays = jailDays; player->ignoreJailTeleportation = ignoreJailTeleportation; + player->jailText = jailText; 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 004692091..1554dbc00 100644 --- a/apps/openmw-mp/Script/Functions/Mechanics.hpp +++ b/apps/openmw-mp/Script/Functions/Mechanics.hpp @@ -11,7 +11,7 @@ class MechanicsFunctions { public: - static void Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation) noexcept; + static void Jail(unsigned short pid, int jailDays, bool ignoreJailTeleportation = false, const char* jailText = "") 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 8eb440b27..d6bb2990b 100644 --- a/apps/openmw/mwgui/jailscreen.cpp +++ b/apps/openmw/mwgui/jailscreen.cpp @@ -138,6 +138,20 @@ namespace MWGui End of tes3mp addition */ + /* + Start of tes3mp addition + + If we've received a packet overriding the default jail text, use the new text + */ + if (!mwmp::Main::get().getLocalPlayer()->jailText.empty()) + { + message = mwmp::Main::get().getLocalPlayer()->jailText; + mwmp::Main::get().getLocalPlayer()->jailText = ""; + } + /* + End of tes3mp addition + */ + std::stringstream dayStr; dayStr << mDays; if (message.find("%d") != std::string::npos) diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index 3e56fa0d7..d46cc92d3 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -57,6 +57,8 @@ LocalPlayer::LocalPlayer() deathReason = "suicide"; isChangingRegion = false; + + jailText = ""; } LocalPlayer::~LocalPlayer() diff --git a/components/openmw-mp/Base/BasePlayer.hpp b/components/openmw-mp/Base/BasePlayer.hpp index 346c09dc7..1d815c33e 100644 --- a/components/openmw-mp/Base/BasePlayer.hpp +++ b/components/openmw-mp/Base/BasePlayer.hpp @@ -253,6 +253,7 @@ namespace mwmp int jailDays; bool ignoreJailTeleportation; + std::string jailText; unsigned int resurrectType; }; diff --git a/components/openmw-mp/Packets/Player/PacketPlayerJail.cpp b/components/openmw-mp/Packets/Player/PacketPlayerJail.cpp index 5b568c867..0ef83c4b3 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerJail.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerJail.cpp @@ -15,4 +15,5 @@ void PacketPlayerJail::Packet(RakNet::BitStream *bs, bool send) RW(player->jailDays, send); RW(player->ignoreJailTeleportation, send); + RW(player->jailText, send, 1); }