1
0
Fork 0

(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)
release/0.5
rubidium 2007-06-28 13:58:39 +00:00
parent 10b6fc898b
commit a6c7987a43
5 changed files with 23 additions and 15 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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;

View File

@ -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;

View File

@ -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);
}
}