mirror of
https://github.com/Q3Rally-Team/q3rally.git
synced 2025-02-20 19:12:22 +00:00
Fix crash starting domination gamemode and misc issues
Fix warning not being printed when there are no domination sigil entities. Fix out-of-bounds crash at map load due to setting negative status for all sigil at once. Fix setting pointers to teamgame.sigil[].entity (entity name check was case sensitive and test map is different). Fix ignoring third sigil and later spawning an extra one later. Fix check for modified status in Team_SetSigilStatus(). Fix null pointer crash if domination map doesn't have at least two sigil entities.
This commit is contained in:
parent
83cd2f1ae9
commit
ee81ee56d9
3 changed files with 24 additions and 15 deletions
|
@ -814,13 +814,15 @@ void G_CheckTeamItems( void ) {
|
|||
// Q3Rally Code Start
|
||||
if ( g_gametype.integer == GT_DOMINATION )
|
||||
{
|
||||
gitem_t *item;
|
||||
|
||||
// check for at least one sigil
|
||||
item = BG_FindItem( "Flag" );
|
||||
if ( !item || !itemRegistered[item - bg_itemlist] )
|
||||
G_Printf( S_COLOR_YELLOW "WARNING: No team_DOMINATION_sigil in map" );
|
||||
}
|
||||
gentity_t *ent;
|
||||
|
||||
// check for at least one sigil
|
||||
ent = NULL;
|
||||
ent = G_Find( ent, FOFS(classname), "team_DOMINATION_sigil" );
|
||||
if( !ent ) {
|
||||
G_Printf( S_COLOR_YELLOW "WARNING: No team_DOMINATION_sigil in map\n" );
|
||||
}
|
||||
}
|
||||
// Q3Rally Code END
|
||||
#ifdef MISSIONPACK
|
||||
if( g_gametype.integer == GT_1FCTF ) {
|
||||
|
|
|
@ -780,7 +780,7 @@ void SP_worldspawn( void ) {
|
|||
G_ValidateSigils
|
||||
============================
|
||||
*/
|
||||
void G_ValidateSigils()
|
||||
void G_ValidateSigils( void )
|
||||
{
|
||||
gentity_t *it_ent;
|
||||
|
||||
|
|
|
@ -74,9 +74,11 @@ void Team_InitGame( void ) {
|
|||
|
||||
case GT_DOMINATION:
|
||||
Init_Sigils();
|
||||
teamgame.sigil[0].status = teamgame.sigil[1].status = teamgame.sigil[2].status = -1; // Invalid to force update
|
||||
teamgame.sigil[0].status = -1; // Invalid to force update
|
||||
Team_SetSigilStatus( 0, SIGIL_ISWHITE );
|
||||
teamgame.sigil[1].status = -1; // Invalid to force update
|
||||
Team_SetSigilStatus( 1, SIGIL_ISWHITE );
|
||||
teamgame.sigil[2].status = -1; // Invalid to force update
|
||||
Team_SetSigilStatus( 2, SIGIL_ISWHITE );
|
||||
break;
|
||||
|
||||
|
@ -255,12 +257,12 @@ void Init_Sigils( void ) {
|
|||
if (!point->inuse)
|
||||
continue;
|
||||
|
||||
if (!strcmp(point->classname, "team_Domination_sigil")) {
|
||||
if (!Q_stricmp(point->classname, "team_domination_sigil")) {
|
||||
teamgame.sigil[sigilNum].entity = point;
|
||||
sigilNum++;
|
||||
}
|
||||
|
||||
if ( sigilNum == 2 )
|
||||
if ( sigilNum == 3 )
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -273,9 +275,11 @@ void Team_SetSigilStatus( int sigilNum, sigilStatus_t status ) {
|
|||
qboolean modified = qfalse;
|
||||
|
||||
// update only the sigil modified
|
||||
if( teamgame.sigil[sigilNum].status != status );
|
||||
teamgame.sigil[sigilNum].status = status;
|
||||
modified = qtrue;
|
||||
if( teamgame.sigil[sigilNum].status != status )
|
||||
{
|
||||
teamgame.sigil[sigilNum].status = status;
|
||||
modified = qtrue;
|
||||
}
|
||||
|
||||
|
||||
if( modified ) {
|
||||
|
@ -308,7 +312,10 @@ void ValidateSigilsInMap( gentity_t *ent )
|
|||
qboolean foundItem = qfalse, foundPreferredItem = qfalse;
|
||||
gitem_t *item;
|
||||
|
||||
// if 3rd sigil exists, this function doesn´t need to run
|
||||
if (!teamgame.sigil[0].entity || !teamgame.sigil[1].entity)
|
||||
return;
|
||||
|
||||
// if 3rd sigil exists, this function doesn't need to run
|
||||
if (teamgame.sigil[2].entity)
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in a new issue