diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/bg_public.h | 2 | ||||
-rw-r--r-- | src/game/g_cmds.c | 44 |
2 files changed, 20 insertions, 26 deletions
diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 688b45e8..20dd5eaf 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -549,6 +549,8 @@ typedef enum typedef enum { + MN_NONE, + MN_TEAM, MN_A_TEAMFULL, MN_H_TEAMFULL, diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 9c670d5a..d2bbf97b 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -2501,8 +2501,11 @@ void Cmd_Build_f( gentity_t *ent ) ( ( team == TEAM_ALIENS && BG_BuildableAllowedInStage( buildable, g_alienStage.integer ) ) || ( team == TEAM_HUMANS && BG_BuildableAllowedInStage( buildable, g_humanStage.integer ) ) ) ) { + dynMenu_t err; dist = BG_Class( ent->client->ps.stats[ STAT_CLASS ] )->buildDist; + ent->client->ps.stats[ STAT_BUILDABLE ] = 0; + //these are the errors displayed when the builder first selects something to use switch( G_CanBuild( ent, buildable, dist, origin ) ) { @@ -2512,7 +2515,9 @@ void Cmd_Build_f( gentity_t *ent ) case IBE_RPTNOREAC: case IBE_RPTPOWERHERE: case IBE_SPWNWARN: - ent->client->ps.stats[ STAT_BUILDABLE ] = ( buildable | SB_VALID_TOGGLEBIT ); + err = MN_NONE; + // we OR-in the selected builable later + ent->client->ps.stats[ STAT_BUILDABLE ] = SB_VALID_TOGGLEBIT; break; // can't place yet but maybe soon: start with valid togglebit off @@ -2523,55 +2528,42 @@ void Cmd_Build_f( gentity_t *ent ) case IBE_NOOVERMIND: case IBE_NOPOWERHERE: case IBE_RPWCAUSEOVRL: - ent->client->ps.stats[ STAT_BUILDABLE ] = buildable; + err = MN_NONE; break; // more serious errors just pop a menu case IBE_NOALIENBP: - if( ent->client->pers.disableBlueprintErrors ) - ent->client->ps.stats[ STAT_BUILDABLE ] = buildable; - else - G_TriggerMenu( ent->client->ps.clientNum, MN_A_NOBP ); + err = MN_A_NOBP; break; case IBE_ONEOVERMIND: - if( ent->client->pers.disableBlueprintErrors ) - ent->client->ps.stats[ STAT_BUILDABLE ] = buildable; - else - G_TriggerMenu( ent->client->ps.clientNum, MN_A_ONEOVERMIND ); + err = MN_A_ONEOVERMIND; break; case IBE_ONEHOVEL: - if( ent->client->pers.disableBlueprintErrors ) - ent->client->ps.stats[ STAT_BUILDABLE ] = buildable; - else - G_TriggerMenu( ent->client->ps.clientNum, MN_A_ONEHOVEL ); + err = MN_A_ONEHOVEL; break; case IBE_ONEREACTOR: - if( ent->client->pers.disableBlueprintErrors ) - ent->client->ps.stats[ STAT_BUILDABLE ] = buildable; - else - G_TriggerMenu( ent->client->ps.clientNum, MN_H_ONEREACTOR ); + err = MN_H_ONEREACTOR; break; case IBE_NOHUMANBP: - if( ent->client->pers.disableBlueprintErrors ) - ent->client->ps.stats[ STAT_BUILDABLE ] = buildable; - else - G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOBP); + err = MN_H_NOBP; break; case IBE_NODCC: - if( ent->client->pers.disableBlueprintErrors ) - ent->client->ps.stats[ STAT_BUILDABLE ] = buildable; - else - G_TriggerMenu( ent->client->ps.clientNum, MN_H_NODCC ); + err = MN_H_NODCC; break; default: break; } + + if( err == MN_NONE || ent->client->pers.disableBlueprintErrors ) + ent->client->ps.stats[ STAT_BUILDABLE ] |= buildable; + else + G_TriggerMenu( ent->client->ps.clientNum, err ); } else G_TriggerMenu( ent->client->ps.clientNum, MN_B_CANNOT ); |