void VotePassed () { if (!NextMap) BeginIntermission (CreateTargetChangeLevel(Map.CString())); else Level.NextMap = Map; }
/* ================= EndDMLevel The timelimit or fraglimit has been exceeded ================= */ void EndDMLevel (void) { edict_t *ent; char *s, *t, *f; static const char *seps = " ,\n\r"; // stay on same level flag if ((int)dmflags->value & DF_SAME_LEVEL) { BeginIntermission (CreateTargetChangeLevel (level.mapname) ); return; } if (*level.forcemap) { BeginIntermission (CreateTargetChangeLevel (level.forcemap) ); return; } // see if it's in the map list if (*sv_maplist->string) { s = strdup(sv_maplist->string); f = NULL; t = strtok(s, seps); while (t != NULL) { if (Q_stricmp(t, level.mapname) == 0) { // it's in the list, go to the next one t = strtok(NULL, seps); if (t == NULL) { // end of list, go to first one if (f == NULL) // there isn't a first one, same level BeginIntermission (CreateTargetChangeLevel (level.mapname) ); else BeginIntermission (CreateTargetChangeLevel (f) ); } else BeginIntermission (CreateTargetChangeLevel (t) ); free(s); return; } if (!f) f = t; t = strtok(NULL, seps); } free(s); } if (level.nextmap[0]) // go to a specific map BeginIntermission (CreateTargetChangeLevel (level.nextmap) ); else { // search for a changelevel ent = G_Find (NULL, FOFS(classname), "target_changelevel"); if (!ent) { // the map designer didn't include a changelevel, // so create a fake ent that goes back to the same level BeginIntermission (CreateTargetChangeLevel (level.mapname) ); return; } BeginIntermission (ent); } }
/* * G_ChooseNextMap */ static edict_t *G_ChooseNextMap( void ) { edict_t *ent = NULL; const char *next; if( *level.forcemap ) { return CreateTargetChangeLevel( level.forcemap ); } if( !( *g_maplist->string ) || g_maplist->string[0] == '\0' || g_maprotation->integer == 0 ) { // same map again return CreateTargetChangeLevel( level.mapname ); } else if( g_maprotation->integer == 1 ) { next = G_MapRotationNormal(); // not in the list, we go for the first one ent = CreateTargetChangeLevel( next ? next : level.mapname ); return ent; } else if( g_maprotation->integer == 2 ) { next = G_MapRotationRandom(); ent = CreateTargetChangeLevel( next ? next : level.mapname ); return ent; } if( level.nextmap[0] ) // go to a specific map return CreateTargetChangeLevel( level.nextmap ); // search for a changelevel ent = G_Find( NULL, FOFS( classname ), "target_changelevel" ); if( !ent ) { // the map designer didn't include a changelevel, // so create a fake ent that goes back to the same level return CreateTargetChangeLevel( level.mapname ); } return ent; }
/* ================= EndDMLevel The timelimit or fraglimit has been exceeded ================= */ void EndDMLevel () { char *s, *t, *f; static const char *seps = " ,\n\r"; // stay on same level flag if (DeathmatchFlags.dfSameLevel.IsEnabled()) { BeginIntermission (CreateTargetChangeLevel (Level.ServerLevelName.CString())); return; } if (!Level.ForceMap.IsNullOrEmpty()) { BeginIntermission (CreateTargetChangeLevel (Level.ForceMap.CString())); return; } // see if it's in the map list if (*CvarList[CV_MAPLIST].StringValue()) { s = Mem_StrDup(CvarList[CV_MAPLIST].StringValue()); f = NULL; t = strtok(s, seps); while (t != NULL) { if (Q_stricmp(t, Level.ServerLevelName.CString()) == 0) { // it's in the list, go to the next one t = strtok(NULL, seps); if (t == NULL) { // end of list, go to first one if (f == NULL) // there isn't a first one, same level BeginIntermission (CreateTargetChangeLevel (Level.ServerLevelName.CString()) ); else BeginIntermission (CreateTargetChangeLevel (f) ); } else BeginIntermission (CreateTargetChangeLevel (t) ); QDelete s; return; } if (!f) f = t; t = strtok(NULL, seps); } free(s); } if (!Level.NextMap.IsNullOrEmpty()) // go to a specific map BeginIntermission (CreateTargetChangeLevel (Level.NextMap.CString()) ); else { // search for a changelevel CTargetChangeLevel *Entity = CC_FindByClassName<CTargetChangeLevel, EF_BASE> (NULL, "target_changelevel"); if (!Entity) { // the map designer didn't include a changelevel, // so create a fake ent that goes back to the same level BeginIntermission (CreateTargetChangeLevel (Level.ServerLevelName.CString()) ); return; } BeginIntermission (Entity); } }
/* * The timelimit or fraglimit has been exceeded */ void EndDMLevel(void) { edict_t *ent; char *s, *t, *f; static const char *seps = " ,\n\r"; /* stay on same level flag */ if ((int) dmflags->value & DF_SAME_LEVEL) { BeginIntermission(CreateTargetChangeLevel(level.mapname)); return; } /* see if it's in the map list */ if (*sv_maplist->string) { s = strdup(sv_maplist->string); f = NULL; t = strtok(s, seps); while (t != NULL) { if (Q_stricmp(t, level.mapname) == 0) { /* it's in the list, go to the next one */ t = strtok(NULL, seps); if (t == NULL) /* end of list, go to first one */ { if (f == NULL) /* there isn't a first one, same level */ { BeginIntermission(CreateTargetChangeLevel(level.mapname)); } else { BeginIntermission(CreateTargetChangeLevel(f)); } } else { BeginIntermission(CreateTargetChangeLevel(t)); } free(s); return; } if (!f) { f = t; } t = strtok(NULL, seps); } free(s); } if (level.nextmap[0]) { BeginIntermission(CreateTargetChangeLevel(level.nextmap)); } else { ent = G_Find(NULL, FOFS(classname), "target_changelevel"); if (!ent) { BeginIntermission(CreateTargetChangeLevel(level.mapname)); return; } BeginIntermission(ent); } }