(svn r9369) [NoAI] -Codechange: make some IsValidXXX() function static, so they can be used by the other classes without the need for an instance. noai
authorrubidium
Tue, 20 Mar 2007 11:55:30 +0000
branchnoai
changeset 9497 f6678533ccba
parent 9496 05ebee9884b3
child 9498 046d9add6202
(svn r9369) [NoAI] -Codechange: make some IsValidXXX() function static, so they can be used by the other classes without the need for an instance.
src/ai/api/ai_cargo.cpp
src/ai/api/ai_industry.cpp
src/ai/api/ai_industry.hpp
src/ai/api/ai_town.cpp
src/ai/api/ai_town.hpp
src/ai/api/ai_vehicle.cpp
src/ai/api/ai_vehicle.hpp
--- a/src/ai/api/ai_cargo.cpp	Tue Mar 20 11:42:07 2007 +0000
+++ b/src/ai/api/ai_cargo.cpp	Tue Mar 20 11:55:30 2007 +0000
@@ -7,7 +7,7 @@
 #include "../../player.h" // For economy.h
 #include "../../economy.h"
 
-bool AICargo::IsValidCargo(CargoID cargo_type)
+/* static */ bool AICargo::IsValidCargo(CargoID cargo_type)
 {
 	return (cargo_type < NUM_CARGO && GetCargo(cargo_type)->IsValid());
 }
--- a/src/ai/api/ai_industry.cpp	Tue Mar 20 11:42:07 2007 +0000
+++ b/src/ai/api/ai_industry.cpp	Tue Mar 20 11:55:30 2007 +0000
@@ -18,7 +18,7 @@
 	return ::GetNumIndustries();
 }
 
-bool AIIndustry::IsValidIndustry(IndustryID industry_id)
+/* static */ bool AIIndustry::IsValidIndustry(IndustryID industry_id)
 {
 	return ::IsValidIndustryID(industry_id);
 }
--- a/src/ai/api/ai_industry.hpp	Tue Mar 20 11:42:07 2007 +0000
+++ b/src/ai/api/ai_industry.hpp	Tue Mar 20 11:55:30 2007 +0000
@@ -33,7 +33,7 @@
 	 * @param industry_id the index to check.
 	 * @return true if and only if the industry is valid.
 	 */
-	bool IsValidIndustry(IndustryID industry_id);
+	static bool IsValidIndustry(IndustryID industry_id);
 
 	/**
 	 * Get the name of the industry.
--- a/src/ai/api/ai_town.cpp	Tue Mar 20 11:42:07 2007 +0000
+++ b/src/ai/api/ai_town.cpp	Tue Mar 20 11:55:30 2007 +0000
@@ -18,7 +18,7 @@
 	return ::GetNumTowns();
 }
 
-bool AITown::IsValidTown(TownID town_id)
+/* static */ bool AITown::IsValidTown(TownID town_id)
 {
 	return ::IsValidTownID(town_id);
 }
--- a/src/ai/api/ai_town.hpp	Tue Mar 20 11:42:07 2007 +0000
+++ b/src/ai/api/ai_town.hpp	Tue Mar 20 11:55:30 2007 +0000
@@ -32,7 +32,7 @@
 	 * @param town_id the index to check.
 	 * @return true if and only if the town is valid.
 	 */
-	bool IsValidTown(TownID town_id);
+	static bool IsValidTown(TownID town_id);
 
 	/**
 	 * Get the name of the town.
--- a/src/ai/api/ai_vehicle.cpp	Tue Mar 20 11:42:07 2007 +0000
+++ b/src/ai/api/ai_vehicle.cpp	Tue Mar 20 11:55:30 2007 +0000
@@ -10,12 +10,12 @@
 #include "../../player.h"
 #include "../../vehicle.h"
 
-bool AIVehicle::IsValidEngine(EngineID engine_id)
+/* static */ bool AIVehicle::IsValidEngine(EngineID engine_id)
 {
 	return ::IsEngineIndex(engine_id); // TODO: implement 'can I build this engine check'
 }
 
-bool AIVehicle::IsValidVehicle(VehicleID vehicle_id)
+/* static */ bool AIVehicle::IsValidVehicle(VehicleID vehicle_id)
 {
 	return ::IsValidVehicleID(vehicle_id) && ::GetVehicle(vehicle_id)->owner == _current_player;
 }
--- a/src/ai/api/ai_vehicle.hpp	Tue Mar 20 11:42:07 2007 +0000
+++ b/src/ai/api/ai_vehicle.hpp	Tue Mar 20 11:55:30 2007 +0000
@@ -17,14 +17,14 @@
 	 * @param engine_id the engine to check.
 	 * @return true if and only if the engine type is valid.
 	 */
-	bool IsValidEngine(EngineID engine_id);
+	static bool IsValidEngine(EngineID engine_id);
 
 	/**
 	 * Checks whether the given vehicle is valid and owned by you.
 	 * @param vehicle_id the vehicle to check.
 	 * @return true if and only if the vehicle is valid.
 	 */
-	bool IsValidVehicle(VehicleID vehicle_id);
+	static bool IsValidVehicle(VehicleID vehicle_id);
 
 	/**
 	 * Find the best road vehicle for this job, given a minimum reliability.