594 if (HasBit(hs->callback_mask, CBM_HOUSE_CARGO_ACCEPTANCE)) { |
594 if (HasBit(hs->callback_mask, CBM_HOUSE_CARGO_ACCEPTANCE)) { |
595 uint16 callback = GetHouseCallback(CBID_HOUSE_CARGO_ACCEPTANCE, 0, 0, GetHouseType(tile), GetTownByTile(tile), tile); |
595 uint16 callback = GetHouseCallback(CBID_HOUSE_CARGO_ACCEPTANCE, 0, 0, GetHouseType(tile), GetTownByTile(tile), tile); |
596 if (callback != CALLBACK_FAILED) { |
596 if (callback != CALLBACK_FAILED) { |
597 if (accepts[0] != CT_INVALID) ac[accepts[0]] = GB(callback, 0, 4); |
597 if (accepts[0] != CT_INVALID) ac[accepts[0]] = GB(callback, 0, 4); |
598 if (accepts[1] != CT_INVALID) ac[accepts[1]] = GB(callback, 4, 4); |
598 if (accepts[1] != CT_INVALID) ac[accepts[1]] = GB(callback, 4, 4); |
599 if (_opt.landscape != LT_TEMPERATE && HasBit(callback, 12)) { |
599 if (_settings.game_creation.landscape != LT_TEMPERATE && HasBit(callback, 12)) { |
600 /* The 'S' bit indicates food instead of goods */ |
600 /* The 'S' bit indicates food instead of goods */ |
601 ac[CT_FOOD] = GB(callback, 8, 4); |
601 ac[CT_FOOD] = GB(callback, 8, 4); |
602 } else { |
602 } else { |
603 if (accepts[2] != CT_INVALID) ac[accepts[2]] = GB(callback, 8, 4); |
603 if (accepts[2] != CT_INVALID) ac[accepts[2]] = GB(callback, 8, 4); |
604 } |
604 } |
1365 * for #tries only one time anyway - then we stop generating more |
1365 * for #tries only one time anyway - then we stop generating more |
1366 * towns. Do not show it too high neither, since looping through all |
1366 * towns. Do not show it too high neither, since looping through all |
1367 * the other towns may take considerable amount of time (10000 is |
1367 * the other towns may take considerable amount of time (10000 is |
1368 * too much). */ |
1368 * too much). */ |
1369 int tries = 1000; |
1369 int tries = 1000; |
1370 bool grf = (_opt.town_name >= _nb_orig_names); |
1370 bool grf = (_settings.game_creation.town_name >= _nb_orig_names); |
1371 uint32 grfid = grf ? GetGRFTownNameId(_opt.town_name - _nb_orig_names) : 0; |
1371 uint32 grfid = grf ? GetGRFTownNameId(_settings.game_creation.town_name - _nb_orig_names) : 0; |
1372 uint16 townnametype = grf ? GetGRFTownNameType(_opt.town_name - _nb_orig_names) : SPECSTR_TOWNNAME_START + _opt.town_name; |
1372 uint16 townnametype = grf ? GetGRFTownNameType(_settings.game_creation.town_name - _nb_orig_names) : SPECSTR_TOWNNAME_START + _settings.game_creation.town_name; |
1373 |
1373 |
1374 assert(townnameparts != NULL); |
1374 assert(townnameparts != NULL); |
1375 |
1375 |
1376 for (;;) { |
1376 for (;;) { |
1377 restart: |
1377 restart: |
1451 t->have_ratings = 0; |
1451 t->have_ratings = 0; |
1452 t->exclusivity = INVALID_PLAYER; |
1452 t->exclusivity = INVALID_PLAYER; |
1453 t->exclusive_counter = 0; |
1453 t->exclusive_counter = 0; |
1454 t->statues = 0; |
1454 t->statues = 0; |
1455 |
1455 |
1456 if (_opt.town_name < _nb_orig_names) { |
1456 if (_settings.game_creation.town_name < _nb_orig_names) { |
1457 /* Original town name */ |
1457 /* Original town name */ |
1458 t->townnamegrfid = 0; |
1458 t->townnamegrfid = 0; |
1459 t->townnametype = SPECSTR_TOWNNAME_START + _opt.town_name; |
1459 t->townnametype = SPECSTR_TOWNNAME_START + _settings.game_creation.town_name; |
1460 } else { |
1460 } else { |
1461 /* Newgrf town name */ |
1461 /* Newgrf town name */ |
1462 t->townnamegrfid = GetGRFTownNameId(_opt.town_name - _nb_orig_names); |
1462 t->townnamegrfid = GetGRFTownNameId(_settings.game_creation.town_name - _nb_orig_names); |
1463 t->townnametype = GetGRFTownNameType(_opt.town_name - _nb_orig_names); |
1463 t->townnametype = GetGRFTownNameType(_settings.game_creation.town_name - _nb_orig_names); |
1464 } |
1464 } |
1465 t->townnameparts = townnameparts; |
1465 t->townnameparts = townnameparts; |
1466 |
1466 |
1467 UpdateTownVirtCoord(t); |
1467 UpdateTownVirtCoord(t); |
1468 _town_sort_dirty = true; |
1468 _town_sort_dirty = true; |
1583 static const byte _num_initial_towns[4] = {5, 11, 23, 46}; // very low, low, normal, high |
1583 static const byte _num_initial_towns[4] = {5, 11, 23, 46}; // very low, low, normal, high |
1584 |
1584 |
1585 bool GenerateTowns() |
1585 bool GenerateTowns() |
1586 { |
1586 { |
1587 uint num = 0; |
1587 uint num = 0; |
1588 uint n = ScaleByMapSize(_num_initial_towns[_opt.diff.number_towns] + (Random() & 7)); |
1588 uint n = ScaleByMapSize(_num_initial_towns[_settings.difficulty.number_towns] + (Random() & 7)); |
1589 uint num_cities = _settings.economy.larger_towns == 0 ? 0 : n / _settings.economy.larger_towns; |
1589 uint num_cities = _settings.economy.larger_towns == 0 ? 0 : n / _settings.economy.larger_towns; |
1590 |
1590 |
1591 SetGeneratingWorldProgress(GWP_TOWN, n); |
1591 SetGeneratingWorldProgress(GWP_TOWN, n); |
1592 |
1592 |
1593 do { |
1593 do { |
1877 /* Get the town zone type of the current tile, as well as the climate. |
1877 /* Get the town zone type of the current tile, as well as the climate. |
1878 * This will allow to easily compare with the specs of the new house to build */ |
1878 * This will allow to easily compare with the specs of the new house to build */ |
1879 HouseZonesBits rad = GetTownRadiusGroup(t, tile); |
1879 HouseZonesBits rad = GetTownRadiusGroup(t, tile); |
1880 |
1880 |
1881 /* Above snow? */ |
1881 /* Above snow? */ |
1882 int land = _opt.landscape; |
1882 int land = _settings.game_creation.landscape; |
1883 if (land == LT_ARCTIC && z >= _opt.snow_line) land = -1; |
1883 if (land == LT_ARCTIC && z >= _settings.game_creation.snow_line) land = -1; |
1884 |
1884 |
1885 uint bitmask = (1 << rad) + (1 << (land + 12)); |
1885 uint bitmask = (1 << rad) + (1 << (land + 12)); |
1886 |
1886 |
1887 /* bits 0-4 are used |
1887 /* bits 0-4 are used |
1888 * bits 11-15 are used |
1888 * bits 11-15 are used |
2350 } else { |
2350 } else { |
2351 m = _grow_count_values[1][min(n, 5)]; |
2351 m = _grow_count_values[1][min(n, 5)]; |
2352 if (n == 0 && !Chance16(1, 12)) return; |
2352 if (n == 0 && !Chance16(1, 12)) return; |
2353 } |
2353 } |
2354 |
2354 |
2355 if (_opt.landscape == LT_ARCTIC) { |
2355 if (_settings.game_creation.landscape == LT_ARCTIC) { |
2356 if (TilePixelHeight(t->xy) >= GetSnowLine() && t->act_food == 0 && t->population > 90) |
2356 if (TilePixelHeight(t->xy) >= GetSnowLine() && t->act_food == 0 && t->population > 90) |
2357 return; |
2357 return; |
2358 } else if (_opt.landscape == LT_TROPIC) { |
2358 } else if (_settings.game_creation.landscape == LT_TROPIC) { |
2359 if (GetTropicZone(t->xy) == TROPICZONE_DESERT && (t->act_food == 0 || t->act_water == 0) && t->population > 60) |
2359 if (GetTropicZone(t->xy) == TROPICZONE_DESERT && (t->act_food == 0 || t->act_water == 0) && t->population > 60) |
2360 return; |
2360 return; |
2361 } |
2361 } |
2362 |
2362 |
2363 /* Use the normal growth rate values if new buildings have been funded in |
2363 /* Use the normal growth rate values if new buildings have been funded in |
2522 |
2522 |
2523 /* check if you're allowed to remove the street/bridge/tunnel/industry |
2523 /* check if you're allowed to remove the street/bridge/tunnel/industry |
2524 * owned by a town no removal if rating is lower than ... depends now on |
2524 * owned by a town no removal if rating is lower than ... depends now on |
2525 * difficulty setting. Minimum town rating selected by difficulty level |
2525 * difficulty setting. Minimum town rating selected by difficulty level |
2526 */ |
2526 */ |
2527 int modemod = _default_rating_settings[_opt.diff.town_council_tolerance][type]; |
2527 int modemod = _default_rating_settings[_settings.difficulty.town_council_tolerance][type]; |
2528 |
2528 |
2529 if (GetRating(t) < 16 + modemod && !(flags & DC_NO_TOWN_RATING)) { |
2529 if (GetRating(t) < 16 + modemod && !(flags & DC_NO_TOWN_RATING)) { |
2530 SetDParam(0, t->index); |
2530 SetDParam(0, t->index); |
2531 _error_message = STR_2009_LOCAL_AUTHORITY_REFUSES; |
2531 _error_message = STR_2009_LOCAL_AUTHORITY_REFUSES; |
2532 return false; |
2532 return false; |