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;
for (terrain=terrains();n;terrain=terrain->next) {
for (terrain=terrains();terrain;terrain=terrain->next) {
if (fval(terrain, flags)==flags) {
--n;
if (n--==0) break;
}
}
return terrain;

View File

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

View File

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