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); str_validate(str);
if (_network_dedicated) { if (_network_dedicated) {
printf("%s\n", str); fprintf(stdout, "%s\n", str);
fflush(stdout);
IConsoleWriteToLogFile(str); IConsoleWriteToLogFile(str);
free(str); // free duplicated string since it's not used anymore free(str); // free duplicated string since it's not used anymore
return; return;

View File

@ -1615,13 +1615,16 @@ static void ExtChangeIndustryProduction(Industry *i)
int mag; int mag;
new = old = i->production_rate[j]; new = old = i->production_rate[j];
if (CHANCE16I(20, 1024, r)) if (CHANCE16I(20, 1024, r)) new -= max(((RandomRange(50) + 10) * old) >> 8, 1U);
new -= ((RandomRange(50) + 10) * old) >> 8; /* Chance of increasing becomes better when more is transported */
if (CHANCE16I(20 + (i->pct_transported[j] * 20 >> 8), 1024, r >> 16)) if (CHANCE16I(20 + (i->pct_transported[j] * 20 >> 8), 1024, r >> 16) &&
new += ((RandomRange(50) + 10) * old) >> 8; i->type != IT_OIL_WELL) {
new += max(((RandomRange(50) + 10) * old) >> 8, 1U);
}
new = clamp(new, 0, 255); new = clamp(new, 1, 255);
if (new == old) { /* Do not stop closing the industry when it has the lowest possible production rate */
if (new == old && old > 1) {
closeit = false; closeit = false;
continue; continue;
} }
@ -1629,8 +1632,8 @@ static void ExtChangeIndustryProduction(Industry *i)
percent = new * 100 / old - 100; percent = new * 100 / old - 100;
i->production_rate[j] = new; i->production_rate[j] = new;
if (new >= indspec->production_rate[j] / 4) /* Close the industry when it has the lowest possible production rate */
closeit = false; if (new > 1) closeit = false;
mag = abs(percent); mag = abs(percent);
if (mag >= 10) { if (mag >= 10) {

View File

@ -2012,7 +2012,7 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e)
case WE_KEYPRESS: case WE_KEYPRESS:
switch (e->we.keypress.keycode) { 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_F2: ShowGameOptions(); break;
case WKC_F3: MenuClickSaveLoad(0); break; case WKC_F3: MenuClickSaveLoad(0); break;
case WKC_F4: ToolbarScenGenLand(w); break; case WKC_F4: ToolbarScenGenLand(w); break;

View File

@ -1033,7 +1033,8 @@ enum {
static const Widget _client_list_widgets[] = { static const Widget _client_list_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, { 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}, { WWT_PANEL, RESIZE_NONE, 14, 0, 249, 14, 14 + CLNWND_ROWSIZE + 1, 0x0, STR_NULL},
{ WIDGETS_END}, { WIDGETS_END},
@ -1047,7 +1048,7 @@ static const Widget _client_list_popup_widgets[] = {
static WindowDesc _client_list_desc = { static WindowDesc _client_list_desc = {
WDP_AUTO, WDP_AUTO, 250, 1, WDP_AUTO, WDP_AUTO, 250, 1,
WC_CLIENT_LIST,0, 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, _client_list_widgets,
ClientListWndProc ClientListWndProc
}; };
@ -1143,7 +1144,7 @@ static bool CheckClientListHeight(Window *w)
if (w->height != CLNWND_OFFSET + num + 1) { if (w->height != CLNWND_OFFSET + num + 1) {
// XXX - magic unfortunately; (num + 2) has to be one bigger than heigh (num + 1) // XXX - magic unfortunately; (num + 2) has to be one bigger than heigh (num + 1)
SetWindowDirty(w); 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; w->height = CLNWND_OFFSET + num + 1;
SetWindowDirty(w); SetWindowDirty(w);
return false; return false;

View File

@ -3675,6 +3675,9 @@ void OnNewDay_Train(Vehicle *v)
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
InvalidateWindowClasses(WC_TRAINS_LIST); InvalidateWindowClasses(WC_TRAINS_LIST);
} }
} else if (IsTrainEngine(v)) {
/* Also age engines that aren't front engines */
AgeVehicle(v);
} }
} }