# HG changeset patch # User rubidium # Date 1183039119 0 # Node ID d5923d3fa08c88b8b2b01e3090a2e8b5e69dd4f1 # Parent 799cfac4b99fad5c0acd8225ee7072dceac550b5 (svn r10372) [0.5] -Backport from trunk (r10288, r10290, r10293, r10294, r10295, r10347, r10348): - Feature: Make the client list window (for network games) stickyable (r10293) - Fix: Smooth economy did not close primary industries and it allowed increasing of production of industries that should not have rising productions (r10290, r10347, r10348) - Fix: Flush the output of the dedicated server console (r10295) - Fix: The "pause" key did not work in the scenario editor (r10294) - Fix: Age non-front engines too (so when you move engines around in the depot they do not get age 0 when they are much older [FS#202] (r10288) diff -r 799cfac4b99f -r d5923d3fa08c console.c --- a/console.c Sun Jun 24 18:26:50 2007 +0000 +++ b/console.c Thu Jun 28 13:58:39 2007 +0000 @@ -385,7 +385,8 @@ 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 -r 799cfac4b99f -r d5923d3fa08c industry_cmd.c --- a/industry_cmd.c Sun Jun 24 18:26:50 2007 +0000 +++ b/industry_cmd.c Thu Jun 28 13:58:39 2007 +0000 @@ -1615,13 +1615,16 @@ 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 @@ 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 -r 799cfac4b99f -r d5923d3fa08c main_gui.c --- a/main_gui.c Sun Jun 24 18:26:50 2007 +0000 +++ b/main_gui.c Thu Jun 28 13:58:39 2007 +0000 @@ -1805,7 +1805,7 @@ 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 @@ 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 @@ 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 -r 799cfac4b99f -r d5923d3fa08c network_gui.c --- a/network_gui.c Sun Jun 24 18:26:50 2007 +0000 +++ b/network_gui.c Thu Jun 28 13:58:39 2007 +0000 @@ -1033,7 +1033,8 @@ 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 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 @@ 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 -r 799cfac4b99f -r d5923d3fa08c train_cmd.c --- a/train_cmd.c Sun Jun 24 18:26:50 2007 +0000 +++ b/train_cmd.c Thu Jun 28 13:58:39 2007 +0000 @@ -3675,6 +3675,9 @@ InvalidateWindow(WC_VEHICLE_DETAILS, v->index); InvalidateWindowClasses(WC_TRAINS_LIST); } + } else if (IsTrainEngine(v)) { + /* Also age engines that aren't front engines */ + AgeVehicle(v); } }