(svn r4910) - NewGRF: add and initialize cargo subtype for vehicle visual variations
--- a/aircraft_cmd.c Thu May 18 16:51:42 2006 +0000
+++ b/aircraft_cmd.c Fri May 19 10:04:03 2006 +0000
@@ -236,6 +236,8 @@
v->cargo_type = CT_PASSENGERS;
u->cargo_type = CT_MAIL;
+ v->cargo_subtype = 0;
+
v->string_id = STR_SV_AIRCRAFT_NAME;
// v->next_order_param = v->next_order = 0;
--- a/newgrf_engine.c Thu May 18 16:51:42 2006 +0000
+++ b/newgrf_engine.c Fri May 19 10:04:03 2006 +0000
@@ -675,7 +675,7 @@
case 0x5F: return v->value & 0xFF;
case 0x60: return v->string_id;
case 0x61: return v->string_id & 0xFF;
- case 0x72: return 0; // XXX Refit cycle
+ case 0x72: return v->cargo_subtype;
case 0x7A: return v->random_bits;
case 0x7B: return v->waiting_triggers;
}
--- a/roadveh_cmd.c Thu May 18 16:51:42 2006 +0000
+++ b/roadveh_cmd.c Fri May 19 10:04:03 2006 +0000
@@ -156,6 +156,7 @@
v->spritenum = rvi->image_index;
v->cargo_type = rvi->cargo_type;
+ v->cargo_subtype = 0;
v->cargo_cap = rvi->capacity;
// v->cargo_count = 0;
v->value = cost;
--- a/ship_cmd.c Thu May 18 16:51:42 2006 +0000
+++ b/ship_cmd.c Fri May 19 10:04:03 2006 +0000
@@ -863,6 +863,7 @@
v->spritenum = svi->image_index;
v->cargo_type = svi->cargo_type;
+ v->cargo_subtype = 0;
v->cargo_cap = svi->capacity;
v->value = value;
--- a/train_cmd.c Thu May 18 16:51:42 2006 +0000
+++ b/train_cmd.c Fri May 19 10:04:03 2006 +0000
@@ -535,6 +535,7 @@
u->spritenum = rvi_artic->image_index;
if (flip_image) u->spritenum++;
u->cargo_type = rvi_artic->cargo_type;
+ u->cargo_subtype = 0;
u->cargo_cap = rvi_artic->capacity;
u->max_speed = 0;
u->max_age = 0;
@@ -616,6 +617,7 @@
}
v->cargo_type = rvi->cargo_type;
+ v->cargo_subtype = 0;
v->cargo_cap = rvi->capacity;
v->value = value;
// v->day_counter = 0;
@@ -681,6 +683,7 @@
SetMultiheaded(u);
u->spritenum = v->spritenum + 1;
u->cargo_type = v->cargo_type;
+ u->cargo_subtype = v->cargo_subtype;
u->cargo_cap = v->cargo_cap;
u->u.rail.railtype = v->u.rail.railtype;
if (building) v->next = u;
@@ -763,6 +766,7 @@
v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
v->spritenum = rvi->image_index;
v->cargo_type = rvi->cargo_type;
+ v->cargo_subtype = 0;
v->cargo_cap = rvi->capacity;
v->max_speed = rvi->max_speed;
v->value = value;
--- a/vehicle.h Thu May 18 16:51:42 2006 +0000
+++ b/vehicle.h Fri May 19 10:04:03 2006 +0000
@@ -183,6 +183,7 @@
StationID cargo_source;// source of cargo
uint16 cargo_cap; // total capacity
uint16 cargo_count;// how many pieces are used
+ byte cargo_subtype; ///< Used for livery refits (NewGRF variations)
byte day_counter; // increased by one for each day
byte tick_counter;// increased by one for each tick