summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-02-14 09:31:05 +0000
committerpeter1138 <peter1138@openttd.org>2006-02-14 09:31:05 +0000
commitfe7267ca91ffc78eca4cd792d0edd257e04e8f75 (patch)
tree6b2a0dcf363752d8d151c421ac13f047c0abd43e
parenta2acfb51ed65598a38572ada38f6702ed977413a (diff)
downloadopenttd-fe7267ca91ffc78eca4cd792d0edd257e04e8f75.tar.xz
(svn r3605) - Remove silly macro and fix indenting in DrawVehicleRefitWindow()
-rw-r--r--vehicle_gui.c55
1 files changed, 27 insertions, 28 deletions
diff --git a/vehicle_gui.c b/vehicle_gui.c
index 505630c8e..c1008928f 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -222,38 +222,37 @@ void DrawVehicleProfitButton(const Vehicle *v, int x, int y)
*/
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 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 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
- 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 *****************/