Line numbering in lev_comp files

This patch allows the digits 0-9 to be used to indicate line numbers
in the MAP...ENDMAP arrays of level files.  This makes it a wee
bit easier to place features.  The digits get stripped out before
the map is interpreted.
This commit is contained in:
kmhugo
2002-01-19 06:06:16 +00:00
parent 0c7bcb6706
commit 263b6c06b1
2 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ static int map_cnt = 0;
map_cnt = 0; map_cnt = 0;
return MAP_ID; return MAP_ID;
} }
<MAPC>[-|}{+ABCISHKPLWTF\\#. ]*\n { <MAPC>[-|}{+ABCISHKPLWTF\\#. 0123456789]*\n {
line_number++; line_number++;
(void) strncpy(map + map_cnt, yytext, yyleng); (void) strncpy(map + map_cnt, yytext, yyleng);
map_cnt += yyleng; map_cnt += yyleng;
+6 -2
View File
@@ -516,8 +516,13 @@ char *map;
int max_hig = 0; int max_hig = 0;
char msg[256]; char msg[256];
/* First : find the max width of the map */ /* First, strip out digits 0-9 (line numbering) */
for (s1 = s2 = map; *s1; s1++)
if (*s1 < '0' || *s1 > '9')
*s2++ = *s1;
*s2 = '\0';
/* Second, find the max width of the map */
s1 = map; s1 = map;
while (s1 && *s1) { while (s1 && *s1) {
s2 = index(s1, NEWLINE); s2 = index(s1, NEWLINE);
@@ -532,7 +537,6 @@ char *map;
} }
/* Then parse it now */ /* Then parse it now */
while (map && *map) { while (map && *map) {
tmpmap[max_hig] = (char *) alloc(max_len); tmpmap[max_hig] = (char *) alloc(max_len);
s1 = index(map, NEWLINE); s1 = index(map, NEWLINE);