#include "race.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
#include "client.qh"
#include "portals.qh"
#include "scores.qh"
#include "../common/deathtypes/all.qh"
#include "../common/notifications/all.qh"
#include "../common/mapinfo.qh"
+#include <common/gamemodes/rules.qh>
#include <common/net_linked.qh>
#include <common/state.qh>
#include "../common/triggers/subs.qh"
float s;
if(g_race_qualifying)
{
- s = PlayerScore_Add(e, SP_RACE_FASTEST, 0);
+ s = GameRules_scoring_add(e, RACE_FASTEST, 0);
if(!s || t < s)
- PlayerScore_Add(e, SP_RACE_FASTEST, t - s);
+ GameRules_scoring_add(e, RACE_FASTEST, t - s);
}
else
{
- s = PlayerScore_Add(e, SP_RACE_FASTEST, 0);
+ s = GameRules_scoring_add(e, RACE_FASTEST, 0);
if(!s || t < s)
- PlayerScore_Add(e, SP_RACE_FASTEST, t - s);
+ GameRules_scoring_add(e, RACE_FASTEST, t - s);
- s = PlayerScore_Add(e, SP_RACE_TIME, 0);
+ s = GameRules_scoring_add(e, RACE_TIME, 0);
snew = TIME_ENCODE(time - game_starttime);
- PlayerScore_Add(e, SP_RACE_TIME, snew - s);
- l = PlayerTeamScore_Add(e, SP_RACE_LAPS, ST_RACE_LAPS, 1);
+ GameRules_scoring_add(e, RACE_TIME, snew - s);
+ l = GameRules_scoring_add_team(e, RACE_LAPS, 1);
if(autocvar_fraglimit)
if(l >= autocvar_fraglimit)
strunzone(race_checkpoint_recordholders[cp]);
race_checkpoint_recordholders[cp] = strzone(e.netname);
if(g_race_qualifying)
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.race_checkpoint == cp, LAMBDA(race_SendNextCheckpoint(it, 0)));
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.race_checkpoint == cp, { race_SendNextCheckpoint(it, 0); });
}
}
entity oth = race_checkpoint_lastplayers[cp];
if(oth)
{
- mylaps = PlayerScore_Add(e, SP_RACE_LAPS, 0);
+ mylaps = GameRules_scoring_add(e, RACE_LAPS, 0);
lother = race_checkpoint_lastlaps[cp];
othtime = race_checkpoint_lasttimes[cp];
}
g_race_qualifying = qual;
- IL_EACH(g_race_targets, true,
+ IL_EACH(g_race_targets, it.classname == "target_checkpoint" || it.classname == "target_startTimer" || it.classname == "target_stopTimer",
{
+ if(it.targetname == "" || !it.targetname) // somehow this is a case...
+ continue;
entity cpt = it;
FOREACH_ENTITY_STRING(target, cpt.targetname,
{
if (race_timed_checkpoint) {
if (defrag_ents) {
- IL_EACH(g_race_targets, true,
+ IL_EACH(g_race_targets, it.classname == "target_checkpoint" || it.classname == "target_startTimer" || it.classname == "target_stopTimer",
{
entity cpt = it;
if(it.classname == "target_startTimer" || it.classname == "target_stopTimer") {
+ if(it.targetname == "" || !it.targetname) // somehow this is a case...
+ continue;
FOREACH_ENTITY_STRING(target, cpt.targetname, {
- WaypointSprite_UpdateSprites(it.sprite, ((cpt.classname == "target_startTimer") ? WP_RaceStart : WP_RaceFinish), WP_Null, WP_Null);
+ if(it.sprite)
+ WaypointSprite_UpdateSprites(it.sprite, ((cpt.classname == "target_startTimer") ? WP_RaceStart : WP_RaceFinish), WP_Null, WP_Null);
});
}
if(it.classname == "target_checkpoint") {
void race_StartCompleting()
{
race_completing = 1;
- FOREACH_CLIENT(IS_PLAYER(it) && IS_DEAD(it), LAMBDA(race_AbandonRaceCheck(it)));
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_DEAD(it), { race_AbandonRaceCheck(it); });
}
void race_PreparePlayer(entity this)
race_checkpoint_recordholders[j] = string_null;
}
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
float p = it.race_place;
race_PreparePlayer(it);
it.race_place = p;
- ));
+ });
}
void race_ImposePenaltyTime(entity pl, float penalty, string reason)
// links on CP entities)
float l;
- l = PlayerScore_Add(e, SP_RACE_LAPS, 0);
+ l = GameRules_scoring_add(e, RACE_LAPS, 0);
if(CS(e).race_completed)
return l; // not fractional