Fix rare case where chainsaw spawns before players exist.
This commit is contained in:
parent
f4b07c9cdf
commit
6928249118
2 changed files with 12 additions and 3 deletions
|
|
@ -2117,7 +2117,7 @@ Class SWWMUtility
|
|||
int np = 0;
|
||||
for ( int i=0; i<MAXPLAYERS; i++ )
|
||||
{
|
||||
if ( !playeringame[i] ) continue;
|
||||
if ( !playeringame[i] || !players[i].mo ) continue;
|
||||
np++;
|
||||
}
|
||||
int required = np;
|
||||
|
|
@ -2182,6 +2182,15 @@ Class SWWMUtility
|
|||
// melee weapon + extra slot 2 guns
|
||||
static Class<Weapon> PickSWWMSlot1()
|
||||
{
|
||||
// [GROSS HACK] default to a hammer if there are no players
|
||||
// (this genuinely can happen, if player starts were placed AFTER the item)
|
||||
int np = 0;
|
||||
for ( int i=0; i<MAXPLAYERS; i++ )
|
||||
{
|
||||
if ( !playeringame[i] || !players[i].mo ) continue;
|
||||
np++;
|
||||
}
|
||||
if ( np <= 0 ) return 'ItamexHammer';
|
||||
// so the player can recover it if they decided to drop it in a previous map, or they didn't start with it
|
||||
if ( CheckNeedsItem('DeepImpact') ) return 'DeepImpact';
|
||||
if ( CheckNeedsItem('ItamexHammer') ) return 'ItamexHammer';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue