version 1.3 | | version 1.4 |
---|
| | |
%{ | | %{ |
/* | | /* |
* static char *rcsid_object_c = | | * static char *rcsid_object_c = |
* "$Id: loader.l,v 1.3 1999/07/13 06:02:41 cvs Exp $"; | | * "$Id: loader.l,v 1.4 2000/04/27 07:04:18 cvs Exp $"; |
*/ | | */ |
| | |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
Copyright (C) 1994 Mark Wedel | | Copyright (C) 2000 Mark Wedel |
Copyright (C) 1992 Frank Tore Johansen | | Copyright (C) 1992 Frank Tore Johansen |
| | |
This program is free software; you can redistribute it and/or modify | | This program is free software; you can redistribute it and/or modify |
| | |
along with this program; if not, write to the Free Software | | along with this program; if not, write to the Free Software |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| | |
The author can be reached via e-mail to master@rahul.net | | The author can be reached via e-mail to mwedel@scruz.net |
*/ | | */ |
| | |
/* Eneq(@csd.uu.se): Added weight-modifiers in environment of objects. | | /* Eneq(@csd.uu.se): Added weight-modifiers in environment of objects. |
| | |
/* Our save file syntax is very simple, so we can use a very simple | | /* Our save file syntax is very simple, so we can use a very simple |
* processing mechanism here instead using something like bison | | * processing mechanism here instead using something like bison |
* This skips over the space and returns the value, or "" if no value | | * This skips over the space and returns the value, or "" if no value |
* is found. | | * is found. Modified 4/26/2000 to also strip spaces at end of |
| | * line |
*/ | | */ |
static char *yval() | | static char *yval() |
{ | | { |
static char *em=""; | | static char *em=""; |
char *cp; | | char *cp,*end; |
| | |
| | /* First skip over start of line, like animation or name */ |
| | for (cp=yytext; *cp!=' '; cp++) { |
| | if (*cp=='\0') { |
| | return em; |
| | } |
| | } |
| | |
cp=strchr(yytext,' '); | | /* Skip over whitespace */ |
if (cp) return cp+1; | | for (; *cp==' '; cp++) { |
else return em; | | if (*cp=='\0') { |
| | return em; |
| | } |
| | } |
| | /* Got last character before null and strip |
| | * off tailing whitespace |
| | */ |
| | for (end=cp+strlen(cp)-1; *end==' '; end--) { |
| | if (end==cp) return em; |
| | *end='\0'; |
| | } |
| | return cp; |
} | | } |
| | |
| | |