src/player_gui.cpp
changeset 9115 47ae980bace3
parent 9111 48ce04029fe4
child 9116 f2491d3c321b
equal deleted inserted replaced
9114:032218c1235b 9115:47ae980bace3
   195 					bool stickied = !!(w->flags4 & WF_STICKY);
   195 					bool stickied = !!(w->flags4 & WF_STICKY);
   196 					int oldtop = w->top;   ///< current top position of the window before closing it
   196 					int oldtop = w->top;   ///< current top position of the window before closing it
   197 					int oldleft = w->left; ///< current left position of the window before closing it
   197 					int oldleft = w->left; ///< current left position of the window before closing it
   198 					PlayerID player = (PlayerID)w->window_number;
   198 					PlayerID player = (PlayerID)w->window_number;
   199 
   199 
   200 					DeleteWindow(w);
   200 					delete w;
   201 					/* Open up the (toggled size) Finance window at the same position as the previous */
   201 					/* Open up the (toggled size) Finance window at the same position as the previous */
   202 					DoShowPlayerFinances(player, !HasBit(mode, 0), stickied, oldtop, oldleft);
   202 					DoShowPlayerFinances(player, !HasBit(mode, 0), stickied, oldtop, oldleft);
   203 				}
   203 				}
   204 				break;
   204 				break;
   205 
   205 
   869 				case PFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON: {
   869 				case PFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON: {
   870 					int oldtop = w->top;     ///< current top position of the window before closing it
   870 					int oldtop = w->top;     ///< current top position of the window before closing it
   871 					int oldleft = w->left;   ///< current top position of the window before closing it
   871 					int oldleft = w->left;   ///< current top position of the window before closing it
   872 
   872 
   873 					DoCommandP(0, 0, *pf, NULL, CMD_SET_PLAYER_FACE);
   873 					DoCommandP(0, 0, *pf, NULL, CMD_SET_PLAYER_FACE);
   874 					DeleteWindow(w);
   874 					delete w;
   875 					/* Open up the (toggled size) Face selection window at the same position as the previous */
   875 					/* Open up the (toggled size) Face selection window at the same position as the previous */
   876 					DoSelectPlayerFace((PlayerID)w->window_number, !WP(w, facesel_d).advanced, oldtop, oldleft);
   876 					DoSelectPlayerFace((PlayerID)w->window_number, !WP(w, facesel_d).advanced, oldtop, oldleft);
   877 				} break;
   877 				} break;
   878 
   878 
   879 				/* Cancel button */
   879 				/* Cancel button */
   880 				case PFW_WIDGET_CANCEL:
   880 				case PFW_WIDGET_CANCEL:
   881 					DeleteWindow(w);
   881 					delete w;
   882 					break;
   882 					break;
   883 
   883 
   884 				/* OK button */
   884 				/* OK button */
   885 				case PFW_WIDGET_ACCEPT:
   885 				case PFW_WIDGET_ACCEPT:
   886 					DoCommandP(0, 0, *pf, NULL, CMD_SET_PLAYER_FACE);
   886 					DoCommandP(0, 0, *pf, NULL, CMD_SET_PLAYER_FACE);
   887 					DeleteWindow(w);
   887 					delete w;
   888 					break;
   888 					break;
   889 
   889 
   890 				/* Load button */
   890 				/* Load button */
   891 				case PFW_WIDGET_LOAD:
   891 				case PFW_WIDGET_LOAD:
   892 					*pf = _player_face;
   892 					*pf = _player_face;
  1377 		} break;
  1377 		} break;
  1378 
  1378 
  1379 		case WE_CLICK:
  1379 		case WE_CLICK:
  1380 			switch (e->we.click.widget) {
  1380 			switch (e->we.click.widget) {
  1381 				case 3:
  1381 				case 3:
  1382 					DeleteWindow(w);
  1382 					delete w;
  1383 					break;
  1383 					break;
  1384 				case 4: {
  1384 				case 4: {
  1385 					DoCommandP(0, w->window_number, 0, NULL, CMD_BUY_COMPANY | CMD_MSG(STR_7060_CAN_T_BUY_COMPANY));
  1385 					DoCommandP(0, w->window_number, 0, NULL, CMD_BUY_COMPANY | CMD_MSG(STR_7060_CAN_T_BUY_COMPANY));
  1386 					break;
  1386 					break;
  1387 				}
  1387 				}
  1462 				DrawStringMultiCenter(x + (640 / 2), y + 157, STR_021B_ACHIEVES_STATUS, 640);
  1462 				DrawStringMultiCenter(x + (640 / 2), y + 157, STR_021B_ACHIEVES_STATUS, 640);
  1463 			}
  1463 			}
  1464 		} break;
  1464 		} break;
  1465 
  1465 
  1466 		case WE_CLICK: /* Close the window (and show the highscore window) */
  1466 		case WE_CLICK: /* Close the window (and show the highscore window) */
  1467 			DeleteWindow(w);
  1467 			delete w;
  1468 			break;
  1468 			break;
  1469 
  1469 
  1470 		case WE_DESTROY: /* Show the highscore window when this one is closed */
  1470 		case WE_DESTROY: /* Show the highscore window when this one is closed */
  1471 			if (!_networking) DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // unpause
  1471 			if (!_networking) DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // unpause
  1472 			ShowHighscoreTable(w->window_number, WP(w, highscore_d).rank);
  1472 			ShowHighscoreTable(w->window_number, WP(w, highscore_d).rank);
  1503 				}
  1503 				}
  1504 			}
  1504 			}
  1505 		} break;
  1505 		} break;
  1506 
  1506 
  1507 		case WE_CLICK: /* Onclick to close window, and in destroy event handle the rest */
  1507 		case WE_CLICK: /* Onclick to close window, and in destroy event handle the rest */
  1508 			DeleteWindow(w);
  1508 			delete w;
  1509 			break;
  1509 			break;
  1510 
  1510 
  1511 		case WE_DESTROY: /* Get back all the hidden windows */
  1511 		case WE_DESTROY: /* Get back all the hidden windows */
  1512 			if (_game_mode != GM_MENU) ShowVitalWindows();
  1512 			if (_game_mode != GM_MENU) ShowVitalWindows();
  1513 
  1513