better identification and clean up
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5132 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -162,7 +162,7 @@ void newname(const char *name)
|
||||
{
|
||||
if(name[0])
|
||||
{
|
||||
filtertext(player1->name, name, 0, MAXNAMELEN);//12345678901234//
|
||||
filtertext(player1->name, name, 0, MAXNAMELEN);//12345678901234//
|
||||
if(!player1->name[0]) copystring(player1->name, "unarmed");
|
||||
updateclientname(player1);
|
||||
addmsg(SV_SWITCHNAME, "rs", player1->name);
|
||||
|
||||
@@ -197,7 +197,7 @@ int pututf8char(uchar *&d, int s)
|
||||
}
|
||||
|
||||
void filtertext(char *dst, const char *src, int whitespace, int len)
|
||||
{ // whitespace: no whitespace at all (0), blanks only (1), blanks & newline (2)
|
||||
{ // whitespace: no whitespace at all (0), blanks only (1), blanks & newline (2), spaces for underlines (-1)
|
||||
for(int c = *src; c; c = *++src)
|
||||
{
|
||||
c &= 0x7F; // 7-bit ascii
|
||||
@@ -205,8 +205,9 @@ void filtertext(char *dst, const char *src, int whitespace, int len)
|
||||
{
|
||||
case '\f': ++src; continue;
|
||||
}
|
||||
if(isspace(c) ? whitespace && (whitespace>1 || c == ' ') : isprint(c))
|
||||
if(isspace(c) ? whitespace && (whitespace>1 || c == ' '): isprint(c))
|
||||
{
|
||||
if ( whitespace < 0 && c == ' ' ) c = '_';
|
||||
*dst++ = c;
|
||||
if(!--len) break;
|
||||
}
|
||||
|
||||
@@ -162,8 +162,8 @@ static inline void updatemasterserver(int millis, int port)
|
||||
{
|
||||
if(!lastupdatemaster || millis-lastupdatemaster>60*60*1000)
|
||||
{
|
||||
string servername; sprintf(servername,"%s",global_name);
|
||||
if(mastername[0]) requestmasterf("regserv %d %s\n", port, servername);
|
||||
string servername; filtertext(servername,global_name,-1,20);
|
||||
if(mastername[0]) requestmasterf("regserv %d %s\n", port, servername[0] ? servername : "noname" );
|
||||
lastupdatemaster = millis ? millis : 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user