diff --git a/console.c b/console.c index b08fb74866..8bbde307ef 100644 --- a/console.c +++ b/console.c @@ -385,7 +385,8 @@ void IConsolePrint(uint16 color_code, const char *string) str_validate(str); if (_network_dedicated) { - printf("%s\n", str); + fprintf(stdout, "%s\n", str); + fflush(stdout); IConsoleWriteToLogFile(str); free(str); // free duplicated string since it's not used anymore return; diff --git a/industry_cmd.c b/industry_cmd.c index f01b8f693c..023d1ec6a7 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -1615,13 +1615,16 @@ static void ExtChangeIndustryProduction(Industry *i) int mag; new = old = i->production_rate[j]; - if (CHANCE16I(20, 1024, r)) - new -= ((RandomRange(50) + 10) * old) >> 8; - if (CHANCE16I(20 + (i->pct_transported[j] * 20 >> 8), 1024, r >> 16)) - new += ((RandomRange(50) + 10) * old) >> 8; + if (CHANCE16I(20, 1024, r)) new -= max(((RandomRange(50) + 10) * old) >> 8, 1U); + /* Chance of increasing becomes better when more is transported */ + if (CHANCE16I(20 + (i->pct_transported[j] * 20 >> 8), 1024, r >> 16) && + i->type != IT_OIL_WELL) { + new += max(((RandomRange(50) + 10) * old) >> 8, 1U); + } - new = clamp(new, 0, 255); - if (new == old) { + new = clamp(new, 1, 255); + /* Do not stop closing the industry when it has the lowest possible production rate */ + if (new == old && old > 1) { closeit = false; continue; } @@ -1629,8 +1632,8 @@ static void ExtChangeIndustryProduction(Industry *i) percent = new * 100 / old - 100; i->production_rate[j] = new; - if (new >= indspec->production_rate[j] / 4) - closeit = false; + /* Close the industry when it has the lowest possible production rate */ + if (new > 1) closeit = false; mag = abs(percent); if (mag >= 10) { diff --git a/main_gui.c b/main_gui.c index 11d08ea6cd..1f6876891a 100644 --- a/main_gui.c +++ b/main_gui.c @@ -1805,7 +1805,7 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e) case WKC_F7: ShowPlayerStations(_local_player); break; case WKC_F8: ShowPlayerFinances(_local_player); break; case WKC_F9: ShowPlayerCompany(_local_player); break; - case WKC_F10:ShowOperatingProfitGraph(); break; + case WKC_F10: ShowOperatingProfitGraph(); break; case WKC_F11: ShowCompanyLeagueTable(); break; case WKC_F12: ShowBuildIndustryWindow(); break; case WKC_SHIFT | WKC_F1: ShowVehicleListWindow(_local_player, INVALID_STATION, VEH_Train); break; @@ -1817,7 +1817,7 @@ static void MainToolbarWndProc(Window *w, WindowEvent *e) case WKC_SHIFT | WKC_F7: ShowBuildRailToolbar(_last_built_railtype, -1); break; case WKC_SHIFT | WKC_F8: ShowBuildRoadToolbar(); break; case WKC_SHIFT | WKC_F9: ShowBuildDocksToolbar(); break; - case WKC_SHIFT | WKC_F10:ShowBuildAirToolbar(); break; + case WKC_SHIFT | WKC_F10: ShowBuildAirToolbar(); break; case WKC_SHIFT | WKC_F11: ShowBuildTreesToolbar(); break; case WKC_SHIFT | WKC_F12: ShowMusicWindow(); break; case WKC_CTRL | 'S': MenuClickSmallScreenshot(); break; @@ -2012,7 +2012,7 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e) case WE_KEYPRESS: switch (e->we.keypress.keycode) { - case WKC_F1: ToolbarPauseClick(w); break; + case WKC_F1: case WKC_PAUSE: ToolbarPauseClick(w); break; case WKC_F2: ShowGameOptions(); break; case WKC_F3: MenuClickSaveLoad(0); break; case WKC_F4: ToolbarScenGenLand(w); break; diff --git a/network_gui.c b/network_gui.c index e50c6941e7..125c701320 100644 --- a/network_gui.c +++ b/network_gui.c @@ -1033,7 +1033,8 @@ enum { static const Widget _client_list_widgets[] = { { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, -{ WWT_CAPTION, RESIZE_NONE, 14, 11, 249, 0, 13, STR_NETWORK_CLIENT_LIST, STR_018C_WINDOW_TITLE_DRAG_THIS}, +{ WWT_CAPTION, RESIZE_NONE, 14, 11, 237, 0, 13, STR_NETWORK_CLIENT_LIST, STR_018C_WINDOW_TITLE_DRAG_THIS}, +{ WWT_STICKYBOX, RESIZE_NONE, 14, 238, 249, 0, 13, STR_NULL, STR_STICKY_BUTTON}, { WWT_PANEL, RESIZE_NONE, 14, 0, 249, 14, 14 + CLNWND_ROWSIZE + 1, 0x0, STR_NULL}, { WIDGETS_END}, @@ -1047,7 +1048,7 @@ static const Widget _client_list_popup_widgets[] = { static WindowDesc _client_list_desc = { WDP_AUTO, WDP_AUTO, 250, 1, WC_CLIENT_LIST,0, - WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, + WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _client_list_widgets, ClientListWndProc }; @@ -1143,7 +1144,7 @@ static bool CheckClientListHeight(Window *w) if (w->height != CLNWND_OFFSET + num + 1) { // XXX - magic unfortunately; (num + 2) has to be one bigger than heigh (num + 1) SetWindowDirty(w); - w->widget[2].bottom = w->widget[2].top + num + 2; + w->widget[3].bottom = w->widget[3].top + num + 2; w->height = CLNWND_OFFSET + num + 1; SetWindowDirty(w); return false; diff --git a/train_cmd.c b/train_cmd.c index 164cc66fa0..59a610b227 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -3675,6 +3675,9 @@ void OnNewDay_Train(Vehicle *v) InvalidateWindow(WC_VEHICLE_DETAILS, v->index); InvalidateWindowClasses(WC_TRAINS_LIST); } + } else if (IsTrainEngine(v)) { + /* Also age engines that aren't front engines */ + AgeVehicle(v); } }