fix: Improve job type initialization and handle game state during loading
This commit is contained in:
7
Main.cs
7
Main.cs
@@ -1660,9 +1660,10 @@ namespace KCM
|
||||
__instance.JobCustomMaxEnabledFlag = new bool[World.inst.NumLandMasses][];
|
||||
for (int lm = 0; lm < World.inst.NumLandMasses; lm++)
|
||||
{
|
||||
__instance.JobFilledAvailable[lm] = new int[38];
|
||||
__instance.JobCustomMaxEnabledFlag[lm] = new bool[38];
|
||||
for (int n = 0; n < 38; n++)
|
||||
int numJobTypes = p.JobFilledAvailable.data[lm].GetLength(0);
|
||||
__instance.JobFilledAvailable[lm] = new int[numJobTypes];
|
||||
__instance.JobCustomMaxEnabledFlag[lm] = new bool[numJobTypes];
|
||||
for (int n = 0; n < numJobTypes; n++)
|
||||
{
|
||||
__instance.JobFilledAvailable[lm][n] = p.JobFilledAvailable.data[lm][n, 1];
|
||||
}
|
||||
|
||||
@@ -57,7 +57,17 @@ namespace KCM.Packets.Lobby
|
||||
|
||||
public override void HandlePacketClient()
|
||||
{
|
||||
Start();
|
||||
if (!LobbyManager.loadingSave)
|
||||
{
|
||||
Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
// If loading a save, just ensure the game is in the correct UI state for loading.
|
||||
// The actual game start will happen after save data is unpacked in SaveTransferPacket.HandlePacketClient().
|
||||
// This prevents MainMenuMode.StartGame() from being called prematurely and causing NullReferenceExceptions.
|
||||
GameState.inst.SetNewMode(GameState.inst.playingMode);
|
||||
}
|
||||
}
|
||||
|
||||
public override void HandlePacketServer()
|
||||
|
||||
Reference in New Issue
Block a user