compact pos packets are now parseable out of context; all-whitespace chat gets suppressed

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4620 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
ac_stef
2009-08-09 20:34:09 +00:00
parent df7176e9af
commit 9fca17a7a9
5 changed files with 68 additions and 39 deletions
+8 -2
View File
@@ -94,7 +94,7 @@ void getstring(char *text, ucharbuf &p, int len)
#define follower(x) (((x) & 0xc0) == 0x80)
int getutf8char(const unsigned char *&s)
int getutf8char(const uchar *&s)
{
int res = *s++;
if(res < 0x80) return res;
@@ -140,7 +140,7 @@ int getutf8char(const unsigned char *&s)
return -1;
}
int pututf8char(unsigned char *&d, int s)
int pututf8char(uchar *&d, int s)
{
if(s < 0 || s > 0x1fffff) return 0;
if(s < 0x80)
@@ -246,6 +246,12 @@ void filterlang(char *d, const char *s)
*d = '\0';
}
void trimtrailingwhitespace(char *s)
{
for(int n = strlen(s) - 1; n >= 0 && isspace(s[n]); n--)
s[n] = '\0';
}
void cutcolorstring(char *text, int len)
{ // limit string length, ignore color codes
while(*text)