(svn r9189) [NoAI] -Cleanup: cleaned up DefSQClass a bit by using the SquirrelEngine noai
authortruelight
Thu, 15 Mar 2007 00:27:28 +0000
branchnoai
changeset 9397 d8f8db9c1a2e
parent 9396 a05857491d2d
child 9398 a9479d5aa957
(svn r9189) [NoAI] -Cleanup: cleaned up DefSQClass a bit by using the SquirrelEngine
wrappers instead of doing it ourself.
-Add: added a AddMethod overload which takes userdata as extra param
src/ai/core/ai_base.hpp
src/ai/core/ai_company.hpp
src/ai/core/ai_map.hpp
src/ai/core/ai_town.hpp
--- a/src/ai/core/ai_base.hpp	Thu Mar 15 00:27:12 2007 +0000
+++ b/src/ai/core/ai_base.hpp	Thu Mar 15 00:27:28 2007 +0000
@@ -40,13 +40,13 @@
 };
 
 #ifdef SQUIRREL_CLASS
-void SQAIBaseRegister(HSQUIRRELVM vm) {
+void SQAIBaseRegister(SquirrelEngine *engine) {
 	DefSQClass <AIBase> SQAIBase("AIBase");
-	SQAIBase.PreRegister(vm);
-	SQAIBase.DefSQFunction(vm, &AIBase::Random,      "Random");
-	SQAIBase.DefSQFunction(vm, &AIBase::RandomRange, "RandomRange");
-	SQAIBase.DefSQFunction(vm, &AIBase::Chance,      "Chance");
-	SQAIBase.PostRegister(vm);
+	SQAIBase.PreRegister(engine);
+	SQAIBase.DefSQFunction(engine, &AIBase::Random,      "Random");
+	SQAIBase.DefSQFunction(engine, &AIBase::RandomRange, "RandomRange");
+	SQAIBase.DefSQFunction(engine, &AIBase::Chance,      "Chance");
+	SQAIBase.PostRegister(engine);
 }
 #endif /* SQUIRREL_CLASS */
 
--- a/src/ai/core/ai_company.hpp	Thu Mar 15 00:27:12 2007 +0000
+++ b/src/ai/core/ai_company.hpp	Thu Mar 15 00:27:28 2007 +0000
@@ -72,18 +72,18 @@
 };
 
 #ifdef SQUIRREL_CLASS
-void SQAICompanyRegister(HSQUIRRELVM vm) {
+void SQAICompanyRegister(SquirrelEngine *engine) {
 	DefSQClass <AICompany> SQAICompany("AICompany");
-	SQAICompany.PreRegister(vm);
-	SQAICompany.DefSQFunction(vm, &AICompany::SetCompanyName,   "SetCompanyName");
-	SQAICompany.DefSQFunction(vm, &AICompany::GetCompanyName,   "GetCompanyName");
-	SQAICompany.DefSQFunction(vm, &AICompany::GetCompanyValue,  "GetCompanyValue");
-	SQAICompany.DefSQFunction(vm, &AICompany::GetBankBalance,   "GetBankBalance");
-	SQAICompany.DefSQFunction(vm, &AICompany::GetLoanAmount,    "GetLoanAmount");
-	SQAICompany.DefSQFunction(vm, &AICompany::GetMaxLoanAmount, "GetMaxLoanAmount");
-	SQAICompany.DefSQFunction(vm, &AICompany::GetLoanInterval,  "GetLoanInterval");
-	SQAICompany.DefSQFunction(vm, &AICompany::SetLoanAmount,    "SetLoanAmount");
-	SQAICompany.PostRegister(vm);
+	SQAICompany.PreRegister(engine);
+	SQAICompany.DefSQFunction(engine, &AICompany::SetCompanyName,   "SetCompanyName");
+	SQAICompany.DefSQFunction(engine, &AICompany::GetCompanyName,   "GetCompanyName");
+	SQAICompany.DefSQFunction(engine, &AICompany::GetCompanyValue,  "GetCompanyValue");
+	SQAICompany.DefSQFunction(engine, &AICompany::GetBankBalance,   "GetBankBalance");
+	SQAICompany.DefSQFunction(engine, &AICompany::GetLoanAmount,    "GetLoanAmount");
+	SQAICompany.DefSQFunction(engine, &AICompany::GetMaxLoanAmount, "GetMaxLoanAmount");
+	SQAICompany.DefSQFunction(engine, &AICompany::GetLoanInterval,  "GetLoanInterval");
+	SQAICompany.DefSQFunction(engine, &AICompany::SetLoanAmount,    "SetLoanAmount");
+	SQAICompany.PostRegister(engine);
 }
 #endif /* SQUIRREL_CLASS */
 
--- a/src/ai/core/ai_map.hpp	Thu Mar 15 00:27:12 2007 +0000
+++ b/src/ai/core/ai_map.hpp	Thu Mar 15 00:27:28 2007 +0000
@@ -57,16 +57,16 @@
 };
 
 #ifdef SQUIRREL_CLASS
-void SQAIMapRegister(HSQUIRRELVM vm) {
+void SQAIMapRegister(SquirrelEngine *engine) {
 	DefSQClass <AIMap> SQAIMap("AIMap");
-	SQAIMap.PreRegister(vm);
-	SQAIMap.DefSQFunction(vm, &AIMap::IsValidTile, "IsValidTile");
-	SQAIMap.DefSQFunction(vm, &AIMap::GetMapSize,  "GetMapSize");
-	SQAIMap.DefSQFunction(vm, &AIMap::GetMapSizeX, "GetMapSizeX");
-	SQAIMap.DefSQFunction(vm, &AIMap::GetMapSizeY, "GetMapSizeY");
-	SQAIMap.DefSQFunction(vm, &AIMap::GetTileX,    "GetTileX");
-	SQAIMap.DefSQFunction(vm, &AIMap::GetTileY,    "GetTileY");
-	SQAIMap.PostRegister(vm);
+	SQAIMap.PreRegister(engine);
+	SQAIMap.DefSQFunction(engine, &AIMap::IsValidTile, "IsValidTile");
+	SQAIMap.DefSQFunction(engine, &AIMap::GetMapSize,  "GetMapSize");
+	SQAIMap.DefSQFunction(engine, &AIMap::GetMapSizeX, "GetMapSizeX");
+	SQAIMap.DefSQFunction(engine, &AIMap::GetMapSizeY, "GetMapSizeY");
+	SQAIMap.DefSQFunction(engine, &AIMap::GetTileX,    "GetTileX");
+	SQAIMap.DefSQFunction(engine, &AIMap::GetTileY,    "GetTileY");
+	SQAIMap.PostRegister(engine);
 }
 #endif /* SQUIRREL_CLASS */
 
--- a/src/ai/core/ai_town.hpp	Thu Mar 15 00:27:12 2007 +0000
+++ b/src/ai/core/ai_town.hpp	Thu Mar 15 00:27:28 2007 +0000
@@ -59,16 +59,16 @@
 };
 
 #ifdef SQUIRREL_CLASS
-void SQAITownRegister(HSQUIRRELVM vm) {
+void SQAITownRegister(SquirrelEngine *engine) {
 	DefSQClass <AITown> SQAITown("AITown");
-	SQAITown.PreRegister(vm);
-	SQAITown.DefSQFunction(vm, &AITown::GetMaxTownID,  "GetMaxTownID");
-	SQAITown.DefSQFunction(vm, &AITown::GetTownCount,  "GetTownCount");
-	SQAITown.DefSQFunction(vm, &AITown::IsValidTown,   "IsValidTown");
-	SQAITown.DefSQFunction(vm, &AITown::GetName,       "GetName");
-	SQAITown.DefSQFunction(vm, &AITown::GetPopulation, "GetPopulation");
-	SQAITown.DefSQFunction(vm, &AITown::GetLocation,   "GetLocation");
-	SQAITown.PostRegister(vm);
+	SQAITown.PreRegister(engine);
+	SQAITown.DefSQFunction(engine, &AITown::GetMaxTownID,  "GetMaxTownID");
+	SQAITown.DefSQFunction(engine, &AITown::GetTownCount,  "GetTownCount");
+	SQAITown.DefSQFunction(engine, &AITown::IsValidTown,   "IsValidTown");
+	SQAITown.DefSQFunction(engine, &AITown::GetName,       "GetName");
+	SQAITown.DefSQFunction(engine, &AITown::GetPopulation, "GetPopulation");
+	SQAITown.DefSQFunction(engine, &AITown::GetLocation,   "GetLocation");
+	SQAITown.PostRegister(engine);
 }
 #endif /* SQUIRREL_CLASS */