]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow strings as ranks
authorz411 <z411@omaera.org>
Mon, 24 Jan 2022 20:52:45 +0000 (17:52 -0300)
committerz411 <z411@omaera.org>
Mon, 24 Jan 2022 20:52:45 +0000 (17:52 -0300)
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/hud/panel/spect.qc
qcsrc/client/main.qh
qcsrc/common/ent_cs.qc
qcsrc/common/ent_cs.qh
qcsrc/server/client.qc
qcsrc/server/client.qh
qcsrc/server/command/sv_cmd.qc

index 7eaabacc9d7db8d65b786cad4e19ad56e8f9f7b9..fe096ecd1eafdf56bfeb7f8d865bfbb01e0cca50 100644 (file)
@@ -1300,10 +1300,8 @@ void Scoreboard_Duel_DrawTable(vector pos, bool invert, entity pl, entity tm)
        tmp_in.y += (duel_score_size.y - duel_name_fontsize.y) / 2;
        
        // RJZ rank
-       int rank = entcs_GetRank(pl.sv_entnum);
-       string rank_str = "";
-       if(rank) {
-               rank_str = strcat("(", ftos(rank), ")");
+       string rank_str = entcs_GetRank(pl.sv_entnum);
+       if(rank_str) {
                if(invert)
                        tmp_in.x -= stringwidth_colors(rank_str, duel_name_fontsize) + duel_name_fontsize.x * 0.5;
                else
@@ -1319,7 +1317,7 @@ void Scoreboard_Duel_DrawTable(vector pos, bool invert, entity pl, entity tm)
        if(invert)
                tmp_in.x -= stringwidth_colors(tmp_str, duel_name_fontsize) + duel_name_fontsize.x * 0.5;
        else
-               tmp_in.x += (rank ? stringwidth_colors(rank_str, duel_name_fontsize) : duel_score_size.x) + duel_name_fontsize.x * 0.5;
+               tmp_in.x += (rank_str ? stringwidth_colors(rank_str, duel_name_fontsize) : duel_score_size.x) + duel_name_fontsize.x * 0.5;
        drawcolorcodedstring(tmp_in, tmp_str, duel_name_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
        
        //LegendGuard adds a conditional sentence for country column 05-04-2021
index e5ab123083b3010584a3ff6b7741445f8fe575e3..da20acf3377c194ef6b062c308356ac44bc4744b 100644 (file)
@@ -256,11 +256,9 @@ void HUD_SpectHUD_drawDuelScore(vector pos, entity pl, bool invert)
        tmp.y += ((teamscore_size.y / 2) - teamname_fontsize.y) / 2;
        tmp.y += teamscore_size.y / 2;
        
-               // RJZ rank
-       int rank = entcs_GetRank(pl.sv_entnum);
-       string rank_str = "";
-       if(rank) {
-               rank_str = strcat("(", ftos(rank), ")");
+       // RJZ rank
+       string rank_str = entcs_GetRank(pl.sv_entnum);
+       if(rank_str) {
                if(invert)
                        tmp.x -= stringwidth_colors(rank_str, teamname_fontsize) + teamname_fontsize.x * 0.5;
                else
@@ -277,7 +275,7 @@ void HUD_SpectHUD_drawDuelScore(vector pos, entity pl, bool invert)
        if(invert)
                tmp.x -= stringwidth_colors(tmp_str, teamname_fontsize) + teamname_fontsize.x * 0.5;
        else
-               tmp.x += (rank ? stringwidth_colors(rank_str, teamname_fontsize) : teamscore_size.x) + teamname_fontsize.x * 0.5;
+               tmp.x += (rank_str ? stringwidth_colors(rank_str, teamname_fontsize) : teamscore_size.x) + teamname_fontsize.x * 0.5;
        
        drawcolorcodedstring(tmp, tmp_str, teamname_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
 }
index f65107398c0f51dea7562e19047af2f2a107efc5..41fdb48e6ca778aeba0ed3b026a237924ef4a21e 100644 (file)
@@ -169,7 +169,7 @@ string GetSpeedUnit(int speed_unit);
 .int team;
 .int team_size;
 .int countrycode;
-.int rank;
+.string rank;
 
 int binddb;
 
index 151f4ac321cfce5e3a97a3d365ef76763fa95962..06d9440ad548bcc0334cfd0b7f61f8f472b55079 100644 (file)
@@ -157,8 +157,8 @@ ENTCS_PROP(COUNTRYCODE, true, countrycode, countrycode, ENTCS_SET_NORMAL,
        { ent.countrycode = ReadByte(); })
 
 ENTCS_PROP(RANK, true, rank, rank, ENTCS_SET_NORMAL,
-       { WriteByte(chan, ent.rank); },
-       { ent.rank = ReadByte(); })
+       { WriteString(chan, ent.rank); },
+       { strcpy(ent.rank, ReadString()); })
 
 // use sv_solid to avoid changing solidity state of entcs entities
 ENTCS_PROP(SOLID, true, sv_solid, solid, ENTCS_SET_NORMAL,
index cec8fbf211748fa220ae512b661bd85dd8e43732..90a6550c543155790ee5e61961fa52946e1c8759 100644 (file)
@@ -140,10 +140,10 @@ REGISTER_NET_TEMP(CLIENT_ENTCS)
                return e.countrycode;
        }
        
-       int entcs_GetRank(int i)
+       string entcs_GetRank(int i)
        {
                entity e = entcs_receiver(i);
-               return e.rank;
+               return (e.rank != "" ? e.rank : string_null);
        }
 
     /**
index cafa65cc8fb9d80e16fb0567c728f004d8acb77c..fcf25b476d9c7256f6994d094f8e2189780054f7 100644 (file)
@@ -1145,7 +1145,7 @@ void ClientConnect(entity this)
                GameLogEcho(strcat(":join:", ftos(this.playerid), ":", ftos(etof(this)), ":", ((IS_REAL_CLIENT(this)) ? GameLog_ProcessIP(this.netaddress) : "bot"), ":", playername(this.netname, this.team, false)));
                
                /* z411 for RJZ */
-               if(autocvar_rjz_ranks) GameLogEcho(strcat(":idfp:", this.crypto_idfp));
+               if(autocvar_rjz_ranks) GameLogEcho(strcat(":idfp:", ftos(etof(this)), ":", this.crypto_idfp));
        }
 
        CS(this).just_joined = true;  // stop spamming the eventlog with additional lines when the client connects
index 6afd74638efe3c109ab6344c2ab8539de433a477..52fc3147220b9b7c52237f2d3de4587f2e09eefb 100644 (file)
@@ -108,7 +108,7 @@ CLASS(Client, Object)
     ATTRIB(Client, team, int, this.team);
     ATTRIB(Client, clientcolors, int, this.clientcolors);
        ATTRIB(Client, countrycode, int, this.countrycode);
-       ATTRIB(Client, rank, int, this.rank);
+       ATTRIB(Client, rank, string, this.rank);
     /** Client IP */
     ATTRIB(Client, netaddress, string, this.netaddress);
     ATTRIB(Client, playermodel, string, this.playermodel);
@@ -337,7 +337,7 @@ bool independent_players;
 .float lastkill;
 .int countrycode;
 .int killcount;
-.int rank;
+.string rank; // RJZ
 
 //flood fields
 .float nickspamtime; // time of last nick change
index 65b550848bd51b0474fbd56a734d3ae63f4f870a..4895866ea5d11ce3ac0153cb43969fe426f1db53 100644 (file)
@@ -1121,11 +1121,11 @@ void GameCommand_setrank(int request, int argc)
                        if (accepted <= 0)
                        {
                                LOG_INFO("^1ERROR^7: Couldn't set player rank");
-                               LOG_HELP("Usage:^3 sv_cmd setrank #client_id #rank");
+                               LOG_HELP("Usage:^3 sv_cmd setrank #client_id rank");
                                return;
                        }
                        
-                       client.rank = stof(argv(2));
+                       client.rank = strzone(argv(2));
                        LOG_INFO("^2SUCCESS^7: Player rank set!");
                        return;
                }