(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
This commit is contained in:
belugas
2006-08-29 00:17:47 +00:00
parent 86dc219b4b
commit 1f660a8175
3 changed files with 112 additions and 104 deletions

View File

@@ -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);