Mercurial > hg > openttd
changeset 9008:bc4efc6bfe0d draft
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sun, 20 Apr 2008 10:13:54 +0000 |
parents | 92ce4f6f4660 |
children | 870efbdb988d |
files | src/industry_cmd.cpp src/oldloader.cpp src/roadveh_cmd.cpp src/ship_cmd.cpp src/smallmap_gui.cpp src/train_cmd.cpp src/vehicle.cpp src/vehicle_base.h src/vehicle_func.h src/vehicle_type.h |
diffstat | 10 files changed, 43 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -702,7 +702,7 @@ 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)
--- a/src/oldloader.cpp +++ b/src/oldloader.cpp @@ -1086,9 +1086,9 @@ 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 @@ 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 @@ 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 @@ 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);
--- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -704,7 +704,7 @@ 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; } }
--- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -210,7 +210,7 @@ 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; } }
--- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -682,7 +682,7 @@ 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(
--- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -3237,7 +3237,7 @@ 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; } }
--- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1044,8 +1044,8 @@ 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 @@ { 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 @@ { 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 @@ 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 @@ 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 @@ }; -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 @@ 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 @@ /* 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 _special_desc[] = { - SLE_WRITEBYTE(Vehicle, type, VEH_SPECIAL), + SLE_WRITEBYTE(Vehicle, type, VEH_EFFECT), SLE_VAR(Vehicle, subtype, SLE_UINT8), @@ -2973,8 +2973,8 @@ 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 @@ 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 SpecialVehicle::UpdateDeltaXY(Direction direction) +void EffectVehicle::UpdateDeltaXY(Direction direction) { this->x_offs = 0; this->y_offs = 0;
--- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -169,7 +169,7 @@ RoadTypes compatible_roadtypes; }; -struct VehicleSpecial { +struct VehicleEffect { uint16 animation_state; byte animation_substate; }; @@ -313,7 +313,7 @@ VehicleRail rail; VehicleAir air; VehicleRoad road; - VehicleSpecial special; + VehicleEffect effect; VehicleDisaster disaster; VehicleShip ship; } u; @@ -547,12 +547,12 @@ * - 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);
--- a/src/vehicle_func.h +++ b/src/vehicle_func.h @@ -171,9 +171,9 @@ 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;
--- a/src/vehicle_type.h +++ b/src/vehicle_type.h @@ -14,7 +14,7 @@ VEH_ROAD, VEH_SHIP, VEH_AIRCRAFT, - VEH_SPECIAL, + VEH_EFFECT, VEH_DISASTER, VEH_END, VEH_INVALID = 0xFF, @@ -39,7 +39,7 @@ 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,