src/misc_gui.cpp
changeset 7750 7afbef1235e0
parent 7521 0da1e91510e4
child 7824 5a63d41b59ea
equal deleted inserted replaced
7749:3ed7d92bd966 7750:7afbef1235e0
     7 #include "heightmap.h"
     7 #include "heightmap.h"
     8 #include "debug.h"
     8 #include "debug.h"
     9 #include "functions.h"
     9 #include "functions.h"
    10 #include "landscape.h"
    10 #include "landscape.h"
    11 #include "newgrf.h"
    11 #include "newgrf.h"
       
    12 #include "newgrf_text.h"
    12 #include "saveload.h"
    13 #include "saveload.h"
    13 #include "strings.h"
    14 #include "strings.h"
    14 #include "table/sprites.h"
    15 #include "table/sprites.h"
    15 #include "table/strings.h"
    16 #include "table/strings.h"
    16 #include "strings.h"
    17 #include "strings.h"
   503 	switch (e->event) {
   504 	switch (e->event) {
   504 	case WE_PAINT:
   505 	case WE_PAINT:
   505 		CopyInDParam(0, _errmsg_decode_params, lengthof(_errmsg_decode_params));
   506 		CopyInDParam(0, _errmsg_decode_params, lengthof(_errmsg_decode_params));
   506 		DrawWindowWidgets(w);
   507 		DrawWindowWidgets(w);
   507 		CopyInDParam(0, _errmsg_decode_params, lengthof(_errmsg_decode_params));
   508 		CopyInDParam(0, _errmsg_decode_params, lengthof(_errmsg_decode_params));
       
   509 
       
   510 		/* If the error message comes from a NewGRF, we must use the text ref. stack reserved for error messages.
       
   511 		 * If the message doesn't come from a NewGRF, it won't use the TTDP-style text ref. stack, so we won't hurt anything
       
   512 		 */
       
   513 		SwitchToErrorRefStack();
       
   514 		RewindTextRefStack();
       
   515 
   508 		if (!IsWindowOfPrototype(w, _errmsg_face_widgets)) {
   516 		if (!IsWindowOfPrototype(w, _errmsg_face_widgets)) {
   509 			DrawStringMultiCenter(
   517 			DrawStringMultiCenter(
   510 				120,
   518 				120,
   511 				(_errmsg_message_1 == INVALID_STRING_ID ? 25 : 15),
   519 				(_errmsg_message_1 == INVALID_STRING_ID ? 25 : 15),
   512 				_errmsg_message_2,
   520 				_errmsg_message_2,
   531 					214,
   539 					214,
   532 					90,
   540 					90,
   533 					_errmsg_message_1,
   541 					_errmsg_message_1,
   534 					w->width - 2);
   542 					w->width - 2);
   535 		}
   543 		}
       
   544 
       
   545 		/* Switch back to the normal text ref. stack for NewGRF texts */
       
   546 		SwitchToNormalRefStack();
   536 		break;
   547 		break;
   537 
   548 
   538 	case WE_MOUSELOOP:
   549 	case WE_MOUSELOOP:
   539 		if (_right_button_down) DeleteWindow(w);
   550 		if (_right_button_down) DeleteWindow(w);
   540 		break;
   551 		break;