mirror of https://github.com/OpenTTD/OpenTTD
(svn r20869) [1.0] -Backport from trunk:
- Fix: [NewGRF] Assert when an industry previously build on water was flooded because its NewGRF changed/is missing [FS#4112] (r20754) - Fix: Do not use new game settings when creating many random towns/industries in the scenario editor [FS#4094] (r20712, r20711) - Fix: Graphic glitch when switching to a different-sized font while the chat message box was visible (r20705) - Fix: Vehicle lists of non-trains could not resize horizontally causing truncation of texts [FS#4123, FS#3955] (r20174)release/1.0
parent
9236112860
commit
672406654c
|
@ -799,6 +799,12 @@ static void TileLoop_Industry(TileIndex tile)
|
|||
|
||||
if (IsIndustryTileOnWater(tile)) TileLoop_Water(tile);
|
||||
|
||||
/* Normally this doesn't happen, but if an industry NewGRF is removed
|
||||
* an industry that was previously build on water can now be flooded.
|
||||
* If this happens the tile is no longer an industry tile after
|
||||
* returning from TileLoop_Water. */
|
||||
if (!IsTileType(tile, MP_INDUSTRY)) return;
|
||||
|
||||
TriggerIndustryTile(tile, INDTILE_TRIGGER_TILE_LOOP);
|
||||
|
||||
if (!IsIndustryCompleted(tile)) {
|
||||
|
@ -1814,7 +1820,8 @@ static uint32 GetScaledIndustryProbability(IndustryType it, bool *force_at_least
|
|||
const IndustrySpec *ind_spc = GetIndustrySpec(it);
|
||||
uint32 chance = ind_spc->appear_creation[_settings_game.game_creation.landscape] * 16; // * 16 to increase precision
|
||||
if (!ind_spc->enabled || chance == 0 || ind_spc->num_table == 0 ||
|
||||
!CheckIfCallBackAllowsAvailability(it, IACT_MAPGENERATION) || _settings_game.difficulty.number_industries == 0) {
|
||||
!CheckIfCallBackAllowsAvailability(it, IACT_MAPGENERATION) ||
|
||||
(_game_mode != GM_EDITOR && _settings_game.difficulty.number_industries == 0)) {
|
||||
*force_at_least_one = false;
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -1822,7 +1829,7 @@ static uint32 GetScaledIndustryProbability(IndustryType it, bool *force_at_least
|
|||
* For simplicity we scale in both cases, though scaling the probabilities of all industries has no effect. */
|
||||
chance = (ind_spc->check_proc == CHECK_REFINERY || ind_spc->check_proc == CHECK_OIL_RIG) ? ScaleByMapSize1D(chance) : ScaleByMapSize(chance);
|
||||
|
||||
*force_at_least_one = (chance > 0) && !(ind_spc->behaviour & INDUSTRYBEH_NOBUILT_MAPCREATION);
|
||||
*force_at_least_one = (chance > 0) && !(ind_spc->behaviour & INDUSTRYBEH_NOBUILT_MAPCREATION) && (_game_mode != GM_EDITOR);
|
||||
return chance;
|
||||
}
|
||||
}
|
||||
|
@ -1862,7 +1869,8 @@ static void PlaceInitialIndustry(IndustryType type, bool try_hard)
|
|||
void GenerateIndustries()
|
||||
{
|
||||
assert(_settings_game.difficulty.number_industries < lengthof(_numof_industry_table));
|
||||
uint total_amount = ScaleByMapSize(_numof_industry_table[_settings_game.difficulty.number_industries]);
|
||||
uint difficulty = (_game_mode != GM_EDITOR) ? _settings_game.difficulty.number_industries : 1;
|
||||
uint total_amount = ScaleByMapSize(_numof_industry_table[difficulty]);
|
||||
|
||||
/* Do not create any industries? */
|
||||
if (total_amount == 0) return;
|
||||
|
|
|
@ -114,16 +114,22 @@ void CDECL NetworkAddChatMessage(TextColour colour, uint8 duration, const char *
|
|||
_chatmessage_dirty = true;
|
||||
}
|
||||
|
||||
/** Initialize all font-dependent chat box sizes. */
|
||||
void NetworkReInitChatBoxSize()
|
||||
{
|
||||
_chatmsg_box.y = 3 * FONT_HEIGHT_NORMAL;
|
||||
_chatmsg_box.height = MAX_CHAT_MESSAGES * (FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING) + 2;
|
||||
_chatmessage_backup = ReallocT(_chatmessage_backup, _chatmsg_box.width * _chatmsg_box.height * BlitterFactoryBase::GetCurrentBlitter()->GetBytesPerPixel());
|
||||
}
|
||||
|
||||
void NetworkInitChatMessage()
|
||||
{
|
||||
MAX_CHAT_MESSAGES = _settings_client.gui.network_chat_box_height;
|
||||
|
||||
_chatmsg_list = ReallocT(_chatmsg_list, _settings_client.gui.network_chat_box_height);
|
||||
_chatmsg_box.x = 10;
|
||||
_chatmsg_box.y = 3 * FONT_HEIGHT_NORMAL;
|
||||
_chatmsg_box.width = _settings_client.gui.network_chat_box_width;
|
||||
_chatmsg_box.height = _settings_client.gui.network_chat_box_height * (FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING) + 2;
|
||||
_chatmessage_backup = ReallocT(_chatmessage_backup, _chatmsg_box.width * _chatmsg_box.height * BlitterFactoryBase::GetCurrentBlitter()->GetBytesPerPixel());
|
||||
NetworkReInitChatBoxSize();
|
||||
_chatmessage_visible = false;
|
||||
|
||||
for (uint i = 0; i < MAX_CHAT_MESSAGES; i++) {
|
||||
|
|
|
@ -1775,7 +1775,7 @@ static const byte _num_initial_towns[4] = {5, 11, 23, 46}; // very low, low, no
|
|||
bool GenerateTowns(TownLayout layout)
|
||||
{
|
||||
uint num = 0;
|
||||
uint difficulty = _settings_game.difficulty.number_towns;
|
||||
uint difficulty = (_game_mode != GM_EDITOR) ? _settings_game.difficulty.number_towns : 0;
|
||||
uint n = (difficulty == (uint)CUSTOM_TOWN_NUMBER_DIFFICULTY) ? _settings_game.game_creation.custom_town_number : ScaleByMapSize(_num_initial_towns[difficulty] + (Random() & 7));
|
||||
uint32 townnameparts;
|
||||
|
||||
|
|
|
@ -776,7 +776,7 @@ static const NWidgetPart _nested_vehicle_list[] = {
|
|||
EndContainer(),
|
||||
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_MATRIX, COLOUR_GREY, VLW_WIDGET_LIST), SetMinimalSize(248, 0), SetFill(1, 0),
|
||||
NWidget(WWT_MATRIX, COLOUR_GREY, VLW_WIDGET_LIST), SetMinimalSize(248, 0), SetFill(1, 0), SetResize(1, 1),
|
||||
NWidget(WWT_SCROLLBAR, COLOUR_GREY, VLW_WIDGET_SCROLLBAR),
|
||||
EndContainer(),
|
||||
|
||||
|
@ -1001,13 +1001,10 @@ public:
|
|||
{
|
||||
if (widget != VLW_WIDGET_LIST) return;
|
||||
|
||||
resize->width = 0;
|
||||
resize->height = GetVehicleListHeight(this->vehicle_type, 1);
|
||||
|
||||
switch (this->vehicle_type) {
|
||||
case VEH_TRAIN:
|
||||
resize->width = 1;
|
||||
/* Fallthrough */
|
||||
case VEH_ROAD:
|
||||
size->height = 6 * resize->height;
|
||||
break;
|
||||
|
|
|
@ -2488,6 +2488,10 @@ void ReInitAllWindows()
|
|||
FOR_ALL_WINDOWS_FROM_BACK(w) {
|
||||
w->ReInit();
|
||||
}
|
||||
#ifdef ENABLE_NETWORK
|
||||
void NetworkReInitChatBoxSize();
|
||||
NetworkReInitChatBoxSize();
|
||||
#endif
|
||||
|
||||
/* Make sure essential parts of all windows are visible */
|
||||
RelocateAllWindows(_cur_resolution.width, _cur_resolution.height);
|
||||
|
|
Loading…
Reference in New Issue