if(IS_REAL_CLIENT(player))
{
- string rr = CTS_RECORD;
-
msg_entity = player;
race_send_recordtime(MSG_ONE);
race_send_speedaward(MSG_ONE);
- speedaward_alltimebest = stof(db_get(ServerProgsDB, strcat(GetMapname(), rr, "speed/speed")));
- speedaward_alltimebest_holder = uid2name(db_get(ServerProgsDB, strcat(GetMapname(), rr, "speed/crypto_idfp")));
+ speedaward_alltimebest = stof(db_get(ServerProgsDB, strcat(GetMapname(), record_type, "speed/speed")));
+ speedaward_alltimebest_holder = uid2name(db_get(ServerProgsDB, strcat(GetMapname(), record_type, "speed/crypto_idfp")));
race_send_speedaward_alltimebest(MSG_ONE);
float i;
}
if (speedaward_speed > speedaward_lastsent && (time - speedaward_lastupdate > 1 || intermission_running))
{
- string rr = CTS_RECORD;
race_send_speedaward(MSG_ALL);
speedaward_lastsent = speedaward_speed;
if (speedaward_speed > speedaward_alltimebest && speedaward_uid != "")
speedaward_alltimebest = speedaward_speed;
speedaward_alltimebest_holder = speedaward_holder;
speedaward_alltimebest_uid = speedaward_uid;
- db_put(ServerProgsDB, strcat(GetMapname(), rr, "speed/speed"), ftos(speedaward_alltimebest));
- db_put(ServerProgsDB, strcat(GetMapname(), rr, "speed/crypto_idfp"), speedaward_alltimebest_uid);
+ db_put(ServerProgsDB, strcat(GetMapname(), record_type, "speed/speed"), ftos(speedaward_alltimebest));
+ db_put(ServerProgsDB, strcat(GetMapname(), record_type, "speed/crypto_idfp"), speedaward_alltimebest_uid);
race_send_speedaward_alltimebest(MSG_ALL);
}
}
void cts_Initialize()
{
+ record_type = CTS_RECORD;
cts_ScoreRules();
}
race_PreparePlayer(player);
player.race_checkpoint = -1;
- string rr = RACE_RECORD;
-
if(IS_REAL_CLIENT(player))
{
msg_entity = player;
race_send_recordtime(MSG_ONE);
race_send_speedaward(MSG_ONE);
- speedaward_alltimebest = stof(db_get(ServerProgsDB, strcat(GetMapname(), rr, "speed/speed")));
- speedaward_alltimebest_holder = uid2name(db_get(ServerProgsDB, strcat(GetMapname(), rr, "speed/crypto_idfp")));
+ speedaward_alltimebest = stof(db_get(ServerProgsDB, strcat(GetMapname(), record_type, "speed/speed")));
+ speedaward_alltimebest_holder = uid2name(db_get(ServerProgsDB, strcat(GetMapname(), record_type, "speed/crypto_idfp")));
race_send_speedaward_alltimebest(MSG_ONE);
float i;
}
if (speedaward_speed > speedaward_lastsent && (time - speedaward_lastupdate > 1 || intermission_running))
{
- string rr = RACE_RECORD;
race_send_speedaward(MSG_ALL);
speedaward_lastsent = speedaward_speed;
if (speedaward_speed > speedaward_alltimebest && speedaward_uid != "")
speedaward_alltimebest = speedaward_speed;
speedaward_alltimebest_holder = speedaward_holder;
speedaward_alltimebest_uid = speedaward_uid;
- db_put(ServerProgsDB, strcat(GetMapname(), rr, "speed/speed"), ftos(speedaward_alltimebest));
- db_put(ServerProgsDB, strcat(GetMapname(), rr, "speed/crypto_idfp"), speedaward_alltimebest_uid);
+ db_put(ServerProgsDB, strcat(GetMapname(), record_type, "speed/speed"), ftos(speedaward_alltimebest));
+ db_put(ServerProgsDB, strcat(GetMapname(), record_type, "speed/crypto_idfp"), speedaward_alltimebest_uid);
race_send_speedaward_alltimebest(MSG_ALL);
}
}
float want_qualifying = ((qualifying_override >= 0) ? qualifying_override : autocvar_g_race_qualifying_timelimit) > 0;
+ record_type = RACE_RECORD;
+
if(autocvar_g_campaign)
{
g_race_qualifying = 1;
float race_readTime(string map, float pos)
{
- string rr = ((g_cts) ? CTS_RECORD : ((g_ctf) ? CTF_RECORD : RACE_RECORD));
-
- return stof(db_get(ServerProgsDB, strcat(map, rr, "time", ftos(pos))));
+ return stof(db_get(ServerProgsDB, strcat(map, record_type, "time", ftos(pos))));
}
string race_readUID(string map, float pos)
{
- string rr = ((g_cts) ? CTS_RECORD : ((g_ctf) ? CTF_RECORD : RACE_RECORD));
-
- return db_get(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(pos)));
+ return db_get(ServerProgsDB, strcat(map, record_type, "crypto_idfp", ftos(pos)));
}
float race_readPos(string map, float t)
void race_writeTime(string map, float t, string myuid)
{
- string rr = ((g_cts) ? CTS_RECORD : ((g_ctf) ? CTF_RECORD : RACE_RECORD));
-
float newpos;
newpos = race_readPos(map, t);
// player improved his existing record, only have to iterate on ranks between new and old recs
for (i = prevpos; i > newpos; --i)
{
- db_put(ServerProgsDB, strcat(map, rr, "time", ftos(i)), ftos(race_readTime(map, i - 1)));
- db_put(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(i)), race_readUID(map, i - 1));
+ db_put(ServerProgsDB, strcat(map, record_type, "time", ftos(i)), ftos(race_readTime(map, i - 1)));
+ db_put(ServerProgsDB, strcat(map, record_type, "crypto_idfp", ftos(i)), race_readUID(map, i - 1));
}
}
else
{
float other_time = race_readTime(map, i - 1);
if (other_time) {
- db_put(ServerProgsDB, strcat(map, rr, "time", ftos(i)), ftos(other_time));
- db_put(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(i)), race_readUID(map, i - 1));
+ db_put(ServerProgsDB, strcat(map, record_type, "time", ftos(i)), ftos(other_time));
+ db_put(ServerProgsDB, strcat(map, record_type, "crypto_idfp", ftos(i)), race_readUID(map, i - 1));
}
}
}
// store new time itself
- db_put(ServerProgsDB, strcat(map, rr, "time", ftos(newpos)), ftos(t));
- db_put(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(newpos)), myuid);
+ db_put(ServerProgsDB, strcat(map, record_type, "time", ftos(newpos)), ftos(t));
+ db_put(ServerProgsDB, strcat(map, record_type, "crypto_idfp", ftos(newpos)), myuid);
}
string race_readName(string map, float pos)
{
- string rr = ((g_cts) ? CTS_RECORD : ((g_ctf) ? CTF_RECORD : RACE_RECORD));
-
- return uid2name(db_get(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(pos))));
+ return uid2name(db_get(ServerProgsDB, strcat(map, record_type, "crypto_idfp", ftos(pos))));
}
void race_checkAndWriteName(entity player)
void race_deleteTime(string map, float pos)
{
- string rr = ((g_cts) ? CTS_RECORD : ((g_ctf) ? CTF_RECORD : RACE_RECORD));
-
for(int i = pos; i <= RANKINGS_CNT; ++i)
{
string therank = ftos(i);
if (i == RANKINGS_CNT)
{
- db_remove(ServerProgsDB, strcat(map, rr, "time", therank));
- db_remove(ServerProgsDB, strcat(map, rr, "crypto_idfp", therank));
+ db_remove(ServerProgsDB, strcat(map, record_type, "time", therank));
+ db_remove(ServerProgsDB, strcat(map, record_type, "crypto_idfp", therank));
}
else
{
- db_put(ServerProgsDB, strcat(map, rr, "time", therank), ftos(race_readTime(GetMapname(), i+1)));
- db_put(ServerProgsDB, strcat(map, rr, "crypto_idfp", therank), race_readUID(GetMapname(), i+1));
+ db_put(ServerProgsDB, strcat(map, record_type, "time", therank), ftos(race_readTime(GetMapname(), i+1)));
+ db_put(ServerProgsDB, strcat(map, record_type, "crypto_idfp", therank), race_readUID(GetMapname(), i+1));
}
}