Replaced hardcoded numbers with their defined aliases

This commit is contained in:
2017-04-23 09:55:07 -07:00
parent 958ac80727
commit 3827d5fa22

View File

@ -1,7 +1,7 @@
dbquery.c / dbquery.h dbquery.c / dbquery.h
Retrieve information from the database displays it. Retrieve information from the database & displays it.
Overview Overview
@ -67,8 +67,8 @@ Sorted by caller to callee.
The fields are hardcoded from the sql query files. The fields are hardcoded from the sql query files.
mranks.sql - (*c = QOVERVIEW) mranks.sql - (*c = QOVERVIEW)
select mapid, max(trank), min(tvalue), alias select mapid, max(trank), min(tvalue), alias
i = 0 1 2 3 i = 0 1 2 3
rplayers.sql - (*c = QRPLAYER) rplayers.sql - (*c = QRPLAYER)
select alias, mapid, idrank select alias, mapid, idrank
@ -78,13 +78,13 @@ Sorted by caller to callee.
select trank, alias, tvalue select trank, alias, tvalue
i = 0 1 2 i = 0 1 2
if ((*c == 'm' && i == 1) || (*c == '\0' && i == 3) || (*c == 'p' && i == 0)) if ((*c == QMLEADERBOARD && i == 1) || (*c == QOVERVIEW && i == 3) || (*c == QRPLAYER && i == 0))
If the field is for map leaderboards and column 1, or the overview and column 3, or player ranks and column 0, then it is a player name; which should have the in-game color codes translated to html. If the field is for map leaderboards and column 1, or the overview and column 3, or player ranks and column 0, then it is a player name; which should have the in-game color codes translated to html.
if ((i == 0 && *c == '\0') || (i == 1 && *c == 'p') ) if ((i == 0 && *c == QOVERVIEW) || (i == 1 && *c == QRPLAYER))
If the field is for overview and column 0 or is player ranks column 1, then it is a map name, and it should have html tags linking it to the map leaderboards. If the field is for overview and column 0 or is player ranks column 1, then it is a map name, and it should have html tags linking it to the map leaderboards.
if (i == 2 && (*c == 'm' || *c == '\0')) if (i == 2 && (*c == QMLEADERBOARD || *c == QOVERVIEW))
If the field is column 2 of either the overview or the map leaderboards, then it is a time which should be formatted as such. If the field is column 2 of either the overview or the map leaderboards, then it is a time which should be formatted as such.
If none of the conditionals are met, then the field is printed as usual. If none of the conditionals are met, then the field is printed as usual.