(svn r10526) [NoAI] -Fix: a class with params for the constructor lost his instance when called from SQ (templates can be really useful ;))
--- a/src/ai/api/ai_abstractlist.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_abstractlist.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -17,7 +17,7 @@
void SQAIAbstractListRegister(Squirrel *engine) {
DefSQClass <AIAbstractList> SQAIAbstractList("AIAbstractList");
SQAIAbstractList.PreRegister(engine);
- SQAIAbstractList.AddConstructor<void (AIAbstractList::*)()>(engine, 1, "x");
+ SQAIAbstractList.AddConstructor<void (AIAbstractList::*)(), 1>(engine, "x");
SQAIAbstractList.DefSQStaticMethod(engine, &AIAbstractList::GetClassName, "GetClassName", 1, "x");
--- a/src/ai/api/ai_accounting.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_accounting.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAIAccountingRegister(Squirrel *engine) {
DefSQClass <AIAccounting> SQAIAccounting("AIAccounting");
SQAIAccounting.PreRegister(engine);
- SQAIAccounting.AddConstructor<void (AIAccounting::*)()>(engine, 1, "x");
+ SQAIAccounting.AddConstructor<void (AIAccounting::*)(), 1>(engine, "x");
SQAIAccounting.DefSQStaticMethod(engine, &AIAccounting::GetClassName, "GetClassName", 1, "x");
--- a/src/ai/api/ai_base.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_base.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAIBaseRegister(Squirrel *engine) {
DefSQClass <AIBase> SQAIBase("AIBase");
SQAIBase.PreRegister(engine);
- SQAIBase.AddConstructor<void (AIBase::*)()>(engine, 1, "x");
+ SQAIBase.AddConstructor<void (AIBase::*)(), 1>(engine, "x");
SQAIBase.DefSQStaticMethod(engine, &AIBase::GetClassName, "GetClassName", 1, "x");
--- a/src/ai/api/ai_cargo.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_cargo.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAICargoRegister(Squirrel *engine) {
DefSQClass <AICargo> SQAICargo("AICargo");
SQAICargo.PreRegister(engine);
- SQAICargo.AddConstructor<void (AICargo::*)()>(engine, 1, "x");
+ SQAICargo.AddConstructor<void (AICargo::*)(), 1>(engine, "x");
SQAICargo.DefSQStaticMethod(engine, &AICargo::GetClassName, "GetClassName", 1, "x");
SQAICargo.DefSQStaticMethod(engine, &AICargo::IsValidCargo, "IsValidCargo", 2, "xi");
--- a/src/ai/api/ai_company.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_company.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAICompanyRegister(Squirrel *engine) {
DefSQClass <AICompany> SQAICompany("AICompany");
SQAICompany.PreRegister(engine);
- SQAICompany.AddConstructor<void (AICompany::*)()>(engine, 1, "x");
+ SQAICompany.AddConstructor<void (AICompany::*)(), 1>(engine, "x");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetClassName, "GetClassName", 1, "x");
--- a/src/ai/api/ai_execmode.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_execmode.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAIExecModeRegister(Squirrel *engine) {
DefSQClass <AIExecMode> SQAIExecMode("AIExecMode");
SQAIExecMode.PreRegister(engine);
- SQAIExecMode.AddConstructor<void (AIExecMode::*)()>(engine, 1, "x");
+ SQAIExecMode.AddConstructor<void (AIExecMode::*)(), 1>(engine, "x");
SQAIExecMode.DefSQStaticMethod(engine, &AIExecMode::GetClassName, "GetClassName", 1, "x");
--- a/src/ai/api/ai_industry.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_industry.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAIIndustryRegister(Squirrel *engine) {
DefSQClass <AIIndustry> SQAIIndustry("AIIndustry");
SQAIIndustry.PreRegister(engine);
- SQAIIndustry.AddConstructor<void (AIIndustry::*)()>(engine, 1, "x");
+ SQAIIndustry.AddConstructor<void (AIIndustry::*)(), 1>(engine, "x");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetClassName, "GetClassName", 1, "x");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::IsValidIndustry, "IsValidIndustry", 2, "xi");
--- a/src/ai/api/ai_list.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_list.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAIListRegister(Squirrel *engine) {
DefSQClass <AIList> SQAIList("AIList");
SQAIList.PreRegister(engine, "AIAbstractList");
- SQAIList.AddConstructor<void (AIList::*)()>(engine, 1, "x");
+ SQAIList.AddConstructor<void (AIList::*)(), 1>(engine, "x");
SQAIList.DefSQStaticMethod(engine, &AIList::GetClassName, "GetClassName", 1, "x");
--- a/src/ai/api/ai_map.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_map.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAIMapRegister(Squirrel *engine) {
DefSQClass <AIMap> SQAIMap("AIMap");
SQAIMap.PreRegister(engine);
- SQAIMap.AddConstructor<void (AIMap::*)()>(engine, 1, "x");
+ SQAIMap.AddConstructor<void (AIMap::*)(), 1>(engine, "x");
SQAIMap.DefSQStaticMethod(engine, &AIMap::GetClassName, "GetClassName", 1, "x");
--- a/src/ai/api/ai_order.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_order.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -15,7 +15,7 @@
void SQAIOrderRegister(Squirrel *engine) {
DefSQClass <AIOrder> SQAIOrder("AIOrder");
SQAIOrder.PreRegister(engine);
- SQAIOrder.AddConstructor<void (AIOrder::*)()>(engine, 1, "x");
+ SQAIOrder.AddConstructor<void (AIOrder::*)(), 1>(engine, "x");
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_NONE, "AIOF_NONE");
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_TRANSFER, "AIOF_TRANSFER");
--- a/src/ai/api/ai_road.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_road.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAIRoadRegister(Squirrel *engine) {
DefSQClass <AIRoad> SQAIRoad("AIRoad");
SQAIRoad.PreRegister(engine);
- SQAIRoad.AddConstructor<void (AIRoad::*)()>(engine, 1, "x");
+ SQAIRoad.AddConstructor<void (AIRoad::*)(), 1>(engine, "x");
SQAIRoad.DefSQStaticMethod(engine, &AIRoad::GetClassName, "GetClassName", 1, "x");
SQAIRoad.DefSQStaticMethod(engine, &AIRoad::GetNeighbourRoadCount, "GetNeighbourRoadCount", 2, "xi");
--- a/src/ai/api/ai_settings.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_settings.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAISettingsRegister(Squirrel *engine) {
DefSQClass <AISettings> SQAISettings("AISettings");
SQAISettings.PreRegister(engine);
- SQAISettings.AddConstructor<void (AISettings::*)()>(engine, 1, "x");
+ SQAISettings.AddConstructor<void (AISettings::*)(), 1>(engine, "x");
SQAISettings.DefSQStaticMethod(engine, &AISettings::GetClassName, "GetClassName", 1, "x");
--- a/src/ai/api/ai_sign.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_sign.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAISignRegister(Squirrel *engine) {
DefSQClass <AISign> SQAISign("AISign");
SQAISign.PreRegister(engine);
- SQAISign.AddConstructor<void (AISign::*)()>(engine, 1, "x");
+ SQAISign.AddConstructor<void (AISign::*)(), 1>(engine, "x");
SQAISign.DefSQStaticMethod(engine, &AISign::GetClassName, "GetClassName", 1, "x");
SQAISign.DefSQStaticMethod(engine, &AISign::IsValidSign, "IsValidSign", 2, "xi");
--- a/src/ai/api/ai_testmode.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_testmode.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAITestModeRegister(Squirrel *engine) {
DefSQClass <AITestMode> SQAITestMode("AITestMode");
SQAITestMode.PreRegister(engine);
- SQAITestMode.AddConstructor<void (AITestMode::*)()>(engine, 1, "x");
+ SQAITestMode.AddConstructor<void (AITestMode::*)(), 1>(engine, "x");
SQAITestMode.DefSQStaticMethod(engine, &AITestMode::GetClassName, "GetClassName", 1, "x");
--- a/src/ai/api/ai_tile.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_tile.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAITileRegister(Squirrel *engine) {
DefSQClass <AITile> SQAITile("AITile");
SQAITile.PreRegister(engine);
- SQAITile.AddConstructor<void (AITile::*)()>(engine, 1, "x");
+ SQAITile.AddConstructor<void (AITile::*)(), 1>(engine, "x");
SQAITile.DefSQStaticMethod(engine, &AITile::GetClassName, "GetClassName", 1, "x");
SQAITile.DefSQStaticMethod(engine, &AITile::IsBuildable, "IsBuildable", 2, "xi");
--- a/src/ai/api/ai_tilelist.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_tilelist.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAITileListRegister(Squirrel *engine) {
DefSQClass <AITileList> SQAITileList("AITileList");
SQAITileList.PreRegister(engine, "AIAbstractList");
- SQAITileList.AddConstructor<void (AITileList::*)()>(engine, 1, "x");
+ SQAITileList.AddConstructor<void (AITileList::*)(), 1>(engine, "x");
SQAITileList.DefSQStaticMethod(engine, &AITileList::GetClassName, "GetClassName", 1, "x");
--- a/src/ai/api/ai_tilelist_valuator.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_tilelist_valuator.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAITileListBuildableRegister(Squirrel *engine) {
DefSQClass <AITileListBuildable> SQAITileListBuildable("AITileListBuildable");
SQAITileListBuildable.PreRegister(engine);
- SQAITileListBuildable.AddConstructor<void (AITileListBuildable::*)()>(engine, 1, "x");
+ SQAITileListBuildable.AddConstructor<void (AITileListBuildable::*)(), 1>(engine, "x");
SQAITileListBuildable.DefSQStaticMethod(engine, &AITileListBuildable::GetClassName, "GetClassName", 1, "x");
@@ -29,7 +29,7 @@
void SQAITileListSlopeRegister(Squirrel *engine) {
DefSQClass <AITileListSlope> SQAITileListSlope("AITileListSlope");
SQAITileListSlope.PreRegister(engine);
- SQAITileListSlope.AddConstructor<void (AITileListSlope::*)()>(engine, 1, "x");
+ SQAITileListSlope.AddConstructor<void (AITileListSlope::*)(), 1>(engine, "x");
SQAITileListSlope.DefSQStaticMethod(engine, &AITileListSlope::GetClassName, "GetClassName", 1, "x");
@@ -47,7 +47,7 @@
void SQAITileListNeighbourRoadCountRegister(Squirrel *engine) {
DefSQClass <AITileListNeighbourRoadCount> SQAITileListNeighbourRoadCount("AITileListNeighbourRoadCount");
SQAITileListNeighbourRoadCount.PreRegister(engine);
- SQAITileListNeighbourRoadCount.AddConstructor<void (AITileListNeighbourRoadCount::*)()>(engine, 1, "x");
+ SQAITileListNeighbourRoadCount.AddConstructor<void (AITileListNeighbourRoadCount::*)(), 1>(engine, "x");
SQAITileListNeighbourRoadCount.DefSQStaticMethod(engine, &AITileListNeighbourRoadCount::GetClassName, "GetClassName", 1, "x");
@@ -65,7 +65,7 @@
void SQAITileListRoadTileRegister(Squirrel *engine) {
DefSQClass <AITileListRoadTile> SQAITileListRoadTile("AITileListRoadTile");
SQAITileListRoadTile.PreRegister(engine);
- SQAITileListRoadTile.AddConstructor<void (AITileListRoadTile::*)()>(engine, 1, "x");
+ SQAITileListRoadTile.AddConstructor<void (AITileListRoadTile::*)(), 1>(engine, "x");
SQAITileListRoadTile.DefSQStaticMethod(engine, &AITileListRoadTile::GetClassName, "GetClassName", 1, "x");
@@ -83,7 +83,7 @@
void SQAITileListCargoAcceptanceRegister(Squirrel *engine) {
DefSQClass <AITileListCargoAcceptance> SQAITileListCargoAcceptance("AITileListCargoAcceptance");
SQAITileListCargoAcceptance.PreRegister(engine);
- SQAITileListCargoAcceptance.AddConstructor<void (AITileListCargoAcceptance::*)(CargoID cargo_type)>(engine, 2, "xi");
+ SQAITileListCargoAcceptance.AddConstructor<void (AITileListCargoAcceptance::*)(CargoID cargo_type), 2>(engine, "xi");
SQAITileListCargoAcceptance.DefSQStaticMethod(engine, &AITileListCargoAcceptance::GetClassName, "GetClassName", 1, "x");
--- a/src/ai/api/ai_town.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_town.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAITownRegister(Squirrel *engine) {
DefSQClass <AITown> SQAITown("AITown");
SQAITown.PreRegister(engine);
- SQAITown.AddConstructor<void (AITown::*)()>(engine, 1, "x");
+ SQAITown.AddConstructor<void (AITown::*)(), 1>(engine, "x");
SQAITown.DefSQStaticMethod(engine, &AITown::GetClassName, "GetClassName", 1, "x");
SQAITown.DefSQStaticMethod(engine, &AITown::IsValidTown, "IsValidTown", 2, "xi");
--- a/src/ai/api/ai_townlist.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_townlist.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAITownListRegister(Squirrel *engine) {
DefSQClass <AITownList> SQAITownList("AITownList");
SQAITownList.PreRegister(engine, "AIAbstractList");
- SQAITownList.AddConstructor<void (AITownList::*)()>(engine, 1, "x");
+ SQAITownList.AddConstructor<void (AITownList::*)(), 1>(engine, "x");
SQAITownList.DefSQStaticMethod(engine, &AITownList::GetClassName, "GetClassName", 1, "x");
--- a/src/ai/api/ai_townlist_valuator.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_townlist_valuator.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAITownListPopulationRegister(Squirrel *engine) {
DefSQClass <AITownListPopulation> SQAITownListPopulation("AITownListPopulation");
SQAITownListPopulation.PreRegister(engine);
- SQAITownListPopulation.AddConstructor<void (AITownListPopulation::*)()>(engine, 1, "x");
+ SQAITownListPopulation.AddConstructor<void (AITownListPopulation::*)(), 1>(engine, "x");
SQAITownListPopulation.DefSQStaticMethod(engine, &AITownListPopulation::GetClassName, "GetClassName", 1, "x");
@@ -29,7 +29,7 @@
void SQAITownListLocationRegister(Squirrel *engine) {
DefSQClass <AITownListLocation> SQAITownListLocation("AITownListLocation");
SQAITownListLocation.PreRegister(engine);
- SQAITownListLocation.AddConstructor<void (AITownListLocation::*)()>(engine, 1, "x");
+ SQAITownListLocation.AddConstructor<void (AITownListLocation::*)(), 1>(engine, "x");
SQAITownListLocation.DefSQStaticMethod(engine, &AITownListLocation::GetClassName, "GetClassName", 1, "x");
--- a/src/ai/api/ai_transactionmode.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_transactionmode.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAITransactionModeRegister(Squirrel *engine) {
DefSQClass <AITransactionMode> SQAITransactionMode("AITransactionMode");
SQAITransactionMode.PreRegister(engine);
- SQAITransactionMode.AddConstructor<void (AITransactionMode::*)()>(engine, 1, "x");
+ SQAITransactionMode.AddConstructor<void (AITransactionMode::*)(), 1>(engine, "x");
SQAITransactionMode.DefSQStaticMethod(engine, &AITransactionMode::GetClassName, "GetClassName", 1, "x");
--- a/src/ai/api/ai_vehicle.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_vehicle.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAIVehicleRegister(Squirrel *engine) {
DefSQClass <AIVehicle> SQAIVehicle("AIVehicle");
SQAIVehicle.PreRegister(engine);
- SQAIVehicle.AddConstructor<void (AIVehicle::*)()>(engine, 1, "x");
+ SQAIVehicle.AddConstructor<void (AIVehicle::*)(), 1>(engine, "x");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetClassName, "GetClassName", 1, "x");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsValidEngine, "IsValidEngine", 2, "xi");
--- a/src/ai/api/ai_vehiclelist.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_vehiclelist.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAIVehicleListRegister(Squirrel *engine) {
DefSQClass <AIVehicleList> SQAIVehicleList("AIVehicleList");
SQAIVehicleList.PreRegister(engine, "AIAbstractList");
- SQAIVehicleList.AddConstructor<void (AIVehicleList::*)()>(engine, 1, "x");
+ SQAIVehicleList.AddConstructor<void (AIVehicleList::*)(), 1>(engine, "x");
SQAIVehicleList.DefSQStaticMethod(engine, &AIVehicleList::GetClassName, "GetClassName", 1, "x");
--- a/src/ai/api/ai_vehiclelist_valuator.hpp.sq Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/ai_vehiclelist_valuator.hpp.sq Thu Jul 12 15:04:26 2007 +0000
@@ -11,7 +11,7 @@
void SQAIVehicleListLocationRegister(Squirrel *engine) {
DefSQClass <AIVehicleListLocation> SQAIVehicleListLocation("AIVehicleListLocation");
SQAIVehicleListLocation.PreRegister(engine);
- SQAIVehicleListLocation.AddConstructor<void (AIVehicleListLocation::*)()>(engine, 1, "x");
+ SQAIVehicleListLocation.AddConstructor<void (AIVehicleListLocation::*)(), 1>(engine, "x");
SQAIVehicleListLocation.DefSQStaticMethod(engine, &AIVehicleListLocation::GetClassName, "GetClassName", 1, "x");
@@ -29,7 +29,7 @@
void SQAIVehicleListEngineTypeRegister(Squirrel *engine) {
DefSQClass <AIVehicleListEngineType> SQAIVehicleListEngineType("AIVehicleListEngineType");
SQAIVehicleListEngineType.PreRegister(engine);
- SQAIVehicleListEngineType.AddConstructor<void (AIVehicleListEngineType::*)()>(engine, 1, "x");
+ SQAIVehicleListEngineType.AddConstructor<void (AIVehicleListEngineType::*)(), 1>(engine, "x");
SQAIVehicleListEngineType.DefSQStaticMethod(engine, &AIVehicleListEngineType::GetClassName, "GetClassName", 1, "x");
@@ -47,7 +47,7 @@
void SQAIVehicleListUnitNumberRegister(Squirrel *engine) {
DefSQClass <AIVehicleListUnitNumber> SQAIVehicleListUnitNumber("AIVehicleListUnitNumber");
SQAIVehicleListUnitNumber.PreRegister(engine);
- SQAIVehicleListUnitNumber.AddConstructor<void (AIVehicleListUnitNumber::*)()>(engine, 1, "x");
+ SQAIVehicleListUnitNumber.AddConstructor<void (AIVehicleListUnitNumber::*)(), 1>(engine, "x");
SQAIVehicleListUnitNumber.DefSQStaticMethod(engine, &AIVehicleListUnitNumber::GetClassName, "GetClassName", 1, "x");
@@ -65,7 +65,7 @@
void SQAIVehicleListAgeRegister(Squirrel *engine) {
DefSQClass <AIVehicleListAge> SQAIVehicleListAge("AIVehicleListAge");
SQAIVehicleListAge.PreRegister(engine);
- SQAIVehicleListAge.AddConstructor<void (AIVehicleListAge::*)()>(engine, 1, "x");
+ SQAIVehicleListAge.AddConstructor<void (AIVehicleListAge::*)(), 1>(engine, "x");
SQAIVehicleListAge.DefSQStaticMethod(engine, &AIVehicleListAge::GetClassName, "GetClassName", 1, "x");
@@ -83,7 +83,7 @@
void SQAIVehicleListMaxAgeRegister(Squirrel *engine) {
DefSQClass <AIVehicleListMaxAge> SQAIVehicleListMaxAge("AIVehicleListMaxAge");
SQAIVehicleListMaxAge.PreRegister(engine);
- SQAIVehicleListMaxAge.AddConstructor<void (AIVehicleListMaxAge::*)()>(engine, 1, "x");
+ SQAIVehicleListMaxAge.AddConstructor<void (AIVehicleListMaxAge::*)(), 1>(engine, "x");
SQAIVehicleListMaxAge.DefSQStaticMethod(engine, &AIVehicleListMaxAge::GetClassName, "GetClassName", 1, "x");
@@ -101,7 +101,7 @@
void SQAIVehicleListAgeLeftRegister(Squirrel *engine) {
DefSQClass <AIVehicleListAgeLeft> SQAIVehicleListAgeLeft("AIVehicleListAgeLeft");
SQAIVehicleListAgeLeft.PreRegister(engine);
- SQAIVehicleListAgeLeft.AddConstructor<void (AIVehicleListAgeLeft::*)()>(engine, 1, "x");
+ SQAIVehicleListAgeLeft.AddConstructor<void (AIVehicleListAgeLeft::*)(), 1>(engine, "x");
SQAIVehicleListAgeLeft.DefSQStaticMethod(engine, &AIVehicleListAgeLeft::GetClassName, "GetClassName", 1, "x");
@@ -119,7 +119,7 @@
void SQAIVehicleListProfitThisYearRegister(Squirrel *engine) {
DefSQClass <AIVehicleListProfitThisYear> SQAIVehicleListProfitThisYear("AIVehicleListProfitThisYear");
SQAIVehicleListProfitThisYear.PreRegister(engine);
- SQAIVehicleListProfitThisYear.AddConstructor<void (AIVehicleListProfitThisYear::*)()>(engine, 1, "x");
+ SQAIVehicleListProfitThisYear.AddConstructor<void (AIVehicleListProfitThisYear::*)(), 1>(engine, "x");
SQAIVehicleListProfitThisYear.DefSQStaticMethod(engine, &AIVehicleListProfitThisYear::GetClassName, "GetClassName", 1, "x");
@@ -137,7 +137,7 @@
void SQAIVehicleListProfitLastYearRegister(Squirrel *engine) {
DefSQClass <AIVehicleListProfitLastYear> SQAIVehicleListProfitLastYear("AIVehicleListProfitLastYear");
SQAIVehicleListProfitLastYear.PreRegister(engine);
- SQAIVehicleListProfitLastYear.AddConstructor<void (AIVehicleListProfitLastYear::*)()>(engine, 1, "x");
+ SQAIVehicleListProfitLastYear.AddConstructor<void (AIVehicleListProfitLastYear::*)(), 1>(engine, "x");
SQAIVehicleListProfitLastYear.DefSQStaticMethod(engine, &AIVehicleListProfitLastYear::GetClassName, "GetClassName", 1, "x");
--- a/src/ai/api/squirrel_export.awk Thu Jul 12 14:55:28 2007 +0000
+++ b/src/ai/api/squirrel_export.awk Thu Jul 12 15:04:26 2007 +0000
@@ -169,7 +169,7 @@
} else {
print " SQ" cls ".PreRegister(engine, \"" super_cls "\");"
}
- print " SQ" cls ".AddConstructor<void (" cls "::*)(" cls_param[0] ")>(engine, " cls_param[1] ", \"" cls_param[2] "\");"
+ print " SQ" cls ".AddConstructor<void (" cls "::*)(" cls_param[0] "), " cls_param[1]">(engine, \"" cls_param[2] "\");"
print ""
# Enum values
--- a/src/squirrel_class.hpp Thu Jul 12 14:55:28 2007 +0000
+++ b/src/squirrel_class.hpp Thu Jul 12 15:04:26 2007 +0000
@@ -90,11 +90,11 @@
engine->AddClassBegin(this->classname, parent_class);
}
- template <typename Func>
- void AddConstructor(Squirrel *engine, int nparam, const char *params)
+ template <typename Func, int Tnparam>
+ void AddConstructor(Squirrel *engine, const char *params)
{
using namespace SQConvert;
- engine->AddMethod("constructor", DefSQConstructorCallback<CL, Func>, nparam, params);
+ engine->AddMethod("constructor", DefSQConstructorCallback<CL, Func, Tnparam>, Tnparam, params);
}
void PostRegister(Squirrel *engine)
--- a/src/squirrel_helper.hpp Thu Jul 12 14:55:28 2007 +0000
+++ b/src/squirrel_helper.hpp Thu Jul 12 15:04:26 2007 +0000
@@ -446,6 +446,7 @@
sq_getinstanceup(vm, 1, &real_instance, 0);
/* Get the real function pointer */
sq_getuserdata(vm, nparam, &ptr, 0);
+ if (real_instance == NULL) return sq_throwerror(vm, _SC("couldn't detect real instance of class for non-static call"));
/* Delegate it to a template that can handle this specific function */
return HelperT<Tmethod>::SQCall((Tcls *)real_instance, *(Tmethod *)ptr, vm);
@@ -487,13 +488,13 @@
* params. It creates the instance in C++, and it sets all the needed
* settings in SQ to register the instance.
*/
- template <typename Tcls, typename Tmethod>
+ template <typename Tcls, typename Tmethod, int Tnparam>
inline SQInteger DefSQConstructorCallback(HSQUIRRELVM vm)
{
/* Create the real instance */
Tcls *instance = HelperT<Tmethod>::SQConstruct((Tcls *)NULL, (Tmethod)NULL, vm);
- sq_setinstanceup(vm, -1, instance);
- sq_setreleasehook(vm, -1, DefSQDestructorCallback<Tcls>);
+ sq_setinstanceup(vm, -Tnparam, instance);
+ sq_setreleasehook(vm, -Tnparam, DefSQDestructorCallback<Tcls>);
return 0;
}