mirror of https://github.com/OpenTTD/OpenTTD
(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 toorelease/0.5
parent
27cee58ab8
commit
5771cd10f9
16
road_gui.c
16
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) {
|
||||
switch (e->place.userdata) {
|
||||
case 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) {
|
||||
break;
|
||||
|
||||
case 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) {
|
||||
break;
|
||||
|
||||
case 4:
|
||||
sel_method = VPM_X_AND_Y;
|
||||
} else {
|
||||
break;
|
||||
|
||||
default:
|
||||
sel_method = VPM_X_OR_Y;
|
||||
break;
|
||||
}
|
||||
|
||||
VpSelectTilesWithMethod(e->place.pt.x, e->place.pt.y, sel_method);
|
||||
|
|
12
ship_gui.c
12
ship_gui.c
|
@ -328,11 +328,11 @@ static void NewShipWndProc(Window *w, WindowEvent *e)
|
|||
{
|
||||
int count = 0;
|
||||
int num = NUM_SHIP_ENGINES;
|
||||
const Engine *e = GetEngine(SHIP_ENGINES_INDEX);
|
||||
const Engine *eng = GetEngine(SHIP_ENGINES_INDEX);
|
||||
|
||||
do {
|
||||
if (HASBIT(e->player_avail, _local_player)) count++;
|
||||
} while (++e,--num);
|
||||
if (HASBIT(eng->player_avail, _local_player)) count++;
|
||||
} while (++eng,--num);
|
||||
SetVScrollCount(w, count);
|
||||
}
|
||||
|
||||
|
@ -340,7 +340,7 @@ static void NewShipWndProc(Window *w, WindowEvent *e)
|
|||
|
||||
{
|
||||
int num = NUM_SHIP_ENGINES;
|
||||
const Engine *e = GetEngine(SHIP_ENGINES_INDEX);
|
||||
const Engine *eng = GetEngine(SHIP_ENGINES_INDEX);
|
||||
int x = 2;
|
||||
int y = 15;
|
||||
int sel = WP(w,buildtrain_d).sel_index;
|
||||
|
@ -349,7 +349,7 @@ static void NewShipWndProc(Window *w, WindowEvent *e)
|
|||
EngineID selected_id = INVALID_ENGINE;
|
||||
|
||||
do {
|
||||
if (HASBIT(e->player_avail, _local_player)) {
|
||||
if (HASBIT(eng->player_avail, _local_player)) {
|
||||
if (sel==0) selected_id = engine_id;
|
||||
if (IS_INT_INSIDE(--pos, -w->vscroll.cap, 0)) {
|
||||
DrawString(x+75, y+7, GetCustomEngineName(engine_id), sel==0 ? 0xC : 0x10);
|
||||
|
@ -358,7 +358,7 @@ static void NewShipWndProc(Window *w, WindowEvent *e)
|
|||
}
|
||||
sel--;
|
||||
}
|
||||
} while (++engine_id, ++e,--num);
|
||||
} while (++engine_id, ++eng,--num);
|
||||
|
||||
WP(w,buildtrain_d).sel_engine = selected_id;
|
||||
|
||||
|
|
Loading…
Reference in New Issue