From bc911924733392009d6852c728f7b0770348ec9c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 11 Mar 2009 00:42:04 +0000 Subject: [PATCH] - Fixed a crash in the weapon code with missing player starts. SVN r1471 (trunk) --- src/g_shared/a_weapons.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/g_shared/a_weapons.cpp b/src/g_shared/a_weapons.cpp index 04854182d..6dc70c03c 100644 --- a/src/g_shared/a_weapons.cpp +++ b/src/g_shared/a_weapons.cpp @@ -1140,19 +1140,22 @@ void FWeaponSlots::CompleteSetup(const PClass *type) void P_CompleteWeaponSetup() { - // Set up the weapon slots locally - LocalWeapons.CompleteSetup(players[consoleplayer].mo->GetClass()); - // Now transmit them across the network - for (int i = 0; i < NUM_WEAPON_SLOTS; ++i) + if (players[consoleplayer].mo != NULL) { - if (LocalWeapons.Slots[i].Size() > 0) + // Set up the weapon slots locally + LocalWeapons.CompleteSetup(players[consoleplayer].mo->GetClass()); + // Now transmit them across the network + for (int i = 0; i < NUM_WEAPON_SLOTS; ++i) { - Net_WriteByte(DEM_SETSLOT); - Net_WriteByte(i); - Net_WriteByte(LocalWeapons.Slots[i].Size()); - for(int j = 0; j < LocalWeapons.Slots[i].Size(); j++) + if (LocalWeapons.Slots[i].Size() > 0) { - Net_WriteWeapon(LocalWeapons.Slots[i].GetWeapon(j)); + Net_WriteByte(DEM_SETSLOT); + Net_WriteByte(i); + Net_WriteByte(LocalWeapons.Slots[i].Size()); + for(int j = 0; j < LocalWeapons.Slots[i].Size(); j++) + { + Net_WriteWeapon(LocalWeapons.Slots[i].GetWeapon(j)); + } } } }