mirror of
https://github.com/tbamud/tbamud.git
synced 2026-02-07 00:21:48 +01:00
Room=name size increased to allow larger colour codes.
This commit is contained in:
parent
60a2f0ff7b
commit
67129480a4
4 changed files with 41 additions and 3 deletions
32
src/utils.c
32
src/utils.c
|
|
@ -820,6 +820,38 @@ int count_color_chars(char *string)
|
|||
return num;
|
||||
}
|
||||
|
||||
/* Not the prettiest thing I've ever written but it does the task which
|
||||
* is counting all characters in a string which are not part of the
|
||||
* protocol system. This is with the exception of detailed MXP codes. */
|
||||
int count_non_protocol_chars(char * str)
|
||||
{
|
||||
int count = 0;
|
||||
char *string = str;
|
||||
|
||||
while (*string) {
|
||||
if (*string == '\r' || *string == '\n') {
|
||||
string++;
|
||||
continue;
|
||||
}
|
||||
if (*string == '@' || *string == '\t') {
|
||||
string++;
|
||||
if (*string != '[' && *string != '<' && *string != '>' && *string != '(' && *string != ')')
|
||||
string++;
|
||||
else if (*string == '[') {
|
||||
while (*string && *string != ']')
|
||||
string++;
|
||||
string++;
|
||||
} else
|
||||
string++;
|
||||
continue;
|
||||
}
|
||||
count++;
|
||||
string++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/** Tests to see if a room is dark. Rules (unless overridden by ROOM_DARK):
|
||||
* Inside and City rooms are always lit. Outside rooms are dark at sunset and
|
||||
* night.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue