Fix for amb108 - statsx keeping port when saving stats by ip - this should still allow for old stats files to work, but there is a small chance for idiosyncrasies if there are multiple users with the same ip (but different port) saved.

This commit is contained in:
Steve Dudenhoeffer
2007-06-22 15:35:46 +00:00
parent 6865b984e0
commit b3e61b1d75
12 changed files with 209 additions and 28 deletions

View File

@ -85,6 +85,7 @@ void CPlayer::PutInServer(){
restartStats();
const char* name = STRING(pEdict->v.netname);
const char* unique = name;
bool isip = false;
switch((int)csstats_rank->value) {
case 1:
if ( (unique = GETPLAYERAUTHID(pEdict)) == 0 )
@ -92,13 +93,23 @@ void CPlayer::PutInServer(){
break;
case 2:
unique = ip;
isip = true;
}
rank = g_rank.findEntryInRank( unique , name );
rank = g_rank.findEntryInRank( unique , name , isip);
}
void CPlayer::Connect(const char* address ){
bot = IsBot();
strcpy(ip,address);
// Strip the port from the ip
for (size_t i = 0; i < sizeof(ip); i++)
{
if (ip[i] == ':')
{
ip[i] = '\0';
break;
}
}
rank = 0;
clearStats = 0.0f;
}