src/ai/api/ai_tilelist_valuator.hpp
author rubidium
Sat, 14 Apr 2007 20:38:10 +0000
branchnoai
changeset 9594 5009a30f320a
parent 9593 012f29f59906
child 9595 91423dbb6f5f
permissions -rw-r--r--
(svn r9627) [NoAI] -Fix: let the squirrel export script export all needed (and a few more) types of references to structs and classes.
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
     1
/* $Id$ */
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
     2
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
     3
/** @file ai_tilelist.hpp all the valuators for tilelist */
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
     4
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
     5
#ifndef AI_TILELIST_VALUATOR_HPP
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
     6
#define AI_TILELIST_VALUATOR_HPP
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
     7
9593
012f29f59906 (svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents: 9592
diff changeset
     8
#include "ai_abstractlist.hpp"
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
     9
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    10
/**
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    11
 * Check if tiles are buildable for entries in an AITownList instance.
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    12
 * @note resulting items are of the type bool (0 = not buildable, 1 = buildable)
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    13
 * @note the input items are of the type TileIndex
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    14
 */
9593
012f29f59906 (svn r9626) [NoAI] -Change: renamed AIList to AIAbstractList and hide 'AddItem' and 'RemoveItem'
truelight
parents: 9592
diff changeset
    15
class AITileListBuildable : public AIAbstractList::Valuator {
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    16
public:
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    17
	/**
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    18
	 * The name of the class, needed by several sub-processes.
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    19
	 */
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    20
	static const char *GetClassName() { return "AITileListBuildable"; }
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    21
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    22
private:
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    23
	int32 Valuate(int32 tile) const;
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    24
};
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    25
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    26
#ifdef DEFINE_SQUIRREL_CLASS
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    27
namespace SQConvert {
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    28
	/* Allow AITileListBuildable to be used as Squirrel parameter */
9594
5009a30f320a (svn r9627) [NoAI] -Fix: let the squirrel export script export all needed (and a few more) types of references to structs and classes.
rubidium
parents: 9593
diff changeset
    29
	template <> AITileListBuildable *GetParam(ForceType<AITileListBuildable *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITileListBuildable *)instance; }
5009a30f320a (svn r9627) [NoAI] -Fix: let the squirrel export script export all needed (and a few more) types of references to structs and classes.
rubidium
parents: 9593
diff changeset
    30
	template <> AITileListBuildable &GetParam(ForceType<AITileListBuildable &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITileListBuildable *)instance; }
5009a30f320a (svn r9627) [NoAI] -Fix: let the squirrel export script export all needed (and a few more) types of references to structs and classes.
rubidium
parents: 9593
diff changeset
    31
	template <> const AITileListBuildable *GetParam(ForceType<const AITileListBuildable *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITileListBuildable *)instance; }
5009a30f320a (svn r9627) [NoAI] -Fix: let the squirrel export script export all needed (and a few more) types of references to structs and classes.
rubidium
parents: 9593
diff changeset
    32
	template <> const AITileListBuildable &GetParam(ForceType<const AITileListBuildable &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITileListBuildable *)instance; }
9592
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    33
}; // namespace SQConvert
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    34
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    35
void SQAITileListBuildableRegister(Squirrel *engine) {
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    36
	DefSQClass <AITileListBuildable> SQAITileListBuildable("AITileListBuildable");
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    37
	SQAITileListBuildable.PreRegister(engine);
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    38
	SQAITileListBuildable.AddConstructor(engine);
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    39
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    40
	SQAITileListBuildable.DefSQStaticMethod(engine, &AITileListBuildable::GetClassName, "GetClassName", 1, "x");
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    41
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    42
	SQAITileListBuildable.PostRegister(engine);
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    43
}
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    44
#endif /* DEFINE_SQUIRREL_CLASS */
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    45
c5c09cfde63a (svn r9625) [NoAI] -Add: added AITileList() and one valuator for now: AITileListBuildable()
truelight
parents:
diff changeset
    46
#endif /* AI_TILELIST_VALUATOR_HPP */