(svn r12413) [NoAI] -Remove: removed the last traced of the old obsolete Valuator system (this includes the ugly GetListName(), so Morloth should be happy ;))
--- a/src/ai/api/ai_abstractlist.cpp Tue Mar 25 12:16:30 2008 +0000
+++ b/src/ai/api/ai_abstractlist.cpp Tue Mar 25 12:20:42 2008 +0000
@@ -328,11 +328,6 @@
void AIAbstractList::AddList(AIAbstractList *list)
{
- if (this->GetListName() != NULL && list->GetListName() != NULL && strcmp(this->GetListName(), list->GetListName()) != 0) {
- DEBUG(ai, 0, "WARNING: You are trying to add a list %s to a list which\n", list->GetListName());
- DEBUG(ai, 0, " is based on %s. In general, this can't work. Expect fuzzy results!\n", this->GetListName());
- }
-
AIAbstractListMap *list_items = &list->items;
for (AIAbstractListMap::iterator iter = list_items->begin(); iter != list_items->end(); iter++) {
this->AddItem((*iter).first);
--- a/src/ai/api/ai_abstractlist.hpp Tue Mar 25 12:16:30 2008 +0000
+++ b/src/ai/api/ai_abstractlist.hpp Tue Mar 25 12:20:42 2008 +0000
@@ -232,35 +232,6 @@
void KeepList(AIAbstractList *list);
/**
- * The definition how valuators should look.
- */
- class Valuator : public AIObject {
- /* Make this valuator a friend of AIAbstractList, so we can access the private.
- * Nobody else should ever call Valuate. */
- friend class AIAbstractList;
- public:
- /**
- * Virtual destructor, needed to make compilers happy.
- */
- virtual ~Valuator() {}
-
- private:
- /**
- * The Valuator. This function is called for every entry in the List it is
- * used on. Input is always int32 and output is always int32, but it can
- * be casted from TownID, IndustryID, ...
- */
- virtual int32 Valuate(int32 item) const = 0;
-
- /**
- * To ensure Valuators are only used on Lists they are ment to used on,
- * this value contains the name of the List they should be used on.
- * @note a possible value is NULL, to indicate it can be used on any list.
- */
- virtual const char *GetListName() const = 0;
- };
-
- /**
* Give all items a value defined by the valuator you give.
* @param vm Internal pointer, not something you need to specify.
* @note The first param for this function is the function you want to use
@@ -276,14 +247,6 @@
* list.Valuate(MyVal, 12);
*/
SQInteger Valuate(HSQUIRRELVM vm);
-
-private:
- /**
- * The name of the list, to check if a Valuator can be used on this list.
- * @note a possible value is NULL, to indicate all valuators can be used on
- * this list.
- */
- virtual const char *GetListName() const { return NULL; };
};
#endif /* AI_LIST_HPP */
--- a/src/ai/api/ai_abstractlist.hpp.sq Tue Mar 25 12:16:30 2008 +0000
+++ b/src/ai/api/ai_abstractlist.hpp.sq Tue Mar 25 12:20:42 2008 +0000
@@ -4,12 +4,6 @@
/* Allow enums to be used as Squirrel parameters */
template <> AIAbstractList::SorterType GetParam(ForceType<AIAbstractList::SorterType>, HSQUIRRELVM vm, int index) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIAbstractList::SorterType)tmp; }
template <> int Return<AIAbstractList::SorterType>(HSQUIRRELVM vm, AIAbstractList::SorterType res) { sq_pushinteger(vm, (int32)res); return 1; }
- /* Allow inner classes/structs to be used as Squirrel parameters */
- template <> AIAbstractList::Valuator *GetParam(ForceType<AIAbstractList::Valuator *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIAbstractList::Valuator *)instance; }
- template <> AIAbstractList::Valuator &GetParam(ForceType<AIAbstractList::Valuator &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIAbstractList::Valuator *)instance; }
- template <> const AIAbstractList::Valuator *GetParam(ForceType<const AIAbstractList::Valuator *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIAbstractList::Valuator *)instance; }
- template <> const AIAbstractList::Valuator &GetParam(ForceType<const AIAbstractList::Valuator &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIAbstractList::Valuator *)instance; }
- template <> int Return<AIAbstractList::Valuator *>(HSQUIRRELVM vm, AIAbstractList::Valuator *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIAbstractList::Valuator", res, NULL, DefSQDestructorCallback<AIAbstractList::Valuator>); return 1; }
/* Allow AIAbstractList to be used as Squirrel parameter */
template <> AIAbstractList *GetParam(ForceType<AIAbstractList *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIAbstractList *)instance; }
--- a/src/ai/api/ai_bridgelist.hpp Tue Mar 25 12:16:30 2008 +0000
+++ b/src/ai/api/ai_bridgelist.hpp Tue Mar 25 12:20:42 2008 +0000
@@ -16,9 +16,6 @@
public:
static const char *GetClassName() { return "AIBridgeList"; }
AIBridgeList();
-
-private:
- const char *GetListName() const { return "AIBridgeList"; }
};
/**
@@ -33,9 +30,6 @@
* @param length The length of the bridge you want to build.
*/
AIBridgeList_Length(uint length);
-
-private:
- const char *GetListName() const { return "AIBridgeList"; }
};
#endif /* AI_BRIDGELIST_HPP */
--- a/src/ai/api/ai_cargolist.hpp Tue Mar 25 12:16:30 2008 +0000
+++ b/src/ai/api/ai_cargolist.hpp Tue Mar 25 12:20:42 2008 +0000
@@ -14,9 +14,6 @@
public:
static const char *GetClassName() { return "AICargoList"; }
AICargoList();
-
-private:
- const char *GetListName() const { return "AICargoList"; }
};
#endif /* AI_CARGOLIST_HPP */
--- a/src/ai/api/ai_enginelist.hpp Tue Mar 25 12:16:30 2008 +0000
+++ b/src/ai/api/ai_enginelist.hpp Tue Mar 25 12:20:42 2008 +0000
@@ -21,9 +21,6 @@
* @param vehicle_type The type of vehicle to make a list of engines for.
*/
AIEngineList(AIVehicle::VehicleType vehicle_type);
-
-private:
- const char *GetListName() const { return "AIEngineList"; }
};
#endif /* AI_ENGINELIST_HPP */
--- a/src/ai/api/ai_industrylist.hpp Tue Mar 25 12:16:30 2008 +0000
+++ b/src/ai/api/ai_industrylist.hpp Tue Mar 25 12:20:42 2008 +0000
@@ -16,9 +16,6 @@
public:
static const char *GetClassName() { return "AIIndustryList"; }
AIIndustryList();
-
-private:
- const char *GetListName() const { return "AIIndustryList"; }
};
/**
@@ -33,9 +30,6 @@
* @param cargo_id The cargo this industry should accept.
*/
AIIndustryList_CargoAccepting(CargoID cargo_id);
-
-private:
- const char *GetListName() const { return "AIIndustryList"; }
};
/**
@@ -51,9 +45,6 @@
* @param cargo_id The cargo this industry should produce.
*/
AIIndustryList_CargoProducing(CargoID cargo_id);
-
-private:
- const char *GetListName() const { return "AIIndustryList"; }
};
#endif /* AI_INDUSTRYLIST_HPP */
--- a/src/ai/api/ai_list.hpp Tue Mar 25 12:16:30 2008 +0000
+++ b/src/ai/api/ai_list.hpp Tue Mar 25 12:20:42 2008 +0000
@@ -16,9 +16,6 @@
public:
static const char *GetClassName() { return "AIList"; }
-private:
- const char *GetListName() const { return "AIList"; }
-
public:
/**
* Add an item to the list.
--- a/src/ai/api/ai_stationlist.hpp Tue Mar 25 12:16:30 2008 +0000
+++ b/src/ai/api/ai_stationlist.hpp Tue Mar 25 12:20:42 2008 +0000
@@ -21,9 +21,6 @@
* @param station_type The type of station to make a list of stations for.
*/
AIStationList(AIStation::StationType station_type);
-
-private:
- const char *GetListName() const { return "AIStationList"; }
};
/**
@@ -38,9 +35,6 @@
* @param vehicle_id The vehicle to get the list of stations he has in its orders from.
*/
AIStationList_Vehicle(VehicleID vehicle_id);
-
-private:
- const char *GetListName() const { return "AIStationList"; }
};
#endif /* AI_STATIONLIST_HPP */
--- a/src/ai/api/ai_tilelist.hpp Tue Mar 25 12:16:30 2008 +0000
+++ b/src/ai/api/ai_tilelist.hpp Tue Mar 25 12:20:42 2008 +0000
@@ -18,9 +18,6 @@
static const char *GetClassName() { return "AITileList"; }
private:
- const char *GetListName() const { return "AITileList"; }
-
-private:
/**
* Make sure t1.x is smaller than t2.x and t1.y is smaller than t2.y.
* They are swapped to ensure they are after calling this function.
--- a/src/ai/api/ai_townlist.hpp Tue Mar 25 12:16:30 2008 +0000
+++ b/src/ai/api/ai_townlist.hpp Tue Mar 25 12:20:42 2008 +0000
@@ -16,9 +16,6 @@
public:
static const char *GetClassName() { return "AITownList"; }
AITownList();
-
-private:
- const char *GetListName() const { return "AITownList"; }
};
#endif /* AI_TOWNLIST_HPP */
--- a/src/ai/api/ai_vehiclelist.hpp Tue Mar 25 12:16:30 2008 +0000
+++ b/src/ai/api/ai_vehiclelist.hpp Tue Mar 25 12:20:42 2008 +0000
@@ -16,9 +16,6 @@
public:
static const char *GetClassName() { return "AIVehicleList"; }
AIVehicleList();
-
-private:
- const char *GetListName() const { return "AIVehicleList"; }
};
/**
@@ -33,9 +30,6 @@
* @param station_id The station to get the list of vehicles that have orders to him from.
*/
AIVehicleList_Station(StationID station_id);
-
-private:
- const char *GetListName() const { return "AIVehicleList"; }
};
#endif /* AI_VEHICLELIST_HPP */