本家#479
Improve lev_comp error messages, and make sure the map area is set as the whole
level, if using the fill character with LEVEL.
@@ -178,6 +178,8 @@ | ||
178 | 178 | | ',' filling |
179 | 179 | { |
180 | 180 | splev.init_lev.filling = (schar) $2; |
181 | + max_x_map = COLNO-1; | |
182 | + max_y_map = ROWNO; | |
181 | 183 | } |
182 | 184 | ; |
183 | 185 |
@@ -189,15 +191,15 @@ | ||
189 | 191 | { |
190 | 192 | splev.init_lev.fg = what_map_char((char) $3); |
191 | 193 | if (splev.init_lev.fg == INVALID_TYPE) |
192 | - yyerror("Invalid foreground type."); | |
194 | + yyerror("INIT_MAP: Invalid foreground type."); | |
193 | 195 | splev.init_lev.bg = what_map_char((char) $5); |
194 | 196 | if (splev.init_lev.bg == INVALID_TYPE) |
195 | - yyerror("Invalid background type."); | |
197 | + yyerror("INIT_MAP: Invalid background type."); | |
196 | 198 | splev.init_lev.smoothed = $7; |
197 | 199 | splev.init_lev.joined = $9; |
198 | 200 | if (splev.init_lev.joined && |
199 | 201 | splev.init_lev.fg != CORR && splev.init_lev.fg != ROOM) |
200 | - yyerror("Invalid foreground type for joined map."); | |
202 | + yyerror("INIT_MAP: Invalid foreground type for joined map."); | |
201 | 203 | splev.init_lev.lit = $11; |
202 | 204 | splev.init_lev.walled = $13; |
203 | 205 | $$ = 1; |
@@ -1344,7 +1346,7 @@ | ||
1344 | 1346 | tmprandline->y2 = current_region.y2; |
1345 | 1347 | tmprandline->fg = what_map_char((char) $5); |
1346 | 1348 | if (tmprandline->fg == INVALID_TYPE) { |
1347 | - yyerror("Invalid map character in randline!"); | |
1349 | + yyerror("RANDLINE: Invalid map character!"); | |
1348 | 1350 | } |
1349 | 1351 | tmprandline->lit = $7; |
1350 | 1352 | tmprandline->roughness = $9; |
@@ -1370,12 +1372,12 @@ | ||
1370 | 1372 | tmpspill->y = current_coord.y; |
1371 | 1373 | tmpspill->typ = what_map_char((char) $5); |
1372 | 1374 | if (tmpspill->typ == INVALID_TYPE) { |
1373 | - yyerror("Invalid map character in spill!"); | |
1375 | + yyerror("SPILL: Invalid map character!"); | |
1374 | 1376 | } |
1375 | 1377 | tmpspill->direction = $7; |
1376 | 1378 | tmpspill->count = $9; |
1377 | 1379 | if (tmpspill->count < 1) { |
1378 | - yyerror("Invalid count in spill!"); | |
1380 | + yyerror("SPILL: Invalid count!"); | |
1379 | 1381 | } |
1380 | 1382 | tmpspill->lit = $11; |
1381 | 1383 |
@@ -1686,13 +1688,13 @@ | ||
1686 | 1688 | /* This series of if statements is a hack for MSC 5.1. It seems that its |
1687 | 1689 | tiny little brain cannot compile if these are all one big if statement. */ |
1688 | 1690 | if ($2 < 0 || $2 > (int)max_x_map) |
1689 | - yyerror("Region out of map range!"); | |
1691 | + yyerror("Region out of map range (x1)!"); | |
1690 | 1692 | else if ($4 < 0 || $4 > (int)max_y_map) |
1691 | - yyerror("Region out of map range!"); | |
1693 | + yyerror("Region out of map range (y1)!"); | |
1692 | 1694 | else if ($6 < 0 || $6 > (int)max_x_map) |
1693 | - yyerror("Region out of map range!"); | |
1695 | + yyerror("Region out of map range (x2)!"); | |
1694 | 1696 | else if ($8 < 0 || $8 > (int)max_y_map) |
1695 | - yyerror("Region out of map range!"); | |
1697 | + yyerror("Region out of map range (y2)!"); | |
1696 | 1698 | current_region.x1 = $2; |
1697 | 1699 | current_region.y1 = $4; |
1698 | 1700 | current_region.x2 = $6; |