src/player_gui.cpp
branchNewGRF_ports
changeset 10184 fcf5fb2548eb
parent 6878 7d1ff2f621c7
child 10210 a2131f7a315d
equal deleted inserted replaced
10179:eec5a7dcbf61 10184:fcf5fb2548eb
    38 	PlayerFace face; // player face bits
    38 	PlayerFace face; // player face bits
    39 	bool advanced;   // advance player face selection window
    39 	bool advanced;   // advance player face selection window
    40 };
    40 };
    41 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(facesel_d));
    41 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(facesel_d));
    42 
    42 
    43 static void DoShowPlayerFinances(PlayerID player, bool show_small, bool show_stickied);
    43 enum {
    44 static void DoSelectPlayerFace(PlayerID player, bool show_big);
    44 	FIRST_GUI_CALL = INT_MAX,  ///< default value to specify thuis is the first call of the resizable gui
       
    45 };
       
    46 
       
    47 static void DoShowPlayerFinances(PlayerID player, bool show_small, bool show_stickied, int top = FIRST_GUI_CALL, int left = FIRST_GUI_CALL);
       
    48 static void DoSelectPlayerFace(PlayerID player, bool show_big, int top =  FIRST_GUI_CALL, int left = FIRST_GUI_CALL);
    45 
    49 
    46 static void DrawPlayerEconomyStats(const Player *p, byte mode)
    50 static void DrawPlayerEconomyStats(const Player *p, byte mode)
    47 {
    51 {
    48 	int x, y, i, j, year;
    52 	int x, y, i, j, year;
    49 	const Money (*tbl)[EXPENSES_END];
    53 	const Money (*tbl)[EXPENSES_END];
   151 
   155 
   152 
   156 
   153 static void PlayerFinancesWndProc(Window *w, WindowEvent *e)
   157 static void PlayerFinancesWndProc(Window *w, WindowEvent *e)
   154 {
   158 {
   155 	switch (e->event) {
   159 	switch (e->event) {
   156 	case WE_PAINT: {
   160 		case WE_PAINT: {
   157 		PlayerID player = (PlayerID)w->window_number;
       
   158 		const Player *p = GetPlayer(player);
       
   159 
       
   160 		/* Recheck the size of the window as it might need to be resized due to the local player changing */
       
   161 		int new_height = ((player != _local_player) ? 0 : 12) + ((WP(w, def_d).data_1 != 0) ? 48 : 204);
       
   162 		if (w->height != new_height) {
       
   163 			/* Make window dirty before and after resizing */
       
   164 			SetWindowDirty(w);
       
   165 			w->height = new_height;
       
   166 			SetWindowDirty(w);
       
   167 
       
   168 			w->SetWidgetHiddenState(PFW_WIDGET_INCREASE_LOAN, player != _local_player);
       
   169 			w->SetWidgetHiddenState(PFW_WIDGET_REPAY_LOAN,    player != _local_player);
       
   170 		}
       
   171 
       
   172 		/* Borrow button only shows when there is any more money to loan */
       
   173 		w->SetWidgetDisabledState(PFW_WIDGET_INCREASE_LOAN, p->current_loan == _economy.max_loan);
       
   174 
       
   175 		/* Repay button only shows when there is any more money to repay */
       
   176 		w->SetWidgetDisabledState(PFW_WIDGET_REPAY_LOAN, player != _local_player || p->current_loan == 0);
       
   177 
       
   178 		SetDParam(0, p->index);
       
   179 		SetDParam(1, p->index);
       
   180 		SetDParam(2, LOAN_INTERVAL);
       
   181 		DrawWindowWidgets(w);
       
   182 
       
   183 		DrawPlayerEconomyStats(p, (byte)WP(w, def_d).data_1);
       
   184 	} break;
       
   185 
       
   186 	case WE_CLICK:
       
   187 		switch (e->we.click.widget) {
       
   188 		case PFW_WIDGET_TOGGLE_SIZE: {/* toggle size */
       
   189 			byte mode = (byte)WP(w, def_d).data_1;
       
   190 			bool stickied = !!(w->flags4 & WF_STICKY);
       
   191 			PlayerID player = (PlayerID)w->window_number;
   161 			PlayerID player = (PlayerID)w->window_number;
   192 			DeleteWindow(w);
   162 			const Player *p = GetPlayer(player);
   193 			DoShowPlayerFinances(player, !HasBit(mode, 0), stickied);
   163 
       
   164 			/* Recheck the size of the window as it might need to be resized due to the local player changing */
       
   165 			int new_height = ((player != _local_player) ? 0 : 12) + ((WP(w, def_d).data_1 != 0) ? 48 : 204);
       
   166 			if (w->height != new_height) {
       
   167 				/* Make window dirty before and after resizing */
       
   168 				SetWindowDirty(w);
       
   169 				w->height = new_height;
       
   170 				SetWindowDirty(w);
       
   171 
       
   172 				w->SetWidgetHiddenState(PFW_WIDGET_INCREASE_LOAN, player != _local_player);
       
   173 				w->SetWidgetHiddenState(PFW_WIDGET_REPAY_LOAN,    player != _local_player);
       
   174 			}
       
   175 
       
   176 			/* Borrow button only shows when there is any more money to loan */
       
   177 			w->SetWidgetDisabledState(PFW_WIDGET_INCREASE_LOAN, p->current_loan == _economy.max_loan);
       
   178 
       
   179 			/* Repay button only shows when there is any more money to repay */
       
   180 			w->SetWidgetDisabledState(PFW_WIDGET_REPAY_LOAN, player != _local_player || p->current_loan == 0);
       
   181 
       
   182 			SetDParam(0, p->index);
       
   183 			SetDParam(1, p->index);
       
   184 			SetDParam(2, LOAN_INTERVAL);
       
   185 			DrawWindowWidgets(w);
       
   186 
       
   187 			DrawPlayerEconomyStats(p, (byte)WP(w, def_d).data_1);
   194 		} break;
   188 		} break;
   195 
   189 
   196 		case PFW_WIDGET_INCREASE_LOAN: /* increase loan */
   190 		case WE_CLICK:
   197 			DoCommandP(0, 0, _ctrl_pressed, NULL, CMD_INCREASE_LOAN | CMD_MSG(STR_702C_CAN_T_BORROW_ANY_MORE_MONEY));
   191 			switch (e->we.click.widget) {
   198 			break;
   192 				case PFW_WIDGET_TOGGLE_SIZE: {/* toggle size */
   199 
   193 					byte mode = (byte)WP(w, def_d).data_1;
   200 		case PFW_WIDGET_REPAY_LOAN: /* repay loan */
   194 					bool stickied = !!(w->flags4 & WF_STICKY);
   201 			DoCommandP(0, 0, _ctrl_pressed, NULL, CMD_DECREASE_LOAN | CMD_MSG(STR_702F_CAN_T_REPAY_LOAN));
   195 					int oldtop = w->top;   ///< current top position of the window before closing it
   202 			break;
   196 					int oldleft = w->left; ///< current left position of the window before closing it
   203 		}
   197 					PlayerID player = (PlayerID)w->window_number;
   204 		break;
   198 
       
   199 					DeleteWindow(w);
       
   200 					/* Open up the (toggled size) Finance window at the same position as the previous */
       
   201 					DoShowPlayerFinances(player, !HasBit(mode, 0), stickied, oldtop, oldleft);
       
   202 				}
       
   203 				break;
       
   204 
       
   205 				case PFW_WIDGET_INCREASE_LOAN: /* increase loan */
       
   206 					DoCommandP(0, 0, _ctrl_pressed, NULL, CMD_INCREASE_LOAN | CMD_MSG(STR_702C_CAN_T_BORROW_ANY_MORE_MONEY));
       
   207 					break;
       
   208 
       
   209 				case PFW_WIDGET_REPAY_LOAN: /* repay loan */
       
   210 					DoCommandP(0, 0, _ctrl_pressed, NULL, CMD_DECREASE_LOAN | CMD_MSG(STR_702F_CAN_T_REPAY_LOAN));
       
   211 					break;
       
   212 			}
       
   213 			break;
   205 	}
   214 	}
   206 }
   215 }
   207 
   216 
   208 static const WindowDesc _player_finances_desc = {
   217 static const WindowDesc _player_finances_desc = {
   209 	WDP_AUTO, WDP_AUTO, 407, 216, 407, 216,
   218 	WDP_AUTO, WDP_AUTO, 407, 216, 407, 216,
   219 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
   228 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
   220 	_player_finances_small_widgets,
   229 	_player_finances_small_widgets,
   221 	PlayerFinancesWndProc
   230 	PlayerFinancesWndProc
   222 };
   231 };
   223 
   232 
   224 static void DoShowPlayerFinances(PlayerID player, bool show_small, bool show_stickied)
   233 /**
       
   234  * Open the small/large finance window of the player
       
   235  *
       
   236  * @param player         the player who's finances are requested to be seen
       
   237  * @param show_small     show large or small version opf the window
       
   238  * @param show_stickied  previous "stickyness" of the window
       
   239  * @param top            previous top position of the window
       
   240  * @param left           previous left position of the window
       
   241  *
       
   242  * @pre is player a valid player
       
   243  */
       
   244 static void DoShowPlayerFinances(PlayerID player, bool show_small, bool show_stickied, int top, int left)
   225 {
   245 {
   226 	if (!IsValidPlayer(player)) return;
   246 	if (!IsValidPlayer(player)) return;
   227 
   247 
   228 	Window *w = AllocateWindowDescFront(show_small ? &_player_finances_small_desc : &_player_finances_desc, player);
   248 	Window *w = AllocateWindowDescFront(show_small ? &_player_finances_small_desc : &_player_finances_desc, player);
   229 	if (w != NULL) {
   249 	if (w != NULL) {
   230 		w->caption_color = w->window_number;
   250 		w->caption_color = w->window_number;
   231 		WP(w, def_d).data_1 = show_small;
   251 		WP(w, def_d).data_1 = show_small;
       
   252 
   232 		if (show_stickied) w->flags4 |= WF_STICKY;
   253 		if (show_stickied) w->flags4 |= WF_STICKY;
       
   254 
       
   255 		/* Check if repositioning from default is required */
       
   256 		if (top != FIRST_GUI_CALL && left != FIRST_GUI_CALL) {
       
   257 			w->top = top;
       
   258 			w->left = left;
       
   259 		}
   233 	}
   260 	}
   234 }
   261 }
   235 
   262 
   236 void ShowPlayerFinances(PlayerID player)
   263 void ShowPlayerFinances(PlayerID player)
   237 {
   264 {
   809 
   836 
   810 		case WE_CLICK:
   837 		case WE_CLICK:
   811 			switch (e->we.click.widget) {
   838 			switch (e->we.click.widget) {
   812 				/* Toggle size, advanced/simple face selection */
   839 				/* Toggle size, advanced/simple face selection */
   813 				case PFW_WIDGET_TOGGLE_LARGE_SMALL:
   840 				case PFW_WIDGET_TOGGLE_LARGE_SMALL:
   814 				case PFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON:
   841 				case PFW_WIDGET_TOGGLE_LARGE_SMALL_BUTTON: {
       
   842 					int oldtop = w->top;     ///< current top position of the window before closing it
       
   843 					int oldleft = w->left;   ///< current top position of the window before closing it
       
   844 
   815 					DoCommandP(0, 0, *pf, NULL, CMD_SET_PLAYER_FACE);
   845 					DoCommandP(0, 0, *pf, NULL, CMD_SET_PLAYER_FACE);
   816 					DeleteWindow(w);
   846 					DeleteWindow(w);
   817 					DoSelectPlayerFace((PlayerID)w->window_number, !WP(w, facesel_d).advanced);
   847 					/* Open up the (toggled size) Face selection window at the same position as the previous */
   818 					break;
   848 					DoSelectPlayerFace((PlayerID)w->window_number, !WP(w, facesel_d).advanced, oldtop, oldleft);
       
   849 				} break;
   819 
   850 
   820 				/* Cancel button */
   851 				/* Cancel button */
   821 				case PFW_WIDGET_CANCEL:
   852 				case PFW_WIDGET_CANCEL:
   822 					DeleteWindow(w);
   853 					DeleteWindow(w);
   823 					break;
   854 					break;
   947 /**
   978 /**
   948  * Open the simple/advanced player face selection window
   979  * Open the simple/advanced player face selection window
   949  *
   980  *
   950  * @param player the player which face shall be edited
   981  * @param player the player which face shall be edited
   951  * @param adv    simple or advanced player face selection window
   982  * @param adv    simple or advanced player face selection window
       
   983  * @param top    previous top position of the window
       
   984  * @param left   previous left position of the window
   952  *
   985  *
   953  * @pre is player a valid player
   986  * @pre is player a valid player
   954  */
   987  */
   955 static void DoSelectPlayerFace(PlayerID player, bool adv)
   988 static void DoSelectPlayerFace(PlayerID player, bool adv, int top, int left)
   956 {
   989 {
   957 	if (!IsValidPlayer(player)) return;
   990 	if (!IsValidPlayer(player)) return;
   958 
   991 
   959 	Window *w = AllocateWindowDescFront(adv ? &_select_player_face_adv_desc : &_select_player_face_desc, player); // simple or advanced window
   992 	Window *w = AllocateWindowDescFront(adv ? &_select_player_face_adv_desc : &_select_player_face_desc, player); // simple or advanced window
   960 
   993 
   961 	if (w != NULL) {
   994 	if (w != NULL) {
   962 		w->caption_color = w->window_number;
   995 		w->caption_color = w->window_number;
   963 		WP(w, facesel_d).face = GetPlayer((PlayerID)w->window_number)->face;
   996 		WP(w, facesel_d).face = GetPlayer((PlayerID)w->window_number)->face;
   964 		WP(w, facesel_d).advanced = adv;
   997 		WP(w, facesel_d).advanced = adv;
       
   998 
       
   999 		/* Check if repositioning from default is required */
       
  1000 		if (top != FIRST_GUI_CALL && left != FIRST_GUI_CALL) {
       
  1001 			w->top = top;
       
  1002 			w->left = left;
       
  1003 		}
   965 	}
  1004 	}
   966 }
  1005 }
   967 
  1006 
   968 
  1007 
   969 /* Names of the widgets. Keep them in the same order as in the widget array */
  1008 /* Names of the widgets. Keep them in the same order as in the widget array */
  1290 
  1329 
  1291 
  1330 
  1292 static void BuyCompanyWndProc(Window *w, WindowEvent *e)
  1331 static void BuyCompanyWndProc(Window *w, WindowEvent *e)
  1293 {
  1332 {
  1294 	switch (e->event) {
  1333 	switch (e->event) {
  1295 	case WE_PAINT: {
  1334 		case WE_PAINT: {
  1296 		Player *p = GetPlayer((PlayerID)w->window_number);
  1335 			Player *p = GetPlayer((PlayerID)w->window_number);
  1297 		SetDParam(0, STR_COMPANY_NAME);
  1336 			SetDParam(0, STR_COMPANY_NAME);
  1298 		SetDParam(1, p->index);
  1337 			SetDParam(1, p->index);
  1299 		DrawWindowWidgets(w);
  1338 			DrawWindowWidgets(w);
  1300 
  1339 
  1301 		DrawPlayerFace(p->face, p->player_color, 2, 16);
  1340 			DrawPlayerFace(p->face, p->player_color, 2, 16);
  1302 
  1341 
  1303 		SetDParam(0, p->index);
  1342 			SetDParam(0, p->index);
  1304 		SetDParam(1, p->bankrupt_value);
  1343 			SetDParam(1, p->bankrupt_value);
  1305 		DrawStringMultiCenter(214, 65, STR_705B_WE_ARE_LOOKING_FOR_A_TRANSPORT, 238);
  1344 			DrawStringMultiCenter(214, 65, STR_705B_WE_ARE_LOOKING_FOR_A_TRANSPORT, 238);
  1306 		break;
  1345 		} break;
  1307 	}
  1346 
  1308 
  1347 		case WE_CLICK:
  1309 	case WE_CLICK:
  1348 			switch (e->we.click.widget) {
  1310 		switch (e->we.click.widget) {
  1349 				case 3:
  1311 		case 3:
  1350 					DeleteWindow(w);
  1312 			DeleteWindow(w);
  1351 					break;
  1313 			break;
  1352 				case 4: {
  1314 		case 4: {
  1353 					DoCommandP(0, w->window_number, 0, NULL, CMD_BUY_COMPANY | CMD_MSG(STR_7060_CAN_T_BUY_COMPANY));
  1315 			DoCommandP(0, w->window_number, 0, NULL, CMD_BUY_COMPANY | CMD_MSG(STR_7060_CAN_T_BUY_COMPANY));
  1354 					break;
  1316 			break;
  1355 				}
  1317 		}
  1356 			}
  1318 		}
  1357 			break;
  1319 		break;
       
  1320 	}
  1358 	}
  1321 }
  1359 }
  1322 
  1360 
  1323 static const Widget _buy_company_widgets[] = {
  1361 static const Widget _buy_company_widgets[] = {
  1324 {   WWT_CLOSEBOX,   RESIZE_NONE,     5,     0,    10,     0,    13, STR_00C5,              STR_018B_CLOSE_WINDOW},
  1362 {   WWT_CLOSEBOX,   RESIZE_NONE,     5,     0,    10,     0,    13, STR_00C5,              STR_018B_CLOSE_WINDOW},
  1368 
  1406 
  1369 /** End game window shown at the end of the game */
  1407 /** End game window shown at the end of the game */
  1370 static void EndGameWndProc(Window *w, WindowEvent *e)
  1408 static void EndGameWndProc(Window *w, WindowEvent *e)
  1371 {
  1409 {
  1372 	switch (e->event) {
  1410 	switch (e->event) {
  1373 	case WE_PAINT: {
  1411 		case WE_PAINT: {
  1374 		const Player *p;
  1412 			const Player *p;
  1375 		uint x, y;
  1413 			uint x, y;
  1376 
  1414 
  1377 		SetupHighScoreEndWindow(w, &x, &y);
  1415 			SetupHighScoreEndWindow(w, &x, &y);
  1378 
  1416 
  1379 		if (!IsValidPlayer(_local_player)) break;
  1417 			if (!IsValidPlayer(_local_player)) break;
  1380 
  1418 
  1381 		p = GetPlayer(_local_player);
  1419 			p = GetPlayer(_local_player);
  1382 		/* We need to get performance from last year because the image is shown
  1420 			/* We need to get performance from last year because the image is shown
  1383 		 * at the start of the new year when these things have already been copied */
  1421 			 * at the start of the new year when these things have already been copied */
  1384 		if (WP(w, highscore_d).background_img == SPR_TYCOON_IMG2_BEGIN) { // Tycoon of the century \o/
  1422 			if (WP(w, highscore_d).background_img == SPR_TYCOON_IMG2_BEGIN) { // Tycoon of the century \o/
  1385 			SetDParam(0, p->index);
  1423 				SetDParam(0, p->index);
  1386 			SetDParam(1, p->index);
  1424 				SetDParam(1, p->index);
  1387 			SetDParam(2, EndGameGetPerformanceTitleFromValue(p->old_economy[0].performance_history));
  1425 				SetDParam(2, EndGameGetPerformanceTitleFromValue(p->old_economy[0].performance_history));
  1388 			DrawStringMultiCenter(x + (640 / 2), y + 107, STR_021C_OF_ACHIEVES_STATUS, 640);
  1426 				DrawStringMultiCenter(x + (640 / 2), y + 107, STR_021C_OF_ACHIEVES_STATUS, 640);
  1389 		} else {
  1427 			} else {
  1390 			SetDParam(0, p->index);
  1428 				SetDParam(0, p->index);
  1391 			SetDParam(1, EndGameGetPerformanceTitleFromValue(p->old_economy[0].performance_history));
  1429 				SetDParam(1, EndGameGetPerformanceTitleFromValue(p->old_economy[0].performance_history));
  1392 			DrawStringMultiCenter(x + (640 / 2), y + 157, STR_021B_ACHIEVES_STATUS, 640);
  1430 				DrawStringMultiCenter(x + (640 / 2), y + 157, STR_021B_ACHIEVES_STATUS, 640);
  1393 		}
  1431 			}
  1394 	} break;
  1432 		} break;
  1395 	case WE_CLICK: /* Close the window (and show the highscore window) */
  1433 
  1396 		DeleteWindow(w);
  1434 		case WE_CLICK: /* Close the window (and show the highscore window) */
  1397 		break;
  1435 			DeleteWindow(w);
  1398 	case WE_DESTROY: /* Show the highscore window when this one is closed */
  1436 			break;
  1399 		if (!_networking) DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // unpause
  1437 
  1400 		ShowHighscoreTable(w->window_number, WP(w, highscore_d).rank);
  1438 		case WE_DESTROY: /* Show the highscore window when this one is closed */
  1401 		break;
  1439 			if (!_networking) DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // unpause
       
  1440 			ShowHighscoreTable(w->window_number, WP(w, highscore_d).rank);
       
  1441 			break;
  1402 	}
  1442 	}
  1403 }
  1443 }
  1404 
  1444 
  1405 static void HighScoreWndProc(Window *w, WindowEvent *e)
  1445 static void HighScoreWndProc(Window *w, WindowEvent *e)
  1406 {
  1446 {
  1407 	switch (e->event) {
  1447 	switch (e->event) {
  1408 	case WE_PAINT: {
  1448 		case WE_PAINT: {
  1409 		const HighScore *hs = _highscore_table[w->window_number];
  1449 			const HighScore *hs = _highscore_table[w->window_number];
  1410 		uint x, y;
  1450 			uint x, y;
  1411 		uint8 i;
  1451 			uint8 i;
  1412 
  1452 
  1413 		SetupHighScoreEndWindow(w, &x, &y);
  1453 			SetupHighScoreEndWindow(w, &x, &y);
  1414 
  1454 
  1415 		SetDParam(0, _patches.ending_year);
  1455 			SetDParam(0, _patches.ending_year);
  1416 		SetDParam(1, w->window_number + STR_6801_EASY);
  1456 			SetDParam(1, w->window_number + STR_6801_EASY);
  1417 		DrawStringMultiCenter(x + (640 / 2), y + 62, !_networking ? STR_0211_TOP_COMPANIES_WHO_REACHED : STR_TOP_COMPANIES_NETWORK_GAME, 500);
  1457 			DrawStringMultiCenter(x + (640 / 2), y + 62, !_networking ? STR_0211_TOP_COMPANIES_WHO_REACHED : STR_TOP_COMPANIES_NETWORK_GAME, 500);
  1418 
  1458 
  1419 		/* Draw Highscore peepz */
  1459 			/* Draw Highscore peepz */
  1420 		for (i = 0; i < lengthof(_highscore_table[0]); i++) {
  1460 			for (i = 0; i < lengthof(_highscore_table[0]); i++) {
  1421 			SetDParam(0, i + 1);
  1461 				SetDParam(0, i + 1);
  1422 			DrawString(x + 40, y + 140 + (i * 55), STR_0212, TC_BLACK);
  1462 				DrawString(x + 40, y + 140 + (i * 55), STR_0212, TC_BLACK);
  1423 
  1463 
  1424 			if (hs[i].company[0] != '\0') {
  1464 				if (hs[i].company[0] != '\0') {
  1425 				TextColour colour = (WP(w, highscore_d).rank == (int8)i) ? TC_RED : TC_BLACK; // draw new highscore in red
  1465 					TextColour colour = (WP(w, highscore_d).rank == (int8)i) ? TC_RED : TC_BLACK; // draw new highscore in red
  1426 
  1466 
  1427 				DoDrawString(hs[i].company, x + 71, y + 140 + (i * 55), colour);
  1467 					DoDrawString(hs[i].company, x + 71, y + 140 + (i * 55), colour);
  1428 				SetDParam(0, hs[i].title);
  1468 					SetDParam(0, hs[i].title);
  1429 				SetDParam(1, hs[i].score);
  1469 					SetDParam(1, hs[i].score);
  1430 				DrawString(x + 71, y + 160 + (i * 55), STR_HIGHSCORE_STATS, colour);
  1470 					DrawString(x + 71, y + 160 + (i * 55), STR_HIGHSCORE_STATS, colour);
  1431 			}
  1471 				}
  1432 		}
  1472 			}
  1433 	} break;
  1473 		} break;
  1434 
  1474 
  1435 	case WE_CLICK: /* Onclick to close window, and in destroy event handle the rest */
  1475 		case WE_CLICK: /* Onclick to close window, and in destroy event handle the rest */
  1436 		DeleteWindow(w);
  1476 			DeleteWindow(w);
  1437 		break;
  1477 			break;
  1438 
  1478 
  1439 	case WE_DESTROY: /* Get back all the hidden windows */
  1479 		case WE_DESTROY: /* Get back all the hidden windows */
  1440 		if (_game_mode != GM_MENU) ShowVitalWindows();
  1480 			if (_game_mode != GM_MENU) ShowVitalWindows();
  1441 
  1481 
  1442 		if (!_networking) DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // unpause
  1482 			if (!_networking) DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // unpause
  1443 		break;
  1483 			break;
  1444 	}
  1484 		}
  1445 	}
  1485 }
  1446 
  1486 
  1447 static const Widget _highscore_widgets[] = {
  1487 static const Widget _highscore_widgets[] = {
  1448 {      WWT_PANEL, RESIZE_NONE, 16, 0, 640, 0, 480, 0x0, STR_NULL},
  1488 {      WWT_PANEL, RESIZE_NONE, 16, 0, 640, 0, 480, 0x0, STR_NULL},
  1449 {   WIDGETS_END},
  1489 {   WIDGETS_END},
  1450 };
  1490 };