--- a/src/ai/api/ai_list.hpp Fri Apr 13 09:52:18 2007 +0000
+++ b/src/ai/api/ai_list.hpp Sat Apr 14 09:44:18 2007 +0000
@@ -175,23 +175,25 @@
* The definition how valuators should look.
*/
class Valuator {
+ friend class AIList;
public:
virtual ~Valuator() {}
- virtual int32 Valuate(const int32 item) = 0;
+ private:
+ virtual int32 Valuate(int32 item) const = 0;
};
/**
* Give all items a value defined by the valuator you give.
* @note the valuator should be a valid instance.
*/
- void Valuate(AIList::Valuator *proc);
+ void Valuate(const AIList::Valuator &proc);
};
#ifdef DEFINE_SQUIRREL_CLASS
namespace SQConvert {
/* Allow inner classes/structs to be used as Squirrel parameters */
- template <> AIList::Valuator *GetParam(ForceType<AIList::Valuator *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIList::Valuator *)instance; }
+ template <> const AIList::Valuator &GetParam(ForceType<const AIList::Valuator &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIList::Valuator *)instance; }
/* Allow AIList to be used as Squirrel parameter */
template <> AIList *GetParam(ForceType<AIList *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIList *)instance; }