src/ai/api/ai_tilelist_valuator.hpp
branchnoai
changeset 9592 c5c09cfde63a
child 9593 012f29f59906
equal deleted inserted replaced
9591:cd88f4b7cba0 9592:c5c09cfde63a
       
     1 /* $Id$ */
       
     2 
       
     3 /** @file ai_tilelist.hpp all the valuators for tilelist */
       
     4 
       
     5 #ifndef AI_TILELIST_VALUATOR_HPP
       
     6 #define AI_TILELIST_VALUATOR_HPP
       
     7 
       
     8 #include "ai_list.hpp"
       
     9 
       
    10 /**
       
    11  * Check if tiles are buildable for entries in an AITownList instance.
       
    12  * @note resulting items are of the type bool (0 = not buildable, 1 = buildable)
       
    13  * @note the input items are of the type TileIndex
       
    14  */
       
    15 class AITileListBuildable : public AIList::Valuator {
       
    16 public:
       
    17 	/**
       
    18 	 * The name of the class, needed by several sub-processes.
       
    19 	 */
       
    20 	static const char *GetClassName() { return "AITileListBuildable"; }
       
    21 
       
    22 private:
       
    23 	int32 Valuate(int32 tile) const;
       
    24 };
       
    25 
       
    26 #ifdef DEFINE_SQUIRREL_CLASS
       
    27 namespace SQConvert {
       
    28 	/* Allow AITileListBuildable to be used as Squirrel parameter */
       
    29 	template <> AITileListBuildable *GetParam(ForceType<AITileListBuildable *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AITileListBuildable *)instance; }
       
    30 }; // namespace SQConvert
       
    31 
       
    32 void SQAITileListBuildableRegister(Squirrel *engine) {
       
    33 	DefSQClass <AITileListBuildable> SQAITileListBuildable("AITileListBuildable");
       
    34 	SQAITileListBuildable.PreRegister(engine);
       
    35 	SQAITileListBuildable.AddConstructor(engine);
       
    36 
       
    37 	SQAITileListBuildable.DefSQStaticMethod(engine, &AITileListBuildable::GetClassName, "GetClassName", 1, "x");
       
    38 
       
    39 	SQAITileListBuildable.PostRegister(engine);
       
    40 }
       
    41 #endif /* DEFINE_SQUIRREL_CLASS */
       
    42 
       
    43 #endif /* AI_TILELIST_VALUATOR_HPP */