--- a/src/ai/api/ai_vehiclelist_valuator.cpp Fri May 04 19:55:35 2007 +0000
+++ b/src/ai/api/ai_vehiclelist_valuator.cpp Fri May 04 21:26:42 2007 +0000
@@ -1,50 +1,42 @@
#include "ai_vehiclelist_valuator.hpp"
-#include "../../vehicle.h"
+#include "ai_vehicle.hpp"
int32 AIVehicleListLocation::Valuate(int32 vehicle) const
{
- if (!IsValidVehicleID(vehicle)) return 0;
- return GetVehicle(vehicle)->tile;
+ return AIVehicle::GetLocation(vehicle);
}
int32 AIVehicleListEngineType::Valuate(int32 vehicle) const
{
- if (!IsValidVehicleID(vehicle)) return 0;
- return GetVehicle(vehicle)->engine_type;
+ return AIVehicle::GetEngineType(vehicle);
}
int32 AIVehicleListUnitNumber::Valuate(int32 vehicle) const
{
- if (!IsValidVehicleID(vehicle)) return 0;
- return GetVehicle(vehicle)->unitnumber;
+ return AIVehicle::GetUnitNumber(vehicle);
}
int32 AIVehicleListAge::Valuate(int32 vehicle) const
{
- if (!IsValidVehicleID(vehicle)) return 0;
- return GetVehicle(vehicle)->age;
+ return AIVehicle::GetAge(vehicle);
}
int32 AIVehicleListMaxAge::Valuate(int32 vehicle) const
{
- if (!IsValidVehicleID(vehicle)) return 0;
- return GetVehicle(vehicle)->max_age;
+ return AIVehicle::GetMaxAge(vehicle);
}
int32 AIVehicleListAgeLeft::Valuate(int32 vehicle) const
{
- if (!IsValidVehicleID(vehicle)) return 0;
- return GetVehicle(vehicle)->max_age - GetVehicle(vehicle)->age;
+ return AIVehicle::GetAgeLeft(vehicle);
}
int32 AIVehicleListProfitThisYear::Valuate(int32 vehicle) const
{
- if (!IsValidVehicleID(vehicle)) return 0;
- return GetVehicle(vehicle)->profit_this_year;
+ return AIVehicle::GetProfitThisYear(vehicle);
}
int32 AIVehicleListProfitLastYear::Valuate(int32 vehicle) const
{
- if (!IsValidVehicleID(vehicle)) return 0;
- return GetVehicle(vehicle)->profit_last_year;
+ return AIVehicle::GetProfitLastYear(vehicle);
}