1 | %{ |
1 | %{ |
2 | /* |
2 | /* |
3 | * static char *rcsid_object_c = |
3 | * static char *rcsid_object_c = |
4 | * "$Id: loader.l,v 1.3 2006/05/11 19:07:40 root Exp $"; |
4 | * "$Id: loader.l,v 1.5 2006/06/26 21:46:04 root Exp $"; |
5 | */ |
5 | */ |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
9 | |
9 | |
… | |
… | |
333 | static char *op_debug_info_ (object *op, char *info) |
333 | static char *op_debug_info_ (object *op, char *info) |
334 | { |
334 | { |
335 | char info2[256 * 3]; |
335 | char info2[256 * 3]; |
336 | char *p = info; |
336 | char *p = info; |
337 | |
337 | |
338 | p += snprintf (p, 256, "%s%s%s=%d", |
338 | p += snprintf (p, 256, "%d=\"%s%s%s\"", |
|
|
339 | op->count, |
339 | op->name ? op->name : "(anon)", |
340 | op->name ? op->name : "(anon)", |
340 | op->title ? " " : "", |
341 | op->title ? " " : "", |
341 | op->title ? op->title : "", |
342 | op->title ? op->title : ""); |
342 | op->count); |
|
|
343 | |
343 | |
344 | if (op->env) |
344 | if (op->env) |
345 | p += snprintf (p, 256, "(in %s)", op_debug_info_ (op->env, info2)); |
345 | p += snprintf (p, 256, "(in %s)", op_debug_info_ (op->env, info2)); |
346 | |
346 | |
347 | if (op->map) |
347 | if (op->map) |
348 | p += snprintf (p, 256, "(%d+%d@%s)", op->x, op->y, op->map->path); |
348 | p += snprintf (p, 256, "(on %s@%d+%d)", op->map->path, op->x, op->y); |
349 | |
349 | |
350 | return info; |
350 | return info; |
351 | } |
351 | } |
352 | |
352 | |
353 | static char *op_debug_info (object *op) |
353 | static char *op_debug_info (object *op) |
… | |
… | |
643 | |
643 | |
644 | %} |
644 | %} |
645 | |
645 | |
646 | ^msg{WS}$ { BEGIN( MESSAGE ); msgbuf[0]='\0'; } |
646 | ^msg{WS}$ { BEGIN( MESSAGE ); msgbuf[0]='\0'; } |
647 | <MESSAGE>^endmsg{WS}$ { BEGIN( INITIAL ); |
647 | <MESSAGE>^endmsg{WS}$ { BEGIN( INITIAL ); |
648 | op->msg=add_string(msgbuf); |
|
|
649 | /* Just print a warning so we can be reasonably safe |
648 | /* Just print a warning so we can be reasonably safe |
650 | * about not overflowing the buffer. |
649 | * about not overflowing the buffer. |
651 | */ |
650 | */ |
652 | if (strlen(op->msg) > (HUGE_BUF/2)) |
651 | if (strlen(msgbuf) >= HUGE_BUF) |
|
|
652 | { |
653 | LOG(llevDebug, "\n\tWarning message length > %d (max allowed=%d): %d\n>%.80s<\n", |
653 | LOG(llevDebug, "\n\tError message length >= %d: %d\n>%.80s<\n", |
654 | HUGE_BUF/2, HUGE_BUF, strlen(op->msg),op->msg); |
654 | HUGE_BUF, strlen(op->msg),op->msg); |
|
|
655 | op->msg = add_string ("ERROR, please report: string too long, winged.\n"); |
|
|
656 | } |
|
|
657 | else |
|
|
658 | op->msg = add_string (msgbuf); |
655 | } |
659 | } |
656 | <MESSAGE>.* {strcat(msgbuf, yytext); strcat(msgbuf,"\n"); } |
660 | <MESSAGE>.* {strcat(msgbuf, yytext); strcat(msgbuf,"\n"); } |
657 | |
661 | |
658 | ^lore{WS}$ { BEGIN( LORE ); lorebuf[0]='\0'; } |
662 | ^lore{WS}$ { BEGIN( LORE ); lorebuf[0]='\0'; } |
659 | <LORE>^endlore{WS}$ { BEGIN( INITIAL ); |
663 | <LORE>^endlore{WS}$ { BEGIN( INITIAL ); |