equal
deleted
inserted
replaced
11 #include "newgrf.h" |
11 #include "newgrf.h" |
12 #include "saveload.h" |
12 #include "saveload.h" |
13 #include "strings.h" |
13 #include "strings.h" |
14 #include "table/sprites.h" |
14 #include "table/sprites.h" |
15 #include "table/strings.h" |
15 #include "table/strings.h" |
|
16 #include "strings.h" |
16 #include "table/tree_land.h" |
17 #include "table/tree_land.h" |
17 #include "map.h" |
18 #include "map.h" |
18 #include "window.h" |
19 #include "window.h" |
19 #include "gui.h" |
20 #include "gui.h" |
20 #include "viewport.h" |
21 #include "viewport.h" |
498 |
499 |
499 static void ErrmsgWndProc(Window *w, WindowEvent *e) |
500 static void ErrmsgWndProc(Window *w, WindowEvent *e) |
500 { |
501 { |
501 switch (e->event) { |
502 switch (e->event) { |
502 case WE_PAINT: |
503 case WE_PAINT: |
503 COPY_IN_DPARAM(0, _errmsg_decode_params, lengthof(_errmsg_decode_params)); |
504 CopyInDParam(0, _errmsg_decode_params, lengthof(_errmsg_decode_params)); |
504 DrawWindowWidgets(w); |
505 DrawWindowWidgets(w); |
505 COPY_IN_DPARAM(0, _errmsg_decode_params, lengthof(_errmsg_decode_params)); |
506 CopyInDParam(0, _errmsg_decode_params, lengthof(_errmsg_decode_params)); |
506 if (!IsWindowOfPrototype(w, _errmsg_face_widgets)) { |
507 if (!IsWindowOfPrototype(w, _errmsg_face_widgets)) { |
507 DrawStringMultiCenter( |
508 DrawStringMultiCenter( |
508 120, |
509 120, |
509 (_errmsg_message_1 == INVALID_STRING_ID ? 25 : 15), |
510 (_errmsg_message_1 == INVALID_STRING_ID ? 25 : 15), |
510 _errmsg_message_2, |
511 _errmsg_message_2, |
567 //assert(msg_2); |
568 //assert(msg_2); |
568 if (msg_2 == 0) msg_2 = STR_EMPTY; |
569 if (msg_2 == 0) msg_2 = STR_EMPTY; |
569 |
570 |
570 _errmsg_message_1 = msg_1; |
571 _errmsg_message_1 = msg_1; |
571 _errmsg_message_2 = msg_2; |
572 _errmsg_message_2 = msg_2; |
572 COPY_OUT_DPARAM(_errmsg_decode_params, 0, lengthof(_errmsg_decode_params)); |
573 CopyOutDParam(_errmsg_decode_params, 0, lengthof(_errmsg_decode_params)); |
573 _errmsg_duration = _patches.errmsg_duration; |
574 _errmsg_duration = _patches.errmsg_duration; |
574 if (!_errmsg_duration) return; |
575 if (!_errmsg_duration) return; |
575 |
576 |
576 if (_errmsg_message_1 != STR_013B_OWNED_BY || GetDParamX(_errmsg_decode_params,2) >= 8) { |
577 if (_errmsg_message_1 != STR_013B_OWNED_BY || GetDParamX(_errmsg_decode_params,2) >= 8) { |
577 |
578 |
1233 { |
1234 { |
1234 query_d *q = &WP(w, query_d); |
1235 query_d *q = &WP(w, query_d); |
1235 |
1236 |
1236 switch (e->event) { |
1237 switch (e->event) { |
1237 case WE_PAINT: |
1238 case WE_PAINT: |
1238 COPY_IN_DPARAM(0, q->params, lengthof(q->params)); |
1239 CopyInDParam(0, q->params, lengthof(q->params)); |
1239 DrawWindowWidgets(w); |
1240 DrawWindowWidgets(w); |
1240 COPY_IN_DPARAM(0, q->params, lengthof(q->params)); |
1241 CopyInDParam(0, q->params, lengthof(q->params)); |
1241 |
1242 |
1242 DrawStringMultiCenter(w->width / 2, (w->height / 2) - 10, q->message, w->width - 2); |
1243 DrawStringMultiCenter(w->width / 2, (w->height / 2) - 10, q->message, w->width - 2); |
1243 break; |
1244 break; |
1244 |
1245 |
1245 case WE_CLICK: |
1246 case WE_CLICK: |
1313 w->left = parent->left + (parent->width / 2) - (w->width / 2); |
1314 w->left = parent->left + (parent->width / 2) - (w->width / 2); |
1314 w->top = parent->top + (parent->height / 2) - (w->height / 2); |
1315 w->top = parent->top + (parent->height / 2) - (w->height / 2); |
1315 |
1316 |
1316 /* Create a backup of the variadic arguments to strings because it will be |
1317 /* Create a backup of the variadic arguments to strings because it will be |
1317 * overridden pretty often. We will copy these back for drawing */ |
1318 * overridden pretty often. We will copy these back for drawing */ |
1318 COPY_OUT_DPARAM(WP(w, query_d).params, 0, lengthof(WP(w, query_d).params)); |
1319 CopyOutDParam(WP(w, query_d).params, 0, lengthof(WP(w, query_d).params)); |
1319 w->widget[QUERY_WIDGET_CAPTION].data = caption; |
1320 w->widget[QUERY_WIDGET_CAPTION].data = caption; |
1320 WP(w, query_d).message = message; |
1321 WP(w, query_d).message = message; |
1321 WP(w, query_d).proc = callback; |
1322 WP(w, query_d).proc = callback; |
1322 WP(w, query_d).calledback = false; |
1323 WP(w, query_d).calledback = false; |
1323 } |
1324 } |