(svn r17344) -Codechange: splash of coding style over ai_event_types.*

pull/155/head
rubidium 15 years ago
parent c1fe2ce4bc
commit eba9b2f779

@ -24,25 +24,25 @@ char *AIEventEnginePreview::GetName()
static const int len = 64; static const int len = 64;
char *engine_name = MallocT<char>(len); char *engine_name = MallocT<char>(len);
::SetDParam(0, engine); ::SetDParam(0, this->engine);
::GetString(engine_name, STR_ENGINE_NAME, &engine_name[len - 1]); ::GetString(engine_name, STR_ENGINE_NAME, &engine_name[len - 1]);
return engine_name; return engine_name;
} }
CargoID AIEventEnginePreview::GetCargoType() CargoID AIEventEnginePreview::GetCargoType()
{ {
const Engine *e = ::Engine::Get(engine); const Engine *e = ::Engine::Get(this->engine);
if (!e->CanCarryCargo()) return CT_INVALID; if (!e->CanCarryCargo()) return CT_INVALID;
return e->GetDefaultCargoType(); return e->GetDefaultCargoType();
} }
int32 AIEventEnginePreview::GetCapacity() int32 AIEventEnginePreview::GetCapacity()
{ {
const Engine *e = ::Engine::Get(engine); const Engine *e = ::Engine::Get(this->engine);
switch (e->type) { switch (e->type) {
case VEH_ROAD: case VEH_ROAD:
case VEH_TRAIN: { case VEH_TRAIN: {
CargoArray capacities = GetCapacityOfArticulatedParts(engine, e->type); CargoArray capacities = GetCapacityOfArticulatedParts(this->engine, e->type);
for (CargoID c = 0; c < NUM_CARGO; c++) { for (CargoID c = 0; c < NUM_CARGO; c++) {
if (capacities[c] == 0) continue; if (capacities[c] == 0) continue;
return capacities[c]; return capacities[c];
@ -61,7 +61,7 @@ int32 AIEventEnginePreview::GetCapacity()
int32 AIEventEnginePreview::GetMaxSpeed() int32 AIEventEnginePreview::GetMaxSpeed()
{ {
const Engine *e = ::Engine::Get(engine); const Engine *e = ::Engine::Get(this->engine);
int32 max_speed = e->GetDisplayMaxSpeed(); // km-ish/h int32 max_speed = e->GetDisplayMaxSpeed(); // km-ish/h
if (e->type == VEH_AIRCRAFT) max_speed /= _settings_game.vehicle.plane_speed; if (e->type == VEH_AIRCRAFT) max_speed /= _settings_game.vehicle.plane_speed;
return max_speed; return max_speed;
@ -69,17 +69,17 @@ int32 AIEventEnginePreview::GetMaxSpeed()
Money AIEventEnginePreview::GetPrice() Money AIEventEnginePreview::GetPrice()
{ {
return ::Engine::Get(engine)->GetCost(); return ::Engine::Get(this->engine)->GetCost();
} }
Money AIEventEnginePreview::GetRunningCost() Money AIEventEnginePreview::GetRunningCost()
{ {
return ::Engine::Get(engine)->GetRunningCost(); return ::Engine::Get(this->engine)->GetRunningCost();
} }
int32 AIEventEnginePreview::GetVehicleType() int32 AIEventEnginePreview::GetVehicleType()
{ {
switch (::Engine::Get(engine)->type) { switch (::Engine::Get(this->engine)->type) {
case VEH_ROAD: return AIVehicle::VT_ROAD; case VEH_ROAD: return AIVehicle::VT_ROAD;
case VEH_TRAIN: return AIVehicle::VT_RAIL; case VEH_TRAIN: return AIVehicle::VT_RAIL;
case VEH_SHIP: return AIVehicle::VT_WATER; case VEH_SHIP: return AIVehicle::VT_WATER;
@ -90,5 +90,5 @@ int32 AIEventEnginePreview::GetVehicleType()
bool AIEventEnginePreview::AcceptPreview() bool AIEventEnginePreview::AcceptPreview()
{ {
return AIObject::DoCommand(0, engine, 0, CMD_WANT_ENGINE_PREVIEW); return AIObject::DoCommand(0, this->engine, 0, CMD_WANT_ENGINE_PREVIEW);
} }

@ -59,19 +59,19 @@ public:
* Get the VehicleID of the crashed vehicle. * Get the VehicleID of the crashed vehicle.
* @return The crashed vehicle. * @return The crashed vehicle.
*/ */
VehicleID GetVehicleID() { return vehicle; } VehicleID GetVehicleID() { return this->vehicle; }
/** /**
* Find the tile the vehicle crashed. * Find the tile the vehicle crashed.
* @return The crash site. * @return The crash site.
*/ */
TileIndex GetCrashSite() { return crash_site; } TileIndex GetCrashSite() { return this->crash_site; }
/** /**
* Get the reason for crashing * Get the reason for crashing
* @return The reason for crashing * @return The reason for crashing
*/ */
CrashReason GetCrashReason() { return crash_reason; } CrashReason GetCrashReason() { return this->crash_reason; }
private: private:
TileIndex crash_site; TileIndex crash_site;
@ -105,7 +105,7 @@ public:
* Get the SubsidyID of the subsidy. * Get the SubsidyID of the subsidy.
* @return The subsidy id. * @return The subsidy id.
*/ */
SubsidyID GetSubsidyID() { return subsidy_id; } SubsidyID GetSubsidyID() { return this->subsidy_id; }
private: private:
SubsidyID subsidy_id; SubsidyID subsidy_id;
@ -137,7 +137,7 @@ public:
* Get the SubsidyID of the subsidy. * Get the SubsidyID of the subsidy.
* @return The subsidy id. * @return The subsidy id.
*/ */
SubsidyID GetSubsidyID() { return subsidy_id; } SubsidyID GetSubsidyID() { return this->subsidy_id; }
private: private:
SubsidyID subsidy_id; SubsidyID subsidy_id;
@ -169,7 +169,7 @@ public:
* Get the SubsidyID of the subsidy. * Get the SubsidyID of the subsidy.
* @return The subsidy id. * @return The subsidy id.
*/ */
SubsidyID GetSubsidyID() { return subsidy_id; } SubsidyID GetSubsidyID() { return this->subsidy_id; }
private: private:
SubsidyID subsidy_id; SubsidyID subsidy_id;
@ -201,7 +201,7 @@ public:
* Get the SubsidyID of the subsidy. * Get the SubsidyID of the subsidy.
* @return The subsidy id. * @return The subsidy id.
*/ */
SubsidyID GetSubsidyID() { return subsidy_id; } SubsidyID GetSubsidyID() { return this->subsidy_id; }
private: private:
SubsidyID subsidy_id; SubsidyID subsidy_id;
@ -305,7 +305,7 @@ public:
*/ */
AIEventCompanyNew(Owner owner) : AIEventCompanyNew(Owner owner) :
AIEvent(AI_ET_COMPANY_NEW), AIEvent(AI_ET_COMPANY_NEW),
owner((AICompany::CompanyID)(byte)owner) owner((AICompany::CompanyID)owner)
{} {}
/** /**
@ -319,7 +319,7 @@ public:
* Get the CompanyID of the company that has been created. * Get the CompanyID of the company that has been created.
* @return The CompanyID of the company. * @return The CompanyID of the company.
*/ */
AICompany::CompanyID GetCompanyID() { return owner; } AICompany::CompanyID GetCompanyID() { return this->owner; }
private: private:
AICompany::CompanyID owner; AICompany::CompanyID owner;
@ -338,7 +338,7 @@ public:
*/ */
AIEventCompanyInTrouble(Owner owner) : AIEventCompanyInTrouble(Owner owner) :
AIEvent(AI_ET_COMPANY_IN_TROUBLE), AIEvent(AI_ET_COMPANY_IN_TROUBLE),
owner((AICompany::CompanyID)(byte)owner) owner((AICompany::CompanyID)owner)
{} {}
/** /**
@ -352,7 +352,7 @@ public:
* Get the CompanyID of the company that is in trouble. * Get the CompanyID of the company that is in trouble.
* @return The CompanyID of the company in trouble. * @return The CompanyID of the company in trouble.
*/ */
AICompany::CompanyID GetCompanyID() { return owner; } AICompany::CompanyID GetCompanyID() { return this->owner; }
private: private:
AICompany::CompanyID owner; AICompany::CompanyID owner;
@ -372,8 +372,8 @@ public:
*/ */
AIEventCompanyMerger(Owner old_owner, Owner new_owner) : AIEventCompanyMerger(Owner old_owner, Owner new_owner) :
AIEvent(AI_ET_COMPANY_MERGER), AIEvent(AI_ET_COMPANY_MERGER),
old_owner((AICompany::CompanyID)(byte)old_owner), old_owner((AICompany::CompanyID)old_owner),
new_owner((AICompany::CompanyID)(byte)new_owner) new_owner((AICompany::CompanyID)new_owner)
{} {}
/** /**
@ -390,13 +390,13 @@ public:
* AICompany::ResolveCompanyID will return COMPANY_COMPANY. It's * AICompany::ResolveCompanyID will return COMPANY_COMPANY. It's
* only usefull if you're keeping track of company's yourself. * only usefull if you're keeping track of company's yourself.
*/ */
AICompany::CompanyID GetOldCompanyID() { return old_owner; } AICompany::CompanyID GetOldCompanyID() { return this->old_owner; }
/** /**
* Get the CompanyID of the new owner. * Get the CompanyID of the new owner.
* @return The CompanyID of the new owner. * @return The CompanyID of the new owner.
*/ */
AICompany::CompanyID GetNewCompanyID() { return new_owner; } AICompany::CompanyID GetNewCompanyID() { return this->new_owner; }
private: private:
AICompany::CompanyID old_owner; AICompany::CompanyID old_owner;
@ -415,7 +415,7 @@ public:
*/ */
AIEventCompanyBankrupt(Owner owner) : AIEventCompanyBankrupt(Owner owner) :
AIEvent(AI_ET_COMPANY_BANKRUPT), AIEvent(AI_ET_COMPANY_BANKRUPT),
owner((AICompany::CompanyID)(byte)owner) owner((AICompany::CompanyID)owner)
{} {}
/** /**
@ -429,7 +429,7 @@ public:
* Get the CompanyID of the company that has gone bankrupt. * Get the CompanyID of the company that has gone bankrupt.
* @return The CompanyID of the company that has gone bankrupt. * @return The CompanyID of the company that has gone bankrupt.
*/ */
AICompany::CompanyID GetCompanyID() { return owner; } AICompany::CompanyID GetCompanyID() { return this->owner; }
private: private:
AICompany::CompanyID owner; AICompany::CompanyID owner;
@ -461,7 +461,7 @@ public:
* Get the VehicleID of the vehicle that is lost. * Get the VehicleID of the vehicle that is lost.
* @return The VehicleID of the vehicle that is lost. * @return The VehicleID of the vehicle that is lost.
*/ */
VehicleID GetVehicleID() { return vehicle_id; } VehicleID GetVehicleID() { return this->vehicle_id; }
private: private:
VehicleID vehicle_id; VehicleID vehicle_id;
@ -493,7 +493,7 @@ public:
* Get the VehicleID of the vehicle that is waiting in a depot. * Get the VehicleID of the vehicle that is waiting in a depot.
* @return The VehicleID of the vehicle that is waiting in a depot. * @return The VehicleID of the vehicle that is waiting in a depot.
*/ */
VehicleID GetVehicleID() { return vehicle_id; } VehicleID GetVehicleID() { return this->vehicle_id; }
private: private:
VehicleID vehicle_id; VehicleID vehicle_id;
@ -525,7 +525,7 @@ public:
* Get the VehicleID of the vehicle that lost money. * Get the VehicleID of the vehicle that lost money.
* @return The VehicleID of the vehicle that lost money. * @return The VehicleID of the vehicle that lost money.
*/ */
VehicleID GetVehicleID() { return vehicle_id; } VehicleID GetVehicleID() { return this->vehicle_id; }
private: private:
VehicleID vehicle_id; VehicleID vehicle_id;
@ -557,7 +557,7 @@ public:
* Get the IndustryID of the new industry. * Get the IndustryID of the new industry.
* @return The IndustryID of the industry. * @return The IndustryID of the industry.
*/ */
IndustryID GetIndustryID() { return industry_id; } IndustryID GetIndustryID() { return this->industry_id; }
private: private:
IndustryID industry_id; IndustryID industry_id;
@ -589,7 +589,7 @@ public:
* Get the IndustryID of the closing industry. * Get the IndustryID of the closing industry.
* @return The IndustryID of the industry. * @return The IndustryID of the industry.
*/ */
IndustryID GetIndustryID() { return industry_id; } IndustryID GetIndustryID() { return this->industry_id; }
private: private:
IndustryID industry_id; IndustryID industry_id;
@ -621,7 +621,7 @@ public:
* Get the EngineID of the new engine. * Get the EngineID of the new engine.
* @return The EngineID of the new engine. * @return The EngineID of the new engine.
*/ */
EngineID GetEngineID() { return engine; } EngineID GetEngineID() { return this->engine; }
private: private:
EngineID engine; EngineID engine;
@ -655,13 +655,13 @@ public:
* Get the StationID of the visited station. * Get the StationID of the visited station.
* @return The StationID of the visited station. * @return The StationID of the visited station.
*/ */
StationID GetStationID() { return station; } StationID GetStationID() { return this->station; }
/** /**
* Get the VehicleID of the first vehicle. * Get the VehicleID of the first vehicle.
* @return The VehicleID of the first vehicle. * @return The VehicleID of the first vehicle.
*/ */
VehicleID GetVehicleID() { return vehicle; } VehicleID GetVehicleID() { return this->vehicle; }
private: private:
StationID station; StationID station;
@ -694,7 +694,7 @@ public:
* Get the StationID of the station containing the affected airport. * Get the StationID of the station containing the affected airport.
* @return The StationID of the station containing the affected airport. * @return The StationID of the station containing the affected airport.
*/ */
StationID GetStationID() { return station; } StationID GetStationID() { return this->station; }
private: private:
StationID station; StationID station;
@ -726,7 +726,7 @@ public:
* Get the StationID of the station containing the affected airport. * Get the StationID of the station containing the affected airport.
* @return The StationID of the station containing the affected airport. * @return The StationID of the station containing the affected airport.
*/ */
StationID GetStationID() { return station; } StationID GetStationID() { return this->station; }
private: private:
StationID station; StationID station;

Loading…
Cancel
Save