diff options
author | tron <tron@openttd.org> | 2005-10-23 13:04:44 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-10-23 13:04:44 +0000 |
commit | 181d586a7c13a296a1b9355e15e55dda7ac0fcb2 (patch) | |
tree | 7a8d1fbbe0d0d6ee2c8e981c57be6a9003505e97 /window.c | |
parent | 0b936c3222b3945f738885c6c7db3b46363ec6fe (diff) | |
download | openttd-181d586a7c13a296a1b9355e15e55dda7ac0fcb2.tar.xz |
(svn r3078) Some more stuff, which piled up:
- const, whitespace, indentation, bracing, GB/SB, pointless casts
- use the trinary operator where appropriate
- data types (uint[] -> AcceptedCargo, ...)
- if cascade -> switch
- if (ptr) -> if (ptr != NULL)
- DeMorgan's Law
- Fix some comments
- 0 -> '\0', change magic numbers to symbolic constants
Diffstat (limited to 'window.c')
-rw-r--r-- | window.c | 25 |
1 files changed, 15 insertions, 10 deletions
@@ -214,11 +214,9 @@ void CallWindowEventNP(Window *w, int event) w->wndproc(w, &e); } -void SetWindowDirty(Window *w) +void SetWindowDirty(const Window* w) { - if (w == NULL) - return; - + if (w == NULL) return; SetDirtyBlocks(w->left, w->top, w->left + w->width, w->top + w->height); } @@ -1402,10 +1400,16 @@ static void MouseLoop(int click, int mousewheel) y -= vp->top; //here allows scrolling in both x and y axis #define scrollspeed 3 - if (x-15<0) { WP(w,vp_d).scrollpos_x += (x-15) * scrollspeed << vp->zoom; } - else if (15-(vp->width-x) > 0) { WP(w,vp_d).scrollpos_x += (15-(vp->width-x))*scrollspeed << vp->zoom; } - if (y-15<0) { WP(w,vp_d).scrollpos_y += (y-15)*scrollspeed << vp->zoom; } - else if (15-(vp->height-y) > 0) { WP(w,vp_d).scrollpos_y += (15-(vp->height-y))*scrollspeed << vp->zoom; } + if (x - 15 < 0) { + WP(w, vp_d).scrollpos_x += (x - 15) * scrollspeed << vp->zoom; + } else if (15 - (vp->width - x) > 0) { + WP(w, vp_d).scrollpos_x += (15 - (vp->width - x)) * scrollspeed << vp->zoom; + } + if (y - 15 < 0) { + WP(w, vp_d).scrollpos_y += (y - 15) * scrollspeed << vp->zoom; + } else if (15 - (vp->height - y) > 0) { + WP(w,vp_d).scrollpos_y += (15 - (vp->height - y)) * scrollspeed << vp->zoom; + } #undef scrollspeed } } @@ -1434,8 +1438,9 @@ static void MouseLoop(int click, int mousewheel) _cursor.sprite != SPR_CURSOR_QUERY && _cursor.sprite != SPR_CURSOR_SIGN && _pause != 0 && - !_cheats.build_in_pause.value) - return; + !_cheats.build_in_pause.value) { + return; + } if (_thd.place_mode == 0) { HandleViewportClicked(vp, x, y); |