summaryrefslogtreecommitdiff
path: root/road_gui.c
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2006-08-29 00:17:47 +0000
committerbelugas <belugas@openttd.org>2006-08-29 00:17:47 +0000
commit1f660a81757bfb6b678ed33d865427eff8f8892c (patch)
tree19545c9bc20aa9c6d5198cd44ea6008c9d095df5 /road_gui.c
parent86dc219b4b668913b2deb90bf7ddfe0a479e3acd (diff)
downloadopenttd-1f660a81757bfb6b678ed33d865427eff8f8892c.tar.xz
(svn r6205) -CodeChange : use a switch case instead of a cascade of if
-CodeChange : rename var Engine *e to Engine *eng, since we have WindowEvent *e in same fnct -CodeChange : fix a broken tabulation on a switch case. SOme breathing spaces too
Diffstat (limited to 'road_gui.c')
-rw-r--r--road_gui.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/road_gui.c b/road_gui.c
index 357f94c87..7bcfd95c0 100644
--- a/road_gui.c
+++ b/road_gui.c
@@ -233,16 +233,24 @@ static void BuildRoadToolbWndProc(Window *w, WindowEvent *e)
case WE_PLACE_DRAG: {
int sel_method;
- if (e->place.userdata == 1) {
- sel_method = VPM_FIX_X;
- _place_road_flag = (_place_road_flag&~2) | ((e->place.pt.y&8)>>2);
- } else if (e->place.userdata == 2) {
- sel_method = VPM_FIX_Y;
- _place_road_flag = (_place_road_flag&~2) | ((e->place.pt.x&8)>>2);
- } else if (e->place.userdata == 4) {
- sel_method = VPM_X_AND_Y;
- } else {
- sel_method = VPM_X_OR_Y;
+ switch (e->place.userdata) {
+ case 1:
+ sel_method = VPM_FIX_X;
+ _place_road_flag = (_place_road_flag & ~2) | ((e->place.pt.y & 8) >> 2);
+ break;
+
+ case 2:
+ sel_method = VPM_FIX_Y;
+ _place_road_flag = (_place_road_flag & ~2) | ((e->place.pt.x & 8) >> 2);
+ break;
+
+ case 4:
+ sel_method = VPM_X_AND_Y;
+ break;
+
+ default:
+ sel_method = VPM_X_OR_Y;
+ break;
}
VpSelectTilesWithMethod(e->place.pt.x, e->place.pt.y, sel_method);