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,13 +1151,15 @@ movearound(short rx, short ry) {
ch=-9; ch=-9;
break; break;
case 'I': case 'I':
a=map_input(0,0,0,"Wieviele Regionen?",0,500,0); if (r!=NULL) {
if (a) { a = map_input(0,0,0,"Wieviele Regionen?",0,500,0);
const terrain_type * terrain = random_terrain(NORMAL_TERRAIN); if (a) {
create_island(r, a, terrain); const terrain_type * terrain = random_terrain(NORMAL_TERRAIN);
modified=1; create_island(r, a, terrain);
} modified=1;
ch = -9; }
ch = -9;
}
break; break;
case 0x2: case 0x2:
make_ocean_block(rx, ry); make_ocean_block(rx, ry);