From c5c317849cb95bd7be0db073f780e35ab8872a06 Mon Sep 17 00:00:00 2001 From: Wanne Date: Sun, 18 May 2008 18:36:03 +0000 Subject: [PATCH] - bugfix mp: If server sets ALLOW_CUSTOM_NIV = 0 and clients select another interface than the server, the following problems occured: * crash if clients opens the inventory * from merc item layouts if you hire a merc * if client plays in 640x480 res and server selects NIV a crash occured git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2181 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Multiplayer/client.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Multiplayer/client.cpp b/Multiplayer/client.cpp index c866956c..5d5d4db8 100644 --- a/Multiplayer/client.cpp +++ b/Multiplayer/client.cpp @@ -113,6 +113,7 @@ unsigned char packetIdentifier; #include "laptop.h" #include "test_space.h" +#include "interface panels.h" @@ -1895,7 +1896,35 @@ void recieveSETTINGS (RPCParameters *rpcParameters) //recive settings from serve WEAPON_READIED_BONUS=cl_lan->WEAPON_READIED_BONUS; ALLOW_CUSTOM_NIV=cl_lan->ALLOW_CUSTOM_NIV; - if(ALLOW_CUSTOM_NIV==0)gGameOptions.ubInventorySystem=cl_lan->sofNewInv; + + + if(ALLOW_CUSTOM_NIV==0) + { + // WANNE - MP: If the clients has selected another inventory than the server had choosen. + if (gGameOptions.ubInventorySystem != cl_lan->sofNewInv) + { + gGameOptions.ubInventorySystem=cl_lan->sofNewInv; + + // WANNE - MP: We have to re-initialize the correct interface + if((UsingNewInventorySystem() == true) && IsNIVModeValid(true)) + { + InitNewInventorySystem(); + InitializeSMPanelCoordsNew(); + InitializeInvPanelCoordsNew(); + } + else + { + gGameOptions.ubInventorySystem = 0; + InitOldInventorySystem(); + InitializeSMPanelCoordsOld(); + InitializeInvPanelCoordsOld(); + } + + // WANNE - MP: We also have to reinitialize the merc profiles because + // they depend on the inventory! + LoadMercProfiles(); + } + } ScreenMsg( FONT_LTGREEN, MSG_CHAT, MPClientMessage[26],cl_lan->client_num,szDefault,cl_lan->cl_edge,cl_lan->team );