Changeset - r4435:b983ab44be59
[Not reviewed]
master
0 3 0
belugas - 18 years ago 2006-08-29 00:17:47
belugas@openttd.org
(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
2 files changed with 18 insertions and 10 deletions:
0 comments (0 inline, 0 general)
road_gui.c
Show inline comments
 
@@ -233,16 +233,24 @@ static void BuildRoadToolbWndProc(Window
 

	
 
	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);
ship_gui.c
Show inline comments
 
@@ -328,11 +328,11 @@ static void NewShipWndProc(Window *w, Wi
 
		{
 
			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, Wi
 

	
 
		{
 
			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, Wi
 
			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, Wi
 
					}
 
					sel--;
 
				}
 
			} while (++engine_id, ++e,--num);
 
			} while (++engine_id, ++eng,--num);
 

	
 
			WP(w,buildtrain_d).sel_engine = selected_id;
 

	
0 comments (0 inline, 0 general)