summaryrefslogtreecommitdiff
path: root/player_gui.c
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2006-10-03 20:16:20 +0000
committerbelugas <belugas@openttd.org>2006-10-03 20:16:20 +0000
commit688da1d9406cbd6fb359605de0d5c43c77f7a8ea (patch)
tree22b881cad1fc846e1fe14182d37c8f6e6261f820 /player_gui.c
parent0dd2126543cb5613272876114a89fdbcbadeb21c (diff)
downloadopenttd-688da1d9406cbd6fb359605de0d5c43c77f7a8ea.tar.xz
(svn r6631) -Codechange: Use accessors for click_state.
Another step toward merging XTDwidget. The only two files not converted (window.h and widget.c) will be done at the very last commit)
Diffstat (limited to 'player_gui.c')
-rw-r--r--player_gui.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/player_gui.c b/player_gui.c
index 9c2a89bb2..757fed204 100644
--- a/player_gui.c
+++ b/player_gui.c
@@ -317,6 +317,8 @@ static void ShowColourDropDownMenu(Window *w, uint32 widget)
static void SelectPlayerLiveryWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
+ case WE_CREATE: LowerWindowWidget(w, WP(w, livery_d).livery_class + 2); break;
+
case WE_PAINT: {
const Player *p = GetPlayer(w->window_number);
LiveryScheme scheme = LS_DEFAULT;
@@ -372,8 +374,10 @@ static void SelectPlayerLiveryWndProc(Window *w, WindowEvent *e)
case 6: {
LiveryScheme scheme;
+ RaiseWindowWidget(w, WP(w, livery_d).livery_class + 2);
WP(w, livery_d).livery_class = e->we.click.widget - 2;
WP(w, livery_d).sel = 0;
+ LowerWindowWidget(w, WP(w, livery_d).livery_class + 2);
/* Select the first item in the list */
for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
@@ -382,7 +386,6 @@ static void SelectPlayerLiveryWndProc(Window *w, WindowEvent *e)
break;
}
}
- w->click_state = 1 << e->we.click.widget;
w->height = 49 + livery_height[WP(w, livery_d).livery_class] * 14;
w->widget[13].bottom = w->height - 1;
w->widget[13].data = livery_height[WP(w, livery_d).livery_class] << 8 | 1;
@@ -469,9 +472,10 @@ static const WindowDesc _select_player_livery_desc = {
static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
+ case WE_CREATE: LowerWindowWidget(w, WP(w, facesel_d).gender + 5); break;
+
case WE_PAINT: {
Player *p;
- w->click_state = (w->click_state & ~(1<<5|1<<6)) | ((1<<5) << WP(w,facesel_d).gender);
DrawWindowWidgets(w);
p = GetPlayer(w->window_number);
DrawPlayerFace(WP(w,facesel_d).face, p->player_color, 2, 16);
@@ -486,7 +490,9 @@ static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e)
break;
case 5: /* male click */
case 6: /* female click */
- WP(w,facesel_d).gender = e->we.click.widget - 5;
+ RaiseWindowWidget(w, WP(w, facesel_d).gender + 5);
+ WP(w, facesel_d).gender = e->we.click.widget - 5;
+ LowerWindowWidget(w, WP(w, facesel_d).gender + 5);
SetWindowDirty(w);
break;
case 7:
@@ -721,7 +727,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
wf->caption_color = wf->window_number;
WP(wf,livery_d).livery_class = LC_OTHER;
WP(wf,livery_d).sel = 1;
- wf->click_state = 1 << 2;
+ LowerWindowWidget(wf, 2);
}
} break;