status.cppsprintf(buffer, "%d", g_game.getPlayersOnline());
xmlSetProp(p, (const xmlChar*)"online", (const xmlChar*)buffer);
uint32_t real = 0;
std::map<uint32_t, uint32_t> listIP;
for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it) {
if (it->second->getIP() != 0) {
if (listIP.find(it->second->getIP()) != listIP.end()) {
listIP[it->second->getIP()]++;
if (listIP[it->second->getIP()] < 5) {
real++;
}
} else {
listIP[it->second->getIP()] = 1;
real++;
}
}
}
sprintf(buffer, "%d", real)...
status.cppsprintf(buffer, "%d", g_game.getPlayersOnline());
xmlSetProp(p, (const xmlChar*)"online", (const xmlChar*)buffer);
uint32_t real = 0;
std::map<uint32_t, uint32_t> listIP;
for(AutoList<Player>::iterator it = Player::autoList.begin(); it != Player::autoList.end(); ++it) {
if (it->second->getIP() != 0) {
if (listIP.find(it->second->getIP()) != listIP.end()) {
listIP[it->second->getIP()]++;
if (listIP[it->second->getIP()] < 5) {
real++;
}
} else {
listIP[it->second->getIP()] = 1;
real++;
}
}
}
sprintf(buffer, "%d", real);
xmlSetProp(p, (const xmlChar*)"online", (const xmlChar*)buffer);
sprintf(buffer, "%d", Connection::connectionCount);
xmlSetProp(p, (const xmlChar*)"online", (const xmlChar*)buffer);
sprintf(buffer, "%d", g_game.getPlayersOnline());
xmlSetProp(p, (const xmlChar*)"online", (const xmlChar*)buffer);
Yes, either way you'll be removing those 2 lines anyways, so the number inserted to the format string doesn't matter since it won't even be used anyways.I have
instead ofC++:sprintf(buffer, "%d", Connection::connectionCount); xmlSetProp(p, (const xmlChar*)"online", (const xmlChar*)buffer);
can change without any worries, right?C++:sprintf(buffer, "%d", g_game.getPlayersOnline()); xmlSetProp(p, (const xmlChar*)"online", (const xmlChar*)buffer);