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 7c6fcba..9d74477 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 6b5b19d..54c9744 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()