mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-05 05:42:42 +00:00
(svn r17344) -Codechange: splash of coding style over ai_event_types.*
This commit is contained in:
parent
b1d4594fa7
commit
4abf4602e7
@ -24,25 +24,25 @@ char *AIEventEnginePreview::GetName()
|
||||
static const int len = 64;
|
||||
char *engine_name = MallocT<char>(len);
|
||||
|
||||
::SetDParam(0, engine);
|
||||
::SetDParam(0, this->engine);
|
||||
::GetString(engine_name, STR_ENGINE_NAME, &engine_name[len - 1]);
|
||||
return engine_name;
|
||||
}
|
||||
|
||||
CargoID AIEventEnginePreview::GetCargoType()
|
||||
{
|
||||
const Engine *e = ::Engine::Get(engine);
|
||||
const Engine *e = ::Engine::Get(this->engine);
|
||||
if (!e->CanCarryCargo()) return CT_INVALID;
|
||||
return e->GetDefaultCargoType();
|
||||
}
|
||||
|
||||
int32 AIEventEnginePreview::GetCapacity()
|
||||
{
|
||||
const Engine *e = ::Engine::Get(engine);
|
||||
const Engine *e = ::Engine::Get(this->engine);
|
||||
switch (e->type) {
|
||||
case VEH_ROAD:
|
||||
case VEH_TRAIN: {
|
||||
CargoArray capacities = GetCapacityOfArticulatedParts(engine, e->type);
|
||||
CargoArray capacities = GetCapacityOfArticulatedParts(this->engine, e->type);
|
||||
for (CargoID c = 0; c < NUM_CARGO; c++) {
|
||||
if (capacities[c] == 0) continue;
|
||||
return capacities[c];
|
||||
@ -61,7 +61,7 @@ int32 AIEventEnginePreview::GetCapacity()
|
||||
|
||||
int32 AIEventEnginePreview::GetMaxSpeed()
|
||||
{
|
||||
const Engine *e = ::Engine::Get(engine);
|
||||
const Engine *e = ::Engine::Get(this->engine);
|
||||
int32 max_speed = e->GetDisplayMaxSpeed(); // km-ish/h
|
||||
if (e->type == VEH_AIRCRAFT) max_speed /= _settings_game.vehicle.plane_speed;
|
||||
return max_speed;
|
||||
@ -69,17 +69,17 @@ int32 AIEventEnginePreview::GetMaxSpeed()
|
||||
|
||||
Money AIEventEnginePreview::GetPrice()
|
||||
{
|
||||
return ::Engine::Get(engine)->GetCost();
|
||||
return ::Engine::Get(this->engine)->GetCost();
|
||||
}
|
||||
|
||||
Money AIEventEnginePreview::GetRunningCost()
|
||||
{
|
||||
return ::Engine::Get(engine)->GetRunningCost();
|
||||
return ::Engine::Get(this->engine)->GetRunningCost();
|
||||
}
|
||||
|
||||
int32 AIEventEnginePreview::GetVehicleType()
|
||||
{
|
||||
switch (::Engine::Get(engine)->type) {
|
||||
switch (::Engine::Get(this->engine)->type) {
|
||||
case VEH_ROAD: return AIVehicle::VT_ROAD;
|
||||
case VEH_TRAIN: return AIVehicle::VT_RAIL;
|
||||
case VEH_SHIP: return AIVehicle::VT_WATER;
|
||||
@ -90,5 +90,5 @@ int32 AIEventEnginePreview::GetVehicleType()
|
||||
|
||||
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.
|
||||
* @return The crashed vehicle.
|
||||
*/
|
||||
VehicleID GetVehicleID() { return vehicle; }
|
||||
VehicleID GetVehicleID() { return this->vehicle; }
|
||||
|
||||
/**
|
||||
* Find the tile the vehicle crashed.
|
||||
* @return The crash site.
|
||||
*/
|
||||
TileIndex GetCrashSite() { return crash_site; }
|
||||
TileIndex GetCrashSite() { return this->crash_site; }
|
||||
|
||||
/**
|
||||
* Get the reason for crashing
|
||||
* @return The reason for crashing
|
||||
*/
|
||||
CrashReason GetCrashReason() { return crash_reason; }
|
||||
CrashReason GetCrashReason() { return this->crash_reason; }
|
||||
|
||||
private:
|
||||
TileIndex crash_site;
|
||||
@ -105,7 +105,7 @@ public:
|
||||
* Get the SubsidyID of the subsidy.
|
||||
* @return The subsidy id.
|
||||
*/
|
||||
SubsidyID GetSubsidyID() { return subsidy_id; }
|
||||
SubsidyID GetSubsidyID() { return this->subsidy_id; }
|
||||
|
||||
private:
|
||||
SubsidyID subsidy_id;
|
||||
@ -137,7 +137,7 @@ public:
|
||||
* Get the SubsidyID of the subsidy.
|
||||
* @return The subsidy id.
|
||||
*/
|
||||
SubsidyID GetSubsidyID() { return subsidy_id; }
|
||||
SubsidyID GetSubsidyID() { return this->subsidy_id; }
|
||||
|
||||
private:
|
||||
SubsidyID subsidy_id;
|
||||
@ -169,7 +169,7 @@ public:
|
||||
* Get the SubsidyID of the subsidy.
|
||||
* @return The subsidy id.
|
||||
*/
|
||||
SubsidyID GetSubsidyID() { return subsidy_id; }
|
||||
SubsidyID GetSubsidyID() { return this->subsidy_id; }
|
||||
|
||||
private:
|
||||
SubsidyID subsidy_id;
|
||||
@ -201,7 +201,7 @@ public:
|
||||
* Get the SubsidyID of the subsidy.
|
||||
* @return The subsidy id.
|
||||
*/
|
||||
SubsidyID GetSubsidyID() { return subsidy_id; }
|
||||
SubsidyID GetSubsidyID() { return this->subsidy_id; }
|
||||
|
||||
private:
|
||||
SubsidyID subsidy_id;
|
||||
@ -305,7 +305,7 @@ public:
|
||||
*/
|
||||
AIEventCompanyNew(Owner owner) :
|
||||
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.
|
||||
* @return The CompanyID of the company.
|
||||
*/
|
||||
AICompany::CompanyID GetCompanyID() { return owner; }
|
||||
AICompany::CompanyID GetCompanyID() { return this->owner; }
|
||||
|
||||
private:
|
||||
AICompany::CompanyID owner;
|
||||
@ -338,7 +338,7 @@ public:
|
||||
*/
|
||||
AIEventCompanyInTrouble(Owner owner) :
|
||||
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.
|
||||
* @return The CompanyID of the company in trouble.
|
||||
*/
|
||||
AICompany::CompanyID GetCompanyID() { return owner; }
|
||||
AICompany::CompanyID GetCompanyID() { return this->owner; }
|
||||
|
||||
private:
|
||||
AICompany::CompanyID owner;
|
||||
@ -372,8 +372,8 @@ public:
|
||||
*/
|
||||
AIEventCompanyMerger(Owner old_owner, Owner new_owner) :
|
||||
AIEvent(AI_ET_COMPANY_MERGER),
|
||||
old_owner((AICompany::CompanyID)(byte)old_owner),
|
||||
new_owner((AICompany::CompanyID)(byte)new_owner)
|
||||
old_owner((AICompany::CompanyID)old_owner),
|
||||
new_owner((AICompany::CompanyID)new_owner)
|
||||
{}
|
||||
|
||||
/**
|
||||
@ -390,13 +390,13 @@ public:
|
||||
* AICompany::ResolveCompanyID will return COMPANY_COMPANY. It's
|
||||
* 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.
|
||||
* @return The CompanyID of the new owner.
|
||||
*/
|
||||
AICompany::CompanyID GetNewCompanyID() { return new_owner; }
|
||||
AICompany::CompanyID GetNewCompanyID() { return this->new_owner; }
|
||||
|
||||
private:
|
||||
AICompany::CompanyID old_owner;
|
||||
@ -415,7 +415,7 @@ public:
|
||||
*/
|
||||
AIEventCompanyBankrupt(Owner owner) :
|
||||
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.
|
||||
* @return The CompanyID of the company that has gone bankrupt.
|
||||
*/
|
||||
AICompany::CompanyID GetCompanyID() { return owner; }
|
||||
AICompany::CompanyID GetCompanyID() { return this->owner; }
|
||||
|
||||
private:
|
||||
AICompany::CompanyID owner;
|
||||
@ -461,7 +461,7 @@ public:
|
||||
* Get 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:
|
||||
VehicleID vehicle_id;
|
||||
@ -493,7 +493,7 @@ public:
|
||||
* Get 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:
|
||||
VehicleID vehicle_id;
|
||||
@ -525,7 +525,7 @@ public:
|
||||
* Get 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:
|
||||
VehicleID vehicle_id;
|
||||
@ -557,7 +557,7 @@ public:
|
||||
* Get the IndustryID of the new industry.
|
||||
* @return The IndustryID of the industry.
|
||||
*/
|
||||
IndustryID GetIndustryID() { return industry_id; }
|
||||
IndustryID GetIndustryID() { return this->industry_id; }
|
||||
|
||||
private:
|
||||
IndustryID industry_id;
|
||||
@ -589,7 +589,7 @@ public:
|
||||
* Get the IndustryID of the closing industry.
|
||||
* @return The IndustryID of the industry.
|
||||
*/
|
||||
IndustryID GetIndustryID() { return industry_id; }
|
||||
IndustryID GetIndustryID() { return this->industry_id; }
|
||||
|
||||
private:
|
||||
IndustryID industry_id;
|
||||
@ -621,7 +621,7 @@ public:
|
||||
* Get the EngineID of the new engine.
|
||||
* @return The EngineID of the new engine.
|
||||
*/
|
||||
EngineID GetEngineID() { return engine; }
|
||||
EngineID GetEngineID() { return this->engine; }
|
||||
|
||||
private:
|
||||
EngineID engine;
|
||||
@ -655,13 +655,13 @@ public:
|
||||
* Get 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.
|
||||
* @return The VehicleID of the first vehicle.
|
||||
*/
|
||||
VehicleID GetVehicleID() { return vehicle; }
|
||||
VehicleID GetVehicleID() { return this->vehicle; }
|
||||
|
||||
private:
|
||||
StationID station;
|
||||
@ -694,7 +694,7 @@ public:
|
||||
* Get 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:
|
||||
StationID station;
|
||||
@ -726,7 +726,7 @@ public:
|
||||
* Get 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:
|
||||
StationID station;
|
||||
|
Loading…
Reference in New Issue
Block a user