MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / buildHTMLPlayer

Method buildHTMLPlayer

src/bzfs/Stats.cpp:108–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108void StatsLink::buildHTMLPlayer(std::string& params, int playerID, int index) {
109 GameKeeper::Player* player = GameKeeper::Player::getPlayerByIndex(playerID);
110 if (player) {
111 params += TextUtils::format("&callsign%d=%s", index, TextUtils::url_encode(std::string(player->player.getCallSign())).c_str());
112
113 if (player->hasCustomField("motto") && player->customData["motto"].size()) {
114 params += TextUtils::format("&motto%d=%s", index, TextUtils::url_encode(player->customData["motto"]).c_str());
115 }
116
117 params += TextUtils::format("&team%d=%s", index, TextUtils::url_encode(std::string(getTeamName(player->player.getTeam()))).c_str());
118
119 std::string BZID = player->getBzIdentifier();
120 if (!BZID.size()) {
121 BZID = "none";
122 }
123 params += TextUtils::format("&bzID%d=%s", index, TextUtils::url_encode(BZID).c_str());
124
125 std::string Token = player->player.getToken();
126 if (!Token.size()) {
127 Token = "none";
128 }
129 params += TextUtils::format("&token%d=%s", index, TextUtils::url_encode(Token).c_str());
130
131 if (player->player.OSVersion.size()) {
132 params += TextUtils::format("&osvers%d=%s", index, TextUtils::url_encode(player->player.OSVersion).c_str());
133 }
134
135 if (player->player.getTeam() != ObserverTeam) {
136 params += TextUtils::format("&wins%d=%d", index, player->score.getWins());
137 params += TextUtils::format("&losses%d=%d", index, player->score.getLosses());
138 params += TextUtils::format("&teamkills%d=%d", index, player->score.getTKs());
139 }
140 params += TextUtils::format("&version%d=%s", index, TextUtils::url_encode(std::string(player->player.getClientVersion())).c_str());
141 }
142}
143
144void StatsLink::buildHTMLPlayerList(std::string& params, int skip) {
145 bz_APIIntList* players = bz_getPlayerIndexList();

Callers

nothing calls this directly

Calls 14

getTeamNameFunction · 0.85
c_strMethod · 0.80
getTokenMethod · 0.80
getTKsMethod · 0.80
getClientVersionMethod · 0.80
getPlayerByIndexFunction · 0.50
formatFunction · 0.50
url_encodeFunction · 0.50
getCallSignMethod · 0.45
hasCustomFieldMethod · 0.45
sizeMethod · 0.45
getTeamMethod · 0.45

Tested by

no test coverage detected