// See common.qc for their proper commands
-string getrecords(float page) // 50 records per page
+string getrecords(int page) // 50 records per page
{
- float rec = 0, r, i;
- string h, s;
+ string s = "";
- s = "";
-
- if (g_ctf)
- {
- for (i = page * 200; i < MapInfo_count && i < page * 200 + 200; ++i)
- {
- if (MapInfo_Get_ByID(i))
- {
- r = stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, "/captimerecord/time")));
-
- if (!r)
- continue;
-
- // TODO: uid2name
- h = db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, "/captimerecord/netname"));
- s = strcat(s, strpad(32, MapInfo_Map_bspname), " ", strpad(-6, ftos_decimals(r, 2)), " ", h, "\n");
- ++rec;
- }
- }
- }
-
- if (g_race)
- {
- for (i = page * 200; i < MapInfo_count && i < page * 200 + 200; ++i)
- {
- if (MapInfo_Get_ByID(i))
- {
- r = race_readTime(MapInfo_Map_bspname, 1);
-
- if (!r)
- continue;
-
- h = race_readName(MapInfo_Map_bspname, 1);
- s = strcat(s, strpad(32, MapInfo_Map_bspname), " ", strpad(-8, TIME_ENCODED_TOSTRING(r)), " ", h, "\n");
- ++rec;
- }
- }
- }
-
- if (g_cts)
- {
- for (i = page * 200; i < MapInfo_count && i < page * 200 + 200; ++i)
- {
- if (MapInfo_Get_ByID(i))
- {
- r = race_readTime(MapInfo_Map_bspname, 1);
-
- if (!r)
- continue;
-
- h = race_readName(MapInfo_Map_bspname, 1);
- s = strcat(s, strpad(32, MapInfo_Map_bspname), " ", strpad(-8, TIME_ENCODED_TOSTRING(r)), " ", h, "\n");
- ++rec;
- }
- }
- }
+ MUTATOR_CALLHOOK(GetRecords, page, s);
+ s = ret_string;
MapInfo_ClearTemps();
/** player */ i(entity, other) \
/**/
MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch);
+
+#define EV_GetRecords(i, o) \
+ /**/ i(int, record_page) \
+ /**/ i(string, ret_string) \
+ /**/ o(string, ret_string) \
+ /**/
+int record_page;
+MUTATOR_HOOKABLE(GetRecords, EV_GetRecords);
#endif
return false;
}
+MUTATOR_HOOKFUNCTION(ctf, GetRecords)
+{
+ for(int i = record_page * 200; i < MapInfo_count && i < record_page * 200 + 200; ++i)
+ {
+ if (MapInfo_Get_ByID(i))
+ {
+ float r = stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, "/captimerecord/time")));
+
+ if(!r)
+ continue;
+
+ // TODO: uid2name
+ string h = db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, "/captimerecord/netname"));
+ ret_string = strcat(ret_string, strpad(32, MapInfo_Map_bspname), " ", strpad(-6, ftos_decimals(r, 2)), " ", h, "\n");
+ }
+ }
+
+ return false;
+}
+
// ==========
// Spawnfuncs
InitializeEntity(world, ctf_DelayedInit, INITPRIO_GAMETYPE);
}
-
REGISTER_MUTATOR(ctf, g_ctf)
{
ActivateTeamplay();
return false;
}
+MUTATOR_HOOKFUNCTION(cts, GetRecords)
+{
+ for(int i = record_page * 200; i < MapInfo_count && i < record_page * 200 + 200; ++i)
+ {
+ if(MapInfo_Get_ByID(i))
+ {
+ float r = race_readTime(MapInfo_Map_bspname, 1);
+
+ if(!r)
+ continue;
+
+ string h = race_readName(MapInfo_Map_bspname, 1);
+ ret_string = strcat(ret_string, strpad(32, MapInfo_Map_bspname), " ", strpad(-8, TIME_ENCODED_TOSTRING(r)), " ", h, "\n");
+ }
+ }
+
+ return false;
+}
+
void cts_Initialize()
{
cts_ScoreRules();
return false;
}
+MUTATOR_HOOKFUNCTION(rc, GetRecords)
+{
+ for(int i = record_page * 200; i < MapInfo_count && i < record_page * 200 + 200; ++i)
+ {
+ if(MapInfo_Get_ByID(i))
+ {
+ float r = race_readTime(MapInfo_Map_bspname, 1);
+
+ if(!r)
+ continue;
+
+ string h = race_readName(MapInfo_Map_bspname, 1);
+ ret_string = strcat(ret_string, strpad(32, MapInfo_Map_bspname), " ", strpad(-8, TIME_ENCODED_TOSTRING(r)), " ", h, "\n");
+ }
+ }
+
+ return false;
+}
+
void race_Initialize()
{
race_ScoreRules();