Changeset - r3025:2557582ab1b0
[Not reviewed]
master
0 1 0
peter1138 - 19 years ago 2006-02-14 09:31:05
peter1138@openttd.org
(svn r3605) - Remove silly macro and fix indenting in DrawVehicleRefitWindow()
1 file changed with 26 insertions and 27 deletions:
0 comments (0 inline, 0 general)
vehicle_gui.c
Show inline comments
 
@@ -222,38 +222,37 @@ void DrawVehicleProfitButton(const Vehic
 
 */
 
CargoID DrawVehicleRefitWindow(const Vehicle *v, int sel)
 
{
 
	uint32 cmask;
 
	uint32 cmask = 0;
 
	CargoID cid, cargo = CT_INVALID;
 
	int y = 25;
 
	const Vehicle* u;
 
#define show_cargo(ctype) { \
 
		byte colour = 16; \
 
		if (sel == 0) { \
 
			cargo = ctype; \
 
			colour = 12; \
 
} \
 
		sel--; \
 
		DrawString(6, y, _cargoc.names_s[ctype], colour); \
 
		y += 10; \
 
}
 
	const Vehicle* u = v;
 

	
 
	/* Check if vehicle has custom refit or normal ones, and get its bitmasked value.
 
	 * If its a train, 'or' this with the refit masks of the wagons. Now just 'and'
 
	 * it with the bitmask of available cargo on the current landscape, and
 
	 * where the bits are set: those are available */
 
	do {
 
		cmask |= _engine_info[u->engine_type].refit_mask;
 
		u = u->next;
 
	} while (v->type == VEH_Train && u != NULL);
 

	
 
		/* Check if vehicle has custom refit or normal ones, and get its bitmasked value.
 
		 * If its a train, 'or' this with the refit masks of the wagons. Now just 'and'
 
		 * it with the bitmask of available cargo on the current landscape, and
 
		 * where the bits are set: those are available */
 
		cmask = 0;
 
		u = v;
 
		do {
 
			cmask |= _engine_info[u->engine_type].refit_mask;
 
			u = u->next;
 
		} while (v->type == VEH_Train && u != NULL);
 
	/* Check which cargo has been selected from the refit window and draw list */
 
	for (cid = 0; cmask != 0; cmask >>= 1, cid++) {
 
		if (HASBIT(cmask, 0)) {
 
			// vehicle is refittable to this cargo
 
			byte colour = 16;
 
			if (sel == 0) {
 
				cargo = _local_cargo_id_ctype[cid];
 
				colour = 12;
 
			}
 

	
 
		/* Check which cargo has been selected from the refit window and draw list */
 
		for (cid = 0; cmask != 0; cmask >>= 1, cid++) {
 
			if (HASBIT(cmask, 0)) // vehicle is refittable to this cargo
 
				show_cargo(_local_cargo_id_ctype[cid]);
 
			sel--;
 
			DrawString(6, y, _cargoc.names_s[_local_cargo_id_ctype[cid]], colour);
 
			y += 10;
 
		}
 
		return cargo;
 
	}
 

	
 
	return cargo;
 
}
 

	
 
/************ Sorter functions *****************/
0 comments (0 inline, 0 general)