src/ai/api/ai_engine.hpp.sq
author rubidium
Mon, 26 May 2008 20:00:18 +0000
branchnoai
changeset 10722 6ea1daff57aa
parent 10668 495789401303
child 10734 06f95974ac15
permissions -rw-r--r--
(svn r13272) [NoAI] -Codechange: strdup all parameter strings coming from Squirrel going into the API after the possible WChar* -> char* conversion and free them after return.
[NoAI] -Fix: signs getting strange names because the FS2OTTD buffer was already overwritten by commands/print attempts of other AIs.
10212
1e0a2a182253 (svn r12744) [NoAI] -Fix: added a comment to all .hpp.sq that those files are autogenerated, and shouldn't be manually altered
truebrain
parents: 9809
diff changeset
     1
/* $Id$ */
1e0a2a182253 (svn r12744) [NoAI] -Fix: added a comment to all .hpp.sq that those files are autogenerated, and shouldn't be manually altered
truebrain
parents: 9809
diff changeset
     2
/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */
1e0a2a182253 (svn r12744) [NoAI] -Fix: added a comment to all .hpp.sq that those files are autogenerated, and shouldn't be manually altered
truebrain
parents: 9809
diff changeset
     3
9711
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents:
diff changeset
     4
#include "ai_engine.hpp"
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents:
diff changeset
     5
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents:
diff changeset
     6
namespace SQConvert {
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents:
diff changeset
     7
	/* Allow AIEngine to be used as Squirrel parameter */
10722
6ea1daff57aa (svn r13272) [NoAI] -Codechange: strdup all parameter strings coming from Squirrel going into the API after the possible WChar* -> char* conversion and free them after return.
rubidium
parents: 10668
diff changeset
     8
	template <> AIEngine *GetParam(ForceType<AIEngine *>, HSQUIRRELVM vm, int index, SQConvertedStrings *str) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEngine *)instance; }
6ea1daff57aa (svn r13272) [NoAI] -Codechange: strdup all parameter strings coming from Squirrel going into the API after the possible WChar* -> char* conversion and free them after return.
rubidium
parents: 10668
diff changeset
     9
	template <> AIEngine &GetParam(ForceType<AIEngine &>, HSQUIRRELVM vm, int index, SQConvertedStrings *str) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEngine *)instance; }
6ea1daff57aa (svn r13272) [NoAI] -Codechange: strdup all parameter strings coming from Squirrel going into the API after the possible WChar* -> char* conversion and free them after return.
rubidium
parents: 10668
diff changeset
    10
	template <> const AIEngine *GetParam(ForceType<const AIEngine *>, HSQUIRRELVM vm, int index, SQConvertedStrings *str) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return  (AIEngine *)instance; }
6ea1daff57aa (svn r13272) [NoAI] -Codechange: strdup all parameter strings coming from Squirrel going into the API after the possible WChar* -> char* conversion and free them after return.
rubidium
parents: 10668
diff changeset
    11
	template <> const AIEngine &GetParam(ForceType<const AIEngine &>, HSQUIRRELVM vm, int index, SQConvertedStrings *str) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIEngine *)instance; }
9711
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents:
diff changeset
    12
	template <> int Return<AIEngine *>(HSQUIRRELVM vm, AIEngine *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AIEngine", res, NULL, DefSQDestructorCallback<AIEngine>); return 1; }
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents:
diff changeset
    13
}; // namespace SQConvert
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents:
diff changeset
    14
9741
53c1c5850e01 (svn r12221) [NoAI] -Fix: Register functions are no _Register functions, and always on top of the sort list
truebrain
parents: 9733
diff changeset
    15
void SQAIEngine_Register(Squirrel *engine) {
9711
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents:
diff changeset
    16
	DefSQClass <AIEngine> SQAIEngine("AIEngine");
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents:
diff changeset
    17
	SQAIEngine.PreRegister(engine);
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents:
diff changeset
    18
	SQAIEngine.AddConstructor<void (AIEngine::*)(), 1>(engine, "x");
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents:
diff changeset
    19
9713
7cd214115969 (svn r11297) [NoAI] -Add: in AIEngine, added: GetName, GetCargoType, GetCapacity, GetReliability, GetMaxSpeed, GetVehicleType, and GetPrice (on request by Kilinich)
truelight
parents: 9711
diff changeset
    20
	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetClassName,   "GetClassName",   1, "x");
7cd214115969 (svn r11297) [NoAI] -Add: in AIEngine, added: GetName, GetCargoType, GetCapacity, GetReliability, GetMaxSpeed, GetVehicleType, and GetPrice (on request by Kilinich)
truelight
parents: 9711
diff changeset
    21
	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::IsValidEngine,  "IsValidEngine",  2, "xi");
7cd214115969 (svn r11297) [NoAI] -Add: in AIEngine, added: GetName, GetCargoType, GetCapacity, GetReliability, GetMaxSpeed, GetVehicleType, and GetPrice (on request by Kilinich)
truelight
parents: 9711
diff changeset
    22
	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetName,        "GetName",        2, "xi");
7cd214115969 (svn r11297) [NoAI] -Add: in AIEngine, added: GetName, GetCargoType, GetCapacity, GetReliability, GetMaxSpeed, GetVehicleType, and GetPrice (on request by Kilinich)
truelight
parents: 9711
diff changeset
    23
	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetCargoType,   "GetCargoType",   2, "xi");
9809
9b21c21052fa (svn r12325) [NoAI] -Add: added AIEngine:CanRefitCargo()
truebrain
parents: 9741
diff changeset
    24
	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::CanRefitCargo,  "CanRefitCargo",  3, "xii");
9713
7cd214115969 (svn r11297) [NoAI] -Add: in AIEngine, added: GetName, GetCargoType, GetCapacity, GetReliability, GetMaxSpeed, GetVehicleType, and GetPrice (on request by Kilinich)
truelight
parents: 9711
diff changeset
    25
	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetCapacity,    "GetCapacity",    2, "xi");
7cd214115969 (svn r11297) [NoAI] -Add: in AIEngine, added: GetName, GetCargoType, GetCapacity, GetReliability, GetMaxSpeed, GetVehicleType, and GetPrice (on request by Kilinich)
truelight
parents: 9711
diff changeset
    26
	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetReliability, "GetReliability", 2, "xi");
7cd214115969 (svn r11297) [NoAI] -Add: in AIEngine, added: GetName, GetCargoType, GetCapacity, GetReliability, GetMaxSpeed, GetVehicleType, and GetPrice (on request by Kilinich)
truelight
parents: 9711
diff changeset
    27
	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetMaxSpeed,    "GetMaxSpeed",    2, "xi");
7cd214115969 (svn r11297) [NoAI] -Add: in AIEngine, added: GetName, GetCargoType, GetCapacity, GetReliability, GetMaxSpeed, GetVehicleType, and GetPrice (on request by Kilinich)
truelight
parents: 9711
diff changeset
    28
	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetPrice,       "GetPrice",       2, "xi");
9733
49e424cd4edd (svn r12212) [NoAI] -Add: added AIEngine::GetMaxAge, AIEngine::GetRunningCost and AIVehicle::GetRunningCost (Morloth)
truebrain
parents: 9715
diff changeset
    29
	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetMaxAge,      "GetMaxAge",      2, "xi");
49e424cd4edd (svn r12212) [NoAI] -Add: added AIEngine::GetMaxAge, AIEngine::GetRunningCost and AIVehicle::GetRunningCost (Morloth)
truebrain
parents: 9715
diff changeset
    30
	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetRunningCost, "GetRunningCost", 2, "xi");
9713
7cd214115969 (svn r11297) [NoAI] -Add: in AIEngine, added: GetName, GetCargoType, GetCapacity, GetReliability, GetMaxSpeed, GetVehicleType, and GetPrice (on request by Kilinich)
truelight
parents: 9711
diff changeset
    31
	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetVehicleType, "GetVehicleType", 2, "xi");
10668
495789401303 (svn r13212) [NoAI] -Add: introducing the ability to build trams. Use AIRoad.SetCurrentRoadType to switch to Trams, than all AIRoad functions will produce tram-objects.
truebrain
parents: 10212
diff changeset
    32
	SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetRoadType,    "GetRoadType",    2, "xi");
9711
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents:
diff changeset
    33
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents:
diff changeset
    34
	SQAIEngine.PostRegister(engine);
c8b427215c9d (svn r11295) [NoAI] -Change [API CHANGE]: put Engine things in AIEngine, and rename functions as such. Most noticable: FindBestXXXVehicle -> FineBestXXXEngine
truelight
parents:
diff changeset
    35
}