crashbug mapper

bugfix random_terrain
This commit is contained in:
Enno Rehling 2005-12-04 00:58:57 +00:00
parent b09d0a89a7
commit e89b1c908d
3 changed files with 12 additions and 12 deletions

View File

@ -51,9 +51,9 @@ random_terrain(unsigned int flags)
} }
} }
n = rand() % nterrains; n = rand() % nterrains;
for (terrain=terrains();n;terrain=terrain->next) { for (terrain=terrains();terrain;terrain=terrain->next) {
if (fval(terrain, flags)==flags) { if (fval(terrain, flags)==flags) {
--n; if (n--==0) break;
} }
} }
return terrain; return terrain;

View File

@ -955,9 +955,7 @@ select_terrain(const terrain_type * default_terrain)
prev = ilist; prev = ilist;
while (terrain) { while (terrain) {
insert_selection(iinsert, prev, terrain->_name, (void*)terrain); push_selection(iinsert, terrain->_name, (void*)terrain);
prev = *iinsert;
iinsert = &prev->next;
terrain = terrain->next; terrain = terrain->next;
} }
selected = do_selection(ilist, "Terrain", NULL, NULL); selected = do_selection(ilist, "Terrain", NULL, NULL);

View File

@ -1151,6 +1151,7 @@ movearound(short rx, short ry) {
ch=-9; ch=-9;
break; break;
case 'I': case 'I':
if (r!=NULL) {
a = map_input(0,0,0,"Wieviele Regionen?",0,500,0); a = map_input(0,0,0,"Wieviele Regionen?",0,500,0);
if (a) { if (a) {
const terrain_type * terrain = random_terrain(NORMAL_TERRAIN); const terrain_type * terrain = random_terrain(NORMAL_TERRAIN);
@ -1158,6 +1159,7 @@ movearound(short rx, short ry) {
modified=1; modified=1;
} }
ch = -9; ch = -9;
}
break; break;
case 0x2: case 0x2:
make_ocean_block(rx, ry); make_ocean_block(rx, ry);