Room=name size increased to allow larger colour codes.
This commit is contained in:
@@ -34,9 +34,10 @@
|
|||||||
#define MAX_PEOPLE 10 /* Max # of people you want to sit in furniture. */
|
#define MAX_PEOPLE 10 /* Max # of people you want to sit in furniture. */
|
||||||
|
|
||||||
/* Limit information. */
|
/* Limit information. */
|
||||||
#define MAX_ROOM_NAME 75
|
/* Name size increased due to larger colour/mxp codes. -Vatiken */
|
||||||
#define MAX_MOB_NAME 50
|
#define MAX_ROOM_NAME 150
|
||||||
#define MAX_OBJ_NAME 50
|
#define MAX_MOB_NAME 100
|
||||||
|
#define MAX_OBJ_NAME 100
|
||||||
#define MAX_ROOM_DESC 2048
|
#define MAX_ROOM_DESC 2048
|
||||||
#define MAX_EXIT_DESC 256
|
#define MAX_EXIT_DESC 256
|
||||||
#define MAX_EXTRA_DESC 512
|
#define MAX_EXTRA_DESC 512
|
||||||
|
|||||||
@@ -680,6 +680,10 @@ void redit_parse(struct descriptor_data *d, char *arg)
|
|||||||
case REDIT_NAME:
|
case REDIT_NAME:
|
||||||
if (!genolc_checkstring(d, arg))
|
if (!genolc_checkstring(d, arg))
|
||||||
break;
|
break;
|
||||||
|
if (count_non_protocol_chars(arg) > MAX_ROOM_NAME / 2) {
|
||||||
|
write_to_output(d, "Size limited to %d non-protocol characters.\r\n", MAX_ROOM_NAME / 2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (OLC_ROOM(d)->name)
|
if (OLC_ROOM(d)->name)
|
||||||
free(OLC_ROOM(d)->name);
|
free(OLC_ROOM(d)->name);
|
||||||
arg[MAX_ROOM_NAME - 1] = '\0';
|
arg[MAX_ROOM_NAME - 1] = '\0';
|
||||||
|
|||||||
32
src/utils.c
32
src/utils.c
@@ -820,6 +820,38 @@ int count_color_chars(char *string)
|
|||||||
return num;
|
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):
|
/** 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
|
* Inside and City rooms are always lit. Outside rooms are dark at sunset and
|
||||||
* night.
|
* night.
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ char *strpaste(char *str1, char *str2, char *joiner);
|
|||||||
void new_affect(struct affected_type *af);
|
void new_affect(struct affected_type *af);
|
||||||
int get_class_by_name(char *classname);
|
int get_class_by_name(char *classname);
|
||||||
char * convert_from_tabs(char * string);
|
char * convert_from_tabs(char * string);
|
||||||
|
int count_non_protocol_chars(char * str);
|
||||||
|
|
||||||
/* Public functions made available form weather.c */
|
/* Public functions made available form weather.c */
|
||||||
void weather_and_time(int mode);
|
void weather_and_time(int mode);
|
||||||
|
|||||||
Reference in New Issue
Block a user