src/ai/api/ai_transactionmode.hpp.sq
author truelight
Wed, 02 May 2007 12:47:16 +0000
branchnoai
changeset 9609 f0dbf5850145
parent 9596 8af5a1399842
child 9610 5cebcd43a1ec
permissions -rw-r--r--
(svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
[NoAI] -Update: updated squirrel_export to create template-tag for constructors
[NoAI] -Add: added AITileListCargoAcceptance, to get acceptance of a tile
[NoAI] -Update: updated regression to test AITileListCargoAcceptance
9596
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
     1
#include "ai_transactionmode.hpp"
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
     2
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
     3
namespace SQConvert {
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
     4
	/* Allow AITransactionMode to be used as Squirrel parameter */
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
     5
	template <> AITransactionMode *GetParam(ForceType<AITransactionMode *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITransactionMode *)instance; }
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
     6
	template <> AITransactionMode &GetParam(ForceType<AITransactionMode &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITransactionMode *)instance; }
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
     7
	template <> const AITransactionMode *GetParam(ForceType<const AITransactionMode *>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AITransactionMode *)instance; }
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
     8
	template <> const AITransactionMode &GetParam(ForceType<const AITransactionMode &>, HSQUIRRELVM vm, int index) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AITransactionMode *)instance; }
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
     9
}; // namespace SQConvert
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    10
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    11
void SQAITransactionModeRegister(Squirrel *engine) {
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    12
	DefSQClass <AITransactionMode> SQAITransactionMode("AITransactionMode");
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    13
	SQAITransactionMode.PreRegister(engine);
9609
f0dbf5850145 (svn r9767) [NoAI] -Add: add support for params in the constructor (via C++ templates)
truelight
parents: 9596
diff changeset
    14
	SQAITransactionMode.AddConstructor<void (AITransactionMode::*)()>(engine);
9596
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    15
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    16
	SQAITransactionMode.DefSQStaticMethod(engine, &AITransactionMode::GetClassName, "GetClassName", 1, "x");
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    17
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    18
	SQAITransactionMode.DefSQMethod(engine, &AITransactionMode::Execute,  "Execute",  1, "x");
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    19
	SQAITransactionMode.DefSQMethod(engine, &AITransactionMode::Stop,     "Stop",     1, "x");
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    20
	SQAITransactionMode.DefSQMethod(engine, &AITransactionMode::Rollback, "Rollback", 1, "x");
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    21
	SQAITransactionMode.DefSQMethod(engine, &AITransactionMode::GetCosts, "GetCosts", 1, "x");
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    22
	SQAITransactionMode.DefSQMethod(engine, &AITransactionMode::Append,   "Append",   2, "xx");
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    23
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    24
	SQAITransactionMode.PostRegister(engine);
8af5a1399842 (svn r9629) [NoAI] -Codechange: move the squirrel export functions out of the API header files.
rubidium
parents:
diff changeset
    25
}