diff -r ef44f62cb8b9 -r 22c441f5adf9 src/player_gui.cpp --- a/src/player_gui.cpp Mon May 05 12:35:38 2008 +0000 +++ b/src/player_gui.cpp Wed May 07 21:09:51 2008 +0000 @@ -1,6 +1,6 @@ /* $Id$ */ -/** @file player_gui.cpp */ +/** @file player_gui.cpp Player related GUIs. */ #include "stdafx.h" #include "openttd.h" @@ -30,6 +30,7 @@ #include "settings_type.h" #include "widgets/dropdown_func.h" #include "widgets/dropdown_type.h" +#include "tilehighlight_func.h" #include "table/sprites.h" #include "table/strings.h" @@ -166,9 +167,9 @@ int new_height = ((player != _local_player) ? 0 : 12) + ((WP(w, def_d).data_1 != 0) ? 48 : 74 + 10 * EXPENSES_END); if (w->height != new_height) { /* Make window dirty before and after resizing */ - SetWindowDirty(w); + w->SetDirty(); w->height = new_height; - SetWindowDirty(w); + w->SetDirty(); w->SetWidgetHiddenState(PFW_WIDGET_INCREASE_LOAN, player != _local_player); w->SetWidgetHiddenState(PFW_WIDGET_REPAY_LOAN, player != _local_player); @@ -197,7 +198,7 @@ int oldleft = w->left; ///< current left position of the window before closing it PlayerID player = (PlayerID)w->window_number; - DeleteWindow(w); + delete w; /* Open up the (toggled size) Finance window at the same position as the previous */ DoShowPlayerFinances(player, !HasBit(mode, 0), stickied, oldtop, oldleft); } @@ -488,7 +489,7 @@ } else { WP(w, livery_d).sel = 1 << j; } - SetWindowDirty(w); + w->SetDirty(); break; } } @@ -871,20 +872,20 @@ int oldleft = w->left; ///< current top position of the window before closing it DoCommandP(0, 0, *pf, NULL, CMD_SET_PLAYER_FACE); - DeleteWindow(w); + delete w; /* Open up the (toggled size) Face selection window at the same position as the previous */ DoSelectPlayerFace((PlayerID)w->window_number, !WP(w, facesel_d).advanced, oldtop, oldleft); } break; /* Cancel button */ case PFW_WIDGET_CANCEL: - DeleteWindow(w); + delete w; break; /* OK button */ case PFW_WIDGET_ACCEPT: DoCommandP(0, 0, *pf, NULL, CMD_SET_PLAYER_FACE); - DeleteWindow(w); + delete w; break; /* Load button */ @@ -892,7 +893,7 @@ *pf = _player_face; ScaleAllPlayerFaceBits(*pf); ShowErrorMessage(INVALID_STRING_ID, STR_FACE_LOAD_DONE, 0, 0); - SetWindowDirty(w); + w->SetDirty(); break; /* 'Player face number' button, view and/or set player face number */ @@ -912,13 +913,13 @@ case PFW_WIDGET_FEMALE: SetPlayerFaceBits(*pf, PFV_GENDER, ge, e->we.click.widget - PFW_WIDGET_MALE); ScaleAllPlayerFaceBits(*pf); - SetWindowDirty(w); + w->SetDirty(); break; /* Randomize face button */ case PFW_WIDGET_RANDOM_NEW_FACE: RandomPlayerFaceBits(*pf, ge, WP(w, facesel_d).advanced); - SetWindowDirty(w); + w->SetDirty(); break; /* Toggle ethnicity (european/african) button */ @@ -926,7 +927,7 @@ case PFW_WIDGET_ETHNICITY_AFR: SetPlayerFaceBits(*pf, PFV_ETHNICITY, ge, e->we.click.widget - PFW_WIDGET_ETHNICITY_EUR); ScaleAllPlayerFaceBits(*pf); - SetWindowDirty(w); + w->SetDirty(); break; default: @@ -965,7 +966,7 @@ IncreasePlayerFaceBits(*pf, pfv, ge, (((e->we.click.widget - PFW_WIDGET_EYECOLOUR_L) % 3) != 0) ? 1 : -1); } - SetWindowDirty(w); + w->SetDirty(); } break; } @@ -977,7 +978,7 @@ *pf = strtoul(e->we.edittext.str, NULL, 10); ScaleAllPlayerFaceBits(*pf); ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_SET, 0, 0); - SetWindowDirty(w); + w->SetDirty(); } else { ShowErrorMessage(INVALID_STRING_ID, STR_FACE_FACECODE_ERR, 0, 0); } @@ -1270,7 +1271,11 @@ w->LowerWidget(PCW_WIDGET_BUILD_VIEW_HQ); w->InvalidateWidget(PCW_WIDGET_BUILD_VIEW_HQ); } else { - ScrollMainWindowToTile(tile); + if (_ctrl_pressed) { + ShowExtraViewPortWindow(tile); + } else { + ScrollMainWindowToTile(tile); + } } break; } @@ -1300,7 +1305,7 @@ case WE_MOUSELOOP: /* redraw the window every now and then */ - if ((++w->vscroll.pos & 0x1F) == 0) SetWindowDirty(w); + if ((++w->vscroll.pos & 0x1F) == 0) w->SetDirty(); break; case WE_PLACE_OBJ: @@ -1375,7 +1380,7 @@ case WE_CLICK: switch (e->we.click.widget) { case 3: - DeleteWindow(w); + delete w; break; case 4: { DoCommandP(0, w->window_number, 0, NULL, CMD_BUY_COMPANY | CMD_MSG(STR_7060_CAN_T_BUY_COMPANY)); @@ -1460,7 +1465,7 @@ } break; case WE_CLICK: /* Close the window (and show the highscore window) */ - DeleteWindow(w); + delete w; break; case WE_DESTROY: /* Show the highscore window when this one is closed */ @@ -1501,7 +1506,7 @@ } break; case WE_CLICK: /* Onclick to close window, and in destroy event handle the rest */ - DeleteWindow(w); + delete w; break; case WE_DESTROY: /* Get back all the hidden windows */