]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
remove some easy gotos 707/head
authorMartin Taibr <taibr.martin@gmail.com>
Wed, 4 Sep 2019 17:25:48 +0000 (19:25 +0200)
committerMartin Taibr <taibr.martin@gmail.com>
Wed, 4 Sep 2019 17:25:48 +0000 (19:25 +0200)
qcsrc/server/ipban.qc
qcsrc/server/sv_main.qc

index 7c6fcbafef635c9aff2bddca7ab30ec8c23d45de..9d74477b4846525c3d84dc020a58340c75b2e11e 100644 (file)
@@ -202,12 +202,21 @@ void OnlineBanList_Think(entity this)
        float i, n;
 
        if(autocvar_g_ban_sync_uri == "")
-               goto killme;
+       {
+               delete(this);
+               return;
+       }
        if(autocvar_g_ban_sync_interval == 0) // < 0 is okay, it means "sync on level start only"
-               goto killme;
+       {
+               delete(this);
+               return;
+       }
        argc = tokenize_console(autocvar_g_ban_sync_trusted_servers);
        if(argc == 0)
-               goto killme;
+       {
+               delete(this);
+               return;
+       }
 
        string s = argv(0); for(i = 1; i < argc; ++i) s = strcat(s, ";", argv(i));
        strcpy(OnlineBanList_Servers, s);
@@ -231,14 +240,13 @@ void OnlineBanList_Think(entity this)
                        uri_get(strcat(argv(i), "?", uri), URI_GET_IPBAN + i); // 1000 = "banlist" callback target
        }
 
-       if(autocvar_g_ban_sync_interval > 0)
-               this.nextthink = time + max(60, autocvar_g_ban_sync_interval * 60);
-       else
-               goto killme;
-       return;
+       if(autocvar_g_ban_sync_interval <= 0)
+       {
+               delete(this);
+               return;
+       }
 
-LABEL(killme)
-       delete(this);
+       this.nextthink = time + max(60, autocvar_g_ban_sync_interval * 60);
 }
 
 const float BAN_MAX = 256;
index 6b5b19d79ec8a60d141da4248e547b8deaca1480..54c9744332d5033ccbd5518f4f79b29dca36606c 100644 (file)
@@ -324,14 +324,17 @@ void SV_OnEntityPreSpawnFunction(entity this)
        if (this.gametypefilter != "")
        if (!isGametypeInFilter(MapInfo_LoadedGametype, teamplay, have_team_spawns, this.gametypefilter))
        {
-               goto cleanup;
+               delete(this);
+               return;
        }
        if (this.cvarfilter != "" && !expr_evaluate(this.cvarfilter)) {
-        goto cleanup;
+               delete(this);
+               return;
        }
 
        if (DoesQ3ARemoveThisEntity(this)) {
-               goto cleanup;
+               delete(this);
+               return;
        }
 
        set_movetype(this, this.movetype);
@@ -356,11 +359,9 @@ void SV_OnEntityPreSpawnFunction(entity this)
     #undef X
 
        if (MUTATOR_CALLHOOK(OnEntityPreSpawn, this)) {
-               goto cleanup;
+               delete(this);
+               return;
        }
-       return;
-LABEL(cleanup)
-    delete(this);
 }
 
 void WarpZone_PostInitialize_Callback()