]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_world.qc
Merge branch 'TimePath/logging' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_world.qc
index 05c508c4c1ac702a6ed7f18ce44d3d7384c433b9..de4492ac982a8cef11b17edd77e03e3cd990c4ba 100644 (file)
@@ -146,7 +146,7 @@ void GotoFirstMap()
        else
        {
                self.nextthink = time + 1;
        else
        {
                self.nextthink = time + 1;
-               print("Waiting for _sv_init being set to 1 by initialization scripts...\n");
+               LOG_INFO("Waiting for _sv_init being set to 1 by initialization scripts...\n");
        }
 }
 
        }
 }
 
@@ -503,7 +503,7 @@ void detect_maptype()
                        tracebox(o, '-1 -1 -1' * i, '1 1 1' * i, o - '0 0 32768', MOVE_WORLDONLY, world);
        if(trace_fraction == 1)
                continue;
                        tracebox(o, '-1 -1 -1' * i, '1 1 1' * i, o - '0 0 32768', MOVE_WORLDONLY, world);
        if(trace_fraction == 1)
                continue;
-                       print(ftos(i), " -> ", vtos(trace_endpos), "\n");
+                       LOG_INFO(ftos(i), " -> ", vtos(trace_endpos), "\n");
                }
 
                break;
                }
 
                break;
@@ -757,23 +757,23 @@ void spawnfunc_worldspawn (void)
                                        continue;
                                if(argv(0) == "cd")
                                {
                                        continue;
                                if(argv(0) == "cd")
                                {
-                                       print("Found ^1UNSUPPORTED^7 cd loop command in .cfg file; put this line in mapinfo instead:\n");
-                                       print("  cdtrack ", argv(2), "\n");
+                                       LOG_INFO("Found ^1UNSUPPORTED^7 cd loop command in .cfg file; put this line in mapinfo instead:\n");
+                                       LOG_INFO("  cdtrack ", argv(2), "\n");
                                }
                                else if(argv(0) == "fog")
                                {
                                }
                                else if(argv(0) == "fog")
                                {
-                                       print("Found ^1UNSUPPORTED^7 fog command in .cfg file; put this line in worldspawn in the .map/.bsp/.ent file instead:\n");
-                                       print("  \"fog\" \"", s, "\"\n");
+                                       LOG_INFO("Found ^1UNSUPPORTED^7 fog command in .cfg file; put this line in worldspawn in the .map/.bsp/.ent file instead:\n");
+                                       LOG_INFO("  \"fog\" \"", s, "\"\n");
                                }
                                else if(argv(0) == "set")
                                {
                                }
                                else if(argv(0) == "set")
                                {
-                                       print("Found ^1UNSUPPORTED^7 set command in .cfg file; put this line in mapinfo instead:\n");
-                                       print("  clientsettemp_for_type all ", argv(1), " ", argv(2), "\n");
+                                       LOG_INFO("Found ^1UNSUPPORTED^7 set command in .cfg file; put this line in mapinfo instead:\n");
+                                       LOG_INFO("  clientsettemp_for_type all ", argv(1), " ", argv(2), "\n");
                                }
                                else if(argv(0) != "//")
                                {
                                }
                                else if(argv(0) != "//")
                                {
-                                       print("Found ^1UNSUPPORTED^7 set command in .cfg file; put this line in mapinfo instead:\n");
-                                       print("  clientsettemp_for_type all ", argv(0), " ", argv(1), "\n");
+                                       LOG_INFO("Found ^1UNSUPPORTED^7 set command in .cfg file; put this line in mapinfo instead:\n");
+                                       LOG_INFO("  clientsettemp_for_type all ", argv(0), " ", argv(1), "\n");
                                }
                        }
                        fclose(fd);
                                }
                        }
                        fclose(fd);
@@ -974,39 +974,39 @@ float MapHasRightSize(string map)
        if(currentbots || autocvar_bot_number || player_count < autocvar_minplayers)
        if(autocvar_g_maplist_check_waypoints)
        {
        if(currentbots || autocvar_bot_number || player_count < autocvar_minplayers)
        if(autocvar_g_maplist_check_waypoints)
        {
-               dprint("checkwp "); dprint(map);
+               LOG_TRACE("checkwp "); LOG_TRACE(map);
                if(!fexists(strcat("maps/", map, ".waypoints")))
                {
                if(!fexists(strcat("maps/", map, ".waypoints")))
                {
-                       dprint(": no waypoints\n");
+                       LOG_TRACE(": no waypoints\n");
                        return false;
                }
                        return false;
                }
-               dprint(": has waypoints\n");
+               LOG_TRACE(": has waypoints\n");
        }
 
        // open map size restriction file
        }
 
        // open map size restriction file
-       dprint("opensize "); dprint(map);
+       LOG_TRACE("opensize "); LOG_TRACE(map);
        fh = fopen(strcat("maps/", map, ".sizes"), FILE_READ);
        if(fh >= 0)
        {
                float mapmin, mapmax;
        fh = fopen(strcat("maps/", map, ".sizes"), FILE_READ);
        if(fh >= 0)
        {
                float mapmin, mapmax;
-               dprint(": ok, ");
+               LOG_TRACE(": ok, ");
                mapmin = stof(fgets(fh));
                mapmax = stof(fgets(fh));
                fclose(fh);
                if(player_count < mapmin)
                {
                mapmin = stof(fgets(fh));
                mapmax = stof(fgets(fh));
                fclose(fh);
                if(player_count < mapmin)
                {
-                       dprint("not enough\n");
+                       LOG_TRACE("not enough\n");
                        return false;
                }
                if(player_count > mapmax)
                {
                        return false;
                }
                if(player_count > mapmax)
                {
-                       dprint("too many\n");
+                       LOG_TRACE("too many\n");
                        return false;
                }
                        return false;
                }
-               dprint("right size\n");
+               LOG_TRACE("right size\n");
                return true;
        }
                return true;
        }
-       dprint(": not found\n");
+       LOG_TRACE(": not found\n");
        return true;
 }
 
        return true;
 }
 
@@ -1061,7 +1061,7 @@ float Map_Check(float position, float pass)
                return 0;
        }
        else
                return 0;
        }
        else
-               dprint( "Couldn't select '", filename, "'..\n" );
+               LOG_TRACE( "Couldn't select '", filename, "'..\n" );
 
        return 0;
 }
 
        return 0;
 }
@@ -1094,7 +1094,7 @@ float() MaplistMethod_Iterate = // usual method
 {
        float pass, i;
 
 {
        float pass, i;
 
-       dprint("Trying MaplistMethod_Iterate\n");
+       LOG_TRACE("Trying MaplistMethod_Iterate\n");
 
        for(pass = 1; pass <= 2; ++pass)
        {
 
        for(pass = 1; pass <= 2; ++pass)
        {
@@ -1111,7 +1111,7 @@ float() MaplistMethod_Iterate = // usual method
 
 float() MaplistMethod_Repeat = // fallback method
 {
 
 float() MaplistMethod_Repeat = // fallback method
 {
-       dprint("Trying MaplistMethod_Repeat\n");
+       LOG_TRACE("Trying MaplistMethod_Repeat\n");
 
        if(Map_Check(Map_Current, 2))
                return Map_Current;
 
        if(Map_Check(Map_Current, 2))
                return Map_Current;
@@ -1122,7 +1122,7 @@ float() MaplistMethod_Random = // random map selection
 {
        float i, imax;
 
 {
        float i, imax;
 
-       dprint("Trying MaplistMethod_Random\n");
+       LOG_TRACE("Trying MaplistMethod_Random\n");
 
        imax = 42;
 
 
        imax = 42;
 
@@ -1142,7 +1142,7 @@ float(float exponent) MaplistMethod_Shuffle = // more clever shuffling
 {
        float i, j, imax, insertpos;
 
 {
        float i, j, imax, insertpos;
 
-       dprint("Trying MaplistMethod_Shuffle\n");
+       LOG_TRACE("Trying MaplistMethod_Shuffle\n");
 
        imax = 42;
 
 
        imax = 42;
 
@@ -1154,7 +1154,7 @@ float(float exponent) MaplistMethod_Shuffle = // more clever shuffling
                insertpos = pow(random(), 1 / exponent);       // ]0, 1]
                insertpos = insertpos * (Map_Count - 1);       // ]0, Map_Count - 1]
                insertpos = ceil(insertpos) + 1;               // {2, 3, 4, ..., Map_Count}
                insertpos = pow(random(), 1 / exponent);       // ]0, 1]
                insertpos = insertpos * (Map_Count - 1);       // ]0, Map_Count - 1]
                insertpos = ceil(insertpos) + 1;               // {2, 3, 4, ..., Map_Count}
-               dprint("SHUFFLE: insert pos = ", ftos(insertpos), "\n");
+               LOG_TRACE("SHUFFLE: insert pos = ", ftos(insertpos), "\n");
 
                // insert the current map there
                newlist = "";
 
                // insert the current map there
                newlist = "";
@@ -1430,7 +1430,7 @@ void DumpStats(float final)
        s = strcat(s, GetGametype(), "_", GetMapname(), ":", ftos(rint(time)));
 
        if(to_console)
        s = strcat(s, GetGametype(), "_", GetMapname(), ":", ftos(rint(time)));
 
        if(to_console)
-               print(s, "\n");
+               LOG_INFO(s, "\n");
        if(to_eventlog)
                GameLogEcho(s);
 
        if(to_eventlog)
                GameLogEcho(s);
 
@@ -1446,7 +1446,7 @@ void DumpStats(float final)
 
        s = strcat(":labels:player:", GetPlayerScoreString(world, 0));
        if(to_console)
 
        s = strcat(":labels:player:", GetPlayerScoreString(world, 0));
        if(to_console)
-               print(s, "\n");
+               LOG_INFO(s, "\n");
        if(to_eventlog)
                GameLogEcho(s);
        if(to_file)
        if(to_eventlog)
                GameLogEcho(s);
        if(to_file)
@@ -1464,7 +1464,7 @@ void DumpStats(float final)
                                s = strcat(s, "spectator:");
 
                        if(to_console)
                                s = strcat(s, "spectator:");
 
                        if(to_console)
-                               print(s, other.netname, "\n");
+                               LOG_INFO(s, other.netname, "\n");
                        if(to_eventlog)
                                GameLogEcho(strcat(s, ftos(other.playerid), ":", other.netname));
                        if(to_file)
                        if(to_eventlog)
                                GameLogEcho(strcat(s, ftos(other.playerid), ":", other.netname));
                        if(to_file)
@@ -1476,7 +1476,7 @@ void DumpStats(float final)
        {
                s = strcat(":labels:teamscores:", GetTeamScoreString(0, 0));
                if(to_console)
        {
                s = strcat(":labels:teamscores:", GetTeamScoreString(0, 0));
                if(to_console)
-                       print(s, "\n");
+                       LOG_INFO(s, "\n");
                if(to_eventlog)
                        GameLogEcho(s);
                if(to_file)
                if(to_eventlog)
                        GameLogEcho(s);
                if(to_file)
@@ -1487,7 +1487,7 @@ void DumpStats(float final)
                        s = strcat(":teamscores:see-labels:", GetTeamScoreString(i, 0));
                        s = strcat(s, ":", ftos(i));
                        if(to_console)
                        s = strcat(":teamscores:see-labels:", GetTeamScoreString(i, 0));
                        s = strcat(s, ":", ftos(i));
                        if(to_console)
-                               print(s, "\n");
+                               LOG_INFO(s, "\n");
                        if(to_eventlog)
                                GameLogEcho(s);
                        if(to_file)
                        if(to_eventlog)
                                GameLogEcho(s);
                        if(to_file)
@@ -1496,7 +1496,7 @@ void DumpStats(float final)
        }
 
        if(to_console)
        }
 
        if(to_console)
-               print(":end\n");
+               LOG_INFO(":end\n");
        if(to_eventlog)
                GameLogEcho(":end");
        if(to_file)
        if(to_eventlog)
                GameLogEcho(":end");
        if(to_file)
@@ -1801,7 +1801,7 @@ float WinningCondition_LMS()
                {
                        // SNAFU (maybe a draw game?)
                        ClearWinners();
                {
                        // SNAFU (maybe a draw game?)
                        ClearWinners();
-                       dprint("No players, ending game.\n");
+                       LOG_TRACE("No players, ending game.\n");
                        return WINNING_YES;
                }
        }
                        return WINNING_YES;
                }
        }
@@ -2268,7 +2268,7 @@ float RedirectionThink()
        FOR_EACH_REALCLIENT(self)
        {
                // TODO add timer
        FOR_EACH_REALCLIENT(self)
        {
                // TODO add timer
-               print("Redirecting: sending connect command to ", self.netname, "\n");
+               LOG_INFO("Redirecting: sending connect command to ", self.netname, "\n");
                if(redirection_target == "self")
                        stuffcmd(self, "\ndisconnect; defer ", ftos(autocvar_quit_and_redirect_timer), " reconnect\n");
                else
                if(redirection_target == "self")
                        stuffcmd(self, "\ndisconnect; defer ", ftos(autocvar_quit_and_redirect_timer), " reconnect\n");
                else
@@ -2276,7 +2276,7 @@ float RedirectionThink()
                ++clients_found;
        }
 
                ++clients_found;
        }
 
-       print("Redirecting: ", ftos(clients_found), " clients left.\n");
+       LOG_INFO("Redirecting: ", ftos(clients_found), " clients left.\n");
 
        if(time > redirection_timeout || clients_found == 0)
                localcmd("\nwait; wait; wait; quit\n");
 
        if(time > redirection_timeout || clients_found == 0)
                localcmd("\nwait; wait; wait; quit\n");
@@ -2309,7 +2309,7 @@ void Shutdown()
        if(world_initialized > 0)
        {
                world_initialized = 0;
        if(world_initialized > 0)
        {
                world_initialized = 0;
-               print("Saving persistent data...\n");
+               LOG_INFO("Saving persistent data...\n");
                Ban_SaveBans();
 
                // playerstats with unfinished match
                Ban_SaveBans();
 
                // playerstats with unfinished match
@@ -2332,7 +2332,7 @@ void Shutdown()
                CheatShutdown(); // must be after cheatcount check
                db_close(ServerProgsDB);
                db_close(TemporaryDB);
                CheatShutdown(); // must be after cheatcount check
                db_close(ServerProgsDB);
                db_close(TemporaryDB);
-               print("done!\n");
+               LOG_INFO("done!\n");
                // tell the bot system the game is ending now
                bot_endgame();
 
                // tell the bot system the game is ending now
                bot_endgame();
 
@@ -2341,6 +2341,6 @@ void Shutdown()
        }
        else if(world_initialized == 0)
        {
        }
        else if(world_initialized == 0)
        {
-               print("NOTE: crashed before even initializing the world, not saving persistent data\n");
+               LOG_INFO("NOTE: crashed before even initializing the world, not saving persistent data\n");
        }
 }
        }
 }