--- deliantra/server/common/loader.l 2006/05/11 20:15:30 1.4 +++ deliantra/server/common/loader.l 2006/08/26 08:44:04 1.8 @@ -42,8 +42,8 @@ static char *yval(); static int lex_error; -static char msgbuf[HUGE_BUF]; -static char lorebuf[HUGE_BUF]; +static char msgbuf[65536]; +static char lorebuf[65536]; /* Maps the MOVE_* values to names */ static const char *const move_name[] = {"walk", "fly_low", "fly_high", "swim", "boat", @@ -59,7 +59,7 @@ * NULL entries in this table are valid - to denote objects that should * not be updated for whatever reason. */ -const char *const spell_mapping[] = { +const char *spell_mapping[] = { "spell_magic_bullet", /* 0 */ "spell_small_fireball", /* 1 */ "spell_medium_fireball", /* 2 */ @@ -645,13 +645,17 @@ ^msg{WS}$ { BEGIN( MESSAGE ); msgbuf[0]='\0'; } ^endmsg{WS}$ { BEGIN( INITIAL ); - op->msg=add_string(msgbuf); /* Just print a warning so we can be reasonably safe * about not overflowing the buffer. */ - if (strlen(op->msg) > (HUGE_BUF/2)) - LOG(llevDebug, "\n\tWarning message length > %d (max allowed=%d): %d\n>%.80s<\n", - HUGE_BUF/2, HUGE_BUF, strlen(op->msg),op->msg); + if (strlen(msgbuf) >= HUGE_BUF) + { + LOG(llevDebug, "\n\tError message length >= %d: %d\n>%.80s<\n", + HUGE_BUF, strlen(op->msg),op->msg); + op->msg = add_string ("ERROR, please report: string too long, winged.\n"); + } + else + op->msg = add_string (msgbuf); } .* {strcat(msgbuf, yytext); strcat(msgbuf,"\n"); } @@ -691,6 +695,10 @@ if (*yv=='\0') LOG(llevError,"Name without val\n"); else FREE_AND_COPY(op->name_pl, yv); } +^attach{S} { char *yv=yval(); + if (*yv) + op->attach = add_string (yv); + } ^skill{S} FREE_AND_COPY(op->skill,yval()); ^custom_name{S} { char *yv=yval(); @@ -982,7 +990,7 @@ /* Old style resistances */ ^immune{S} set_protection(op, IVAL, RESIST_IMMUNE); ^protected{S} set_protection(op, IVAL, RESIST_PROT); -^vulnerable{S} set_protection(op, IVAL, RESIST_VULN); +^vulnerable{S} set_protection(op, IVAL, (uint16) RESIST_VULN); /* old values - keep them around for now, but they should be removed at some point */ ^has_ready_rod{S} SET_OR_CLEAR_FLAG(op, FLAG_READY_RANGE, IVAL); @@ -1031,7 +1039,7 @@ ^can_dam_armour{S} { } ^weapontype{S} op->weapontype = IVAL; ^tooltype{S} op->tooltype = IVAL; -^casting_time{S} op->casting_time = FVAL; +^casting_time{S} op->casting_time = (sint16) FVAL; ^elevation{S} op->elevation = IVAL; ^smoothlevel{S} op->smoothlevel = IVAL; ^client_type{S} op->client_type = IVAL; @@ -1645,17 +1653,11 @@ */ static int already_run = 0; static int flag_lens[NUM_FLAGS]; - static char buf2[HUGE_BUF]; - static char buf[HUGE_BUF]; - char* fastbuf; + char buf2[4096]; // / was HUFE_BUF, which was hugely incorrect, as is this value, but much less so + static char buf[128*1024]; // < the assumption is that every object always fits. fixing this bug, however + char* fastbuf; // \ requires a large rewrite of the code, so its left to the next total rewrite. int tmp; int i; -#if 0 -/*Memory polluting code. Should help detect problems, very slow*/ - for (i=0;imove_slow_penalty != op2->move_slow_penalty) { - FAST_SAVE_LONG(fastbuf,"move_slow_penalty ",op->move_slow_penalty,18); + FAST_SAVE_LONG(fastbuf,"move_slow_penalty ",(long) op->move_slow_penalty,18); } if (!COMPARE_FLAGS(op,op2)) {