X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fscores.qc;h=aa108dd985d9622e167a3db2649d08fec0dfc0d4;hp=efefcd17aaa26cf16897100a0123270dba7eba42;hb=b9671f63469586007314131f3f53728795c035cd;hpb=490a31934aa67cc7de5299a4d3f625d5271f8583 diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index efefcd17a..aa108dd98 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -328,13 +328,13 @@ void PlayerScore_Detach(entity player) if(!player.scorekeeper) error("player has no scorekeeper"); remove(player.scorekeeper); - player.scorekeeper = world; + player.scorekeeper = NULL; } float PlayerScore_Add(entity player, float scorefield, float score) { - bool mutator_returnvalue = MUTATOR_CALLHOOK(AddPlayerScore, scorefield, score); - score = ret_float; + bool mutator_returnvalue = MUTATOR_CALLHOOK(AddPlayerScore, scorefield, score, player); + score = M_ARGV(1, float); if(gameover) if(!mutator_returnvalue) @@ -385,9 +385,8 @@ float PlayerScore_Compare(entity t1, entity t2, float strict) return result.x; } -void WinningConditionHelper() +void WinningConditionHelper(entity this) { - SELFPARAM(); float c; string s; float fullstatus; @@ -406,10 +405,10 @@ void WinningConditionHelper() s = GetGametype(); s = strcat(s, ":", autocvar_g_xonoticversion); s = strcat(s, ":P", ftos(cvar_purechanges_count)); - s = strcat(s, ":S", ftos(nJoinAllowed(this, world))); // note: self/this is most likely world in this case + s = strcat(s, ":S", ftos(nJoinAllowed(this, NULL))); s = strcat(s, ":F", ftos(serverflags)); s = strcat(s, ":M", modname); - s = strcat(s, "::", GetPlayerScoreString(world, (fullstatus ? 1 : 2))); + s = strcat(s, "::", GetPlayerScoreString(NULL, (fullstatus ? 1 : 2))); if(teamscores_entities_count) { @@ -422,8 +421,8 @@ void WinningConditionHelper() WinningConditionHelper_winnerteam = -1; WinningConditionHelper_secondteam = -1; - winnerscorekeeper = world; - secondscorekeeper = world; + winnerscorekeeper = NULL; + secondscorekeeper = NULL; for(t = 0; t < 16; ++t) { sk = teamscorekeepers[t]; @@ -455,15 +454,15 @@ void WinningConditionHelper() WinningConditionHelper_lowerisbetter = (teamscores_flags_primary & SFL_LOWER_IS_BETTER); WinningConditionHelper_zeroisworst = (teamscores_flags_primary & SFL_ZERO_IS_WORST); - WinningConditionHelper_winner = world; // not supported in teamplay - WinningConditionHelper_second = world; // not supported in teamplay + WinningConditionHelper_winner = NULL; // not supported in teamplay + WinningConditionHelper_second = NULL; // not supported in teamplay } else { - WinningConditionHelper_winner = world; - WinningConditionHelper_second = world; - winnerscorekeeper = world; - secondscorekeeper = world; + WinningConditionHelper_winner = NULL; + WinningConditionHelper_second = NULL; + winnerscorekeeper = NULL; + secondscorekeeper = NULL; FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( sk = it.scorekeeper; c = PlayerScore_Compare(winnerscorekeeper, sk, 1); @@ -487,7 +486,7 @@ void WinningConditionHelper() WinningConditionHelper_equality = (PlayerScore_Compare(winnerscorekeeper, secondscorekeeper, 0) == 0); if(WinningConditionHelper_equality) - WinningConditionHelper_winner = WinningConditionHelper_second = world; + WinningConditionHelper_winner = WinningConditionHelper_second = NULL; WinningConditionHelper_topscore = winnerscorekeeper.scores_primary; WinningConditionHelper_secondscore = secondscorekeeper.scores_primary; @@ -531,19 +530,15 @@ void WinningConditionHelper() { s = GetPlayerScoreString(it, 1); s = strcat(s, IS_REAL_CLIENT(it) ? ":human" : ":bot"); - ret_string = string_null; - if(!IS_PLAYER(it) && !MUTATOR_CALLHOOK(GetPlayerStatus, it, s)) + if(!IS_PLAYER(it) && !MUTATOR_CALLHOOK(GetPlayerStatus, it)) s = strcat(s, ":spectator"); - if (ret_string) s = strcat(s, ret_string); } else { - ret_string = string_null; - if (IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it, s)) + if (IS_PLAYER(it) || MUTATOR_CALLHOOK(GetPlayerStatus, it)) s = GetPlayerScoreString(it, 2); else s = "-666"; - if (ret_string) s = strcat(s, ret_string); } if(it.clientstatus) @@ -700,7 +695,7 @@ entity PlayerScore_Sort(.float field, float teams, float strict, float nospectat entity p, plist, pprev, pbest, pbestprev, pfirst, plast; float i, j; - plist = world; + plist = NULL; FOREACH_CLIENT(true, LAMBDA(it.(field) = 0)); @@ -715,12 +710,12 @@ entity PlayerScore_Sort(.float field, float teams, float strict, float nospectat }); // Now plist points to the whole list. - pfirst = plast = world; + pfirst = plast = NULL; i = j = 0; while(plist) { - pprev = pbestprev = world; + pprev = pbestprev = NULL; pbest = plist; for(p = plist; (pprev = p), (p = p.chain); ) { @@ -732,11 +727,11 @@ entity PlayerScore_Sort(.float field, float teams, float strict, float nospectat } // remove pbest out of the chain - if(pbestprev == world) + if(pbestprev == NULL) plist = pbest.chain; else pbestprev.chain = pbest.chain; - pbest.chain = world; + pbest.chain = NULL; ++i; if(!plast || PlayerTeamScore_Compare(plast, pbest, teams, 0))