(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.

This commit is contained in:
rubidium 2008-04-20 10:13:54 +00:00
parent 12ae3a2194
commit f55ffd14bd
10 changed files with 43 additions and 43 deletions

View File

@ -702,7 +702,7 @@ static void TileLoopIndustry_BubbleGenerator(TileIndex tile)
EV_BUBBLE
);
if (v != NULL) v->u.special.animation_substate = dir;
if (v != NULL) v->u.effect.animation_substate = dir;
}
static void TileLoop_Industry(TileIndex tile)

View File

@ -1086,9 +1086,9 @@ static const OldChunks vehicle_air_chunk[] = {
OCL_END()
};
static const OldChunks vehicle_special_chunk[] = {
OCL_SVAR( OC_UINT16, VehicleSpecial, animation_state ),
OCL_SVAR( OC_UINT8, VehicleSpecial, animation_substate ),
static const OldChunks vehicle_effect_chunk[] = {
OCL_SVAR( OC_UINT16, VehicleEffect, animation_state ),
OCL_SVAR( OC_UINT8, VehicleEffect, animation_substate ),
OCL_NULL( 7 ), // Junk
@ -1123,7 +1123,7 @@ static bool LoadOldVehicleUnion(LoadgameState *ls, int num)
case VEH_ROAD : res = LoadChunk(ls, &v->u.road, vehicle_road_chunk); break;
case VEH_SHIP : res = LoadChunk(ls, &v->u.ship, vehicle_ship_chunk); break;
case VEH_AIRCRAFT: res = LoadChunk(ls, &v->u.air, vehicle_air_chunk); break;
case VEH_SPECIAL : res = LoadChunk(ls, &v->u.special, vehicle_special_chunk); break;
case VEH_EFFECT : res = LoadChunk(ls, &v->u.effect, vehicle_effect_chunk); break;
case VEH_DISASTER: res = LoadChunk(ls, &v->u.disaster, vehicle_disaster_chunk); break;
}
@ -1236,7 +1236,7 @@ bool LoadOldVehicle(LoadgameState *ls, int num)
case 0x11 /*VEH_ROAD */: v = new (_current_vehicle_id) RoadVehicle(); break;
case 0x12 /*VEH_SHIP */: v = new (_current_vehicle_id) Ship(); break;
case 0x13 /*VEH_AIRCRAFT*/: v = new (_current_vehicle_id) Aircraft(); break;
case 0x14 /*VEH_SPECIAL */: v = new (_current_vehicle_id) SpecialVehicle(); break;
case 0x14 /*VEH_EFFECT */: v = new (_current_vehicle_id) EffectVehicle(); break;
case 0x15 /*VEH_DISASTER*/: v = new (_current_vehicle_id) DisasterVehicle(); break;
}
if (!LoadChunk(ls, v, vehicle_chunk)) return false;
@ -1270,7 +1270,7 @@ bool LoadOldVehicle(LoadgameState *ls, int num)
v->name = CopyFromOldName(_old_string_id);
/* Vehicle-subtype is different in TTD(Patch) */
if (v->type == VEH_SPECIAL) v->subtype = v->subtype >> 1;
if (v->type == VEH_EFFECT) v->subtype = v->subtype >> 1;
if (_cargo_count != 0) {
CargoPacket *cp = new CargoPacket((_cargo_source == 0xFF) ? INVALID_STATION : _cargo_source, _cargo_count);

View File

@ -704,7 +704,7 @@ static void HandleBrokenRoadVeh(Vehicle *v)
if (!(v->vehstatus & VS_HIDDEN)) {
Vehicle *u = CreateEffectVehicleRel(v, 4, 4, 5, EV_BREAKDOWN_SMOKE);
if (u != NULL) u->u.special.animation_state = v->breakdown_delay * 2;
if (u != NULL) u->u.effect.animation_state = v->breakdown_delay * 2;
}
}

View File

@ -210,7 +210,7 @@ static void HandleBrokenShip(Vehicle *v)
if (!(v->vehstatus & VS_HIDDEN)) {
Vehicle *u = CreateEffectVehicleRel(v, 4, 4, 5, EV_BREAKDOWN_SMOKE);
if (u != NULL) u->u.special.animation_state = v->breakdown_delay * 2;
if (u != NULL) u->u.effect.animation_state = v->breakdown_delay * 2;
}
}

View File

@ -682,7 +682,7 @@ skip_column:
byte color;
FOR_ALL_VEHICLES(v) {
if (v->type != VEH_SPECIAL &&
if (v->type != VEH_EFFECT &&
(v->vehstatus & (VS_HIDDEN | VS_UNCLICKABLE)) == 0) {
/* Remap into flat coordinates. */
Point pt = RemapCoords(

View File

@ -3237,7 +3237,7 @@ static void HandleBrokenTrain(Vehicle *v)
if (!(v->vehstatus & VS_HIDDEN)) {
Vehicle *u = CreateEffectVehicleRel(v, 4, 4, 5, EV_BREAKDOWN_SMOKE);
if (u != NULL) u->u.special.animation_state = v->breakdown_delay * 2;
if (u != NULL) u->u.effect.animation_state = v->breakdown_delay * 2;
}
}

View File

@ -1044,8 +1044,8 @@ static void BreakdownSmokeTick(Vehicle *v)
EndVehicleMove(v);
}
v->u.special.animation_state--;
if (v->u.special.animation_state == 0) {
v->u.effect.animation_state--;
if (v->u.effect.animation_state == 0) {
BeginVehicleMove(v);
EndVehicleMove(v);
delete v;
@ -1078,8 +1078,8 @@ static void BulldozerInit(Vehicle *v)
{
v->cur_image = SPR_BULLDOZER_NE;
v->progress = 0;
v->u.special.animation_state = 0;
v->u.special.animation_substate = 0;
v->u.effect.animation_state = 0;
v->u.effect.animation_substate = 0;
}
struct BulldozerMovement {
@ -1125,7 +1125,7 @@ static void BulldozerTick(Vehicle *v)
{
v->progress++;
if ((v->progress & 7) == 0) {
const BulldozerMovement* b = &_bulldozer_movement[v->u.special.animation_state];
const BulldozerMovement* b = &_bulldozer_movement[v->u.effect.animation_state];
BeginVehicleMove(v);
@ -1134,11 +1134,11 @@ static void BulldozerTick(Vehicle *v)
v->x_pos += _inc_by_dir[b->direction].x;
v->y_pos += _inc_by_dir[b->direction].y;
v->u.special.animation_substate++;
if (v->u.special.animation_substate >= b->duration) {
v->u.special.animation_substate = 0;
v->u.special.animation_state++;
if (v->u.special.animation_state == lengthof(_bulldozer_movement)) {
v->u.effect.animation_substate++;
if (v->u.effect.animation_substate >= b->duration) {
v->u.effect.animation_substate = 0;
v->u.effect.animation_state++;
if (v->u.effect.animation_state == lengthof(_bulldozer_movement)) {
EndVehicleMove(v);
delete v;
return;
@ -1328,7 +1328,7 @@ static void BubbleTick(Vehicle *v)
EndVehicleMove(v);
return;
}
if (v->u.special.animation_substate != 0) {
if (v->u.effect.animation_substate != 0) {
v->spritenum = GB(InteractiveRandom(), 0, 2) + 1;
} else {
v->spritenum = 6;
@ -1407,9 +1407,9 @@ static EffectTickProc * const _effect_tick_procs[] = {
};
Vehicle *CreateEffectVehicle(int x, int y, int z, EffectVehicle type)
Vehicle *CreateEffectVehicle(int x, int y, int z, EffectVehicleType type)
{
Vehicle *v = new SpecialVehicle();
Vehicle *v = new EffectVehicle();
if (v != NULL) {
v->subtype = type;
v->x_pos = x;
@ -1428,19 +1428,19 @@ Vehicle *CreateEffectVehicle(int x, int y, int z, EffectVehicle type)
return v;
}
Vehicle *CreateEffectVehicleAbove(int x, int y, int z, EffectVehicle type)
Vehicle *CreateEffectVehicleAbove(int x, int y, int z, EffectVehicleType type)
{
int safe_x = Clamp(x, 0, MapMaxX() * TILE_SIZE);
int safe_y = Clamp(y, 0, MapMaxY() * TILE_SIZE);
return CreateEffectVehicle(x, y, GetSlopeZ(safe_x, safe_y) + z, type);
}
Vehicle *CreateEffectVehicleRel(const Vehicle *v, int x, int y, int z, EffectVehicle type)
Vehicle *CreateEffectVehicleRel(const Vehicle *v, int x, int y, int z, EffectVehicleType type)
{
return CreateEffectVehicle(v->x_pos + x, v->y_pos + y, v->z_pos + z, type);
}
void SpecialVehicle::Tick()
void EffectVehicle::Tick()
{
_effect_tick_procs[this->subtype](this);
}
@ -2498,7 +2498,7 @@ Trackdir GetVehicleTrackdir(const Vehicle *v)
/* Vehicle is turning around, get the direction from vehicle's direction */
return DiagdirToDiagTrackdir(DirToDiagDir(v->direction));
/* case VEH_AIRCRAFT: case VEH_SPECIAL: case VEH_DISASTER: */
/* case VEH_AIRCRAFT: case VEH_EFFECT: case VEH_DISASTER: */
default: return INVALID_TRACKDIR;
}
}
@ -2955,7 +2955,7 @@ static const SaveLoad _aircraft_desc[] = {
};
static const SaveLoad _special_desc[] = {
SLE_WRITEBYTE(Vehicle, type, VEH_SPECIAL),
SLE_WRITEBYTE(Vehicle, type, VEH_EFFECT),
SLE_VAR(Vehicle, subtype, SLE_UINT8),
@ -2973,8 +2973,8 @@ static const SaveLoad _special_desc[] = {
SLE_VAR(Vehicle, progress, SLE_UINT8),
SLE_VAR(Vehicle, vehstatus, SLE_UINT8),
SLE_VARX(cpp_offsetof(Vehicle, u) + cpp_offsetof(VehicleSpecial, animation_state), SLE_UINT16),
SLE_VARX(cpp_offsetof(Vehicle, u) + cpp_offsetof(VehicleSpecial, animation_substate), SLE_UINT8),
SLE_VARX(cpp_offsetof(Vehicle, u) + cpp_offsetof(VehicleEffect, animation_state), SLE_UINT16),
SLE_VARX(cpp_offsetof(Vehicle, u) + cpp_offsetof(VehicleEffect, animation_substate), SLE_UINT8),
/* reserve extra space in savegame here. (currently 16 bytes) */
SLE_CONDNULL(16, 2, SL_MAX_VERSION),
@ -3062,7 +3062,7 @@ void Load_VEHS()
case VEH_ROAD: v = new (index) RoadVehicle(); break;
case VEH_SHIP: v = new (index) Ship(); break;
case VEH_AIRCRAFT: v = new (index) Aircraft(); break;
case VEH_SPECIAL: v = new (index) SpecialVehicle(); break;
case VEH_EFFECT: v = new (index) EffectVehicle(); break;
case VEH_DISASTER: v = new (index) DisasterVehicle(); break;
case VEH_INVALID: v = new (index) InvalidVehicle(); break;
default: NOT_REACHED();
@ -3282,7 +3282,7 @@ void Vehicle::SetNext(Vehicle *next)
}
}
void SpecialVehicle::UpdateDeltaXY(Direction direction)
void EffectVehicle::UpdateDeltaXY(Direction direction)
{
this->x_offs = 0;
this->y_offs = 0;

View File

@ -169,7 +169,7 @@ struct VehicleRoad {
RoadTypes compatible_roadtypes;
};
struct VehicleSpecial {
struct VehicleEffect {
uint16 animation_state;
byte animation_substate;
};
@ -313,7 +313,7 @@ public:
VehicleRail rail;
VehicleAir air;
VehicleRoad road;
VehicleSpecial special;
VehicleEffect effect;
VehicleDisaster disaster;
VehicleShip ship;
} u;
@ -547,12 +547,12 @@ public:
* - bulldozer (road works)
* - bubbles (industry)
*/
struct SpecialVehicle : public Vehicle {
struct EffectVehicle : public Vehicle {
/** Initializes the Vehicle to a special vehicle */
SpecialVehicle() { this->type = VEH_SPECIAL; }
EffectVehicle() { this->type = VEH_EFFECT; }
/** We want to 'destruct' the right class. */
virtual ~SpecialVehicle() {}
virtual ~EffectVehicle() {}
const char *GetTypeString() const { return "special vehicle"; }
void UpdateDeltaXY(Direction direction);

View File

@ -171,9 +171,9 @@ static inline uint32 GetCmdSendToDepot(const BaseVehicle *v)
bool EnsureNoVehicleOnGround(TileIndex tile);
void StopAllVehicles();
Vehicle *CreateEffectVehicle(int x, int y, int z, EffectVehicle type);
Vehicle *CreateEffectVehicleAbove(int x, int y, int z, EffectVehicle type);
Vehicle *CreateEffectVehicleRel(const Vehicle *v, int x, int y, int z, EffectVehicle type);
Vehicle *CreateEffectVehicle(int x, int y, int z, EffectVehicleType type);
Vehicle *CreateEffectVehicleAbove(int x, int y, int z, EffectVehicleType type);
Vehicle *CreateEffectVehicleRel(const Vehicle *v, int x, int y, int z, EffectVehicleType type);
extern VehicleID _vehicle_id_ctr_day;
extern Vehicle *_place_clicked_vehicle;

View File

@ -14,7 +14,7 @@ enum VehicleType {
VEH_ROAD,
VEH_SHIP,
VEH_AIRCRAFT,
VEH_SPECIAL,
VEH_EFFECT,
VEH_DISASTER,
VEH_END,
VEH_INVALID = 0xFF,
@ -39,7 +39,7 @@ struct BaseVehicle
static const VehicleID INVALID_VEHICLE = 0xFFFF;
/* Effect vehicle types */
enum EffectVehicle {
enum EffectVehicleType {
EV_CHIMNEY_SMOKE = 0,
EV_STEAM_SMOKE = 1,
EV_DIESEL_SMOKE = 2,