aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-06-15 01:54:26 +0200
committerEinar Johan Trøan Sømåen2012-06-15 01:54:26 +0200
commitdae2209e4c144ffbcf586b5cdcea9a6746274443 (patch)
tree26034c27bf6c05cc193b40cc5f28a1402895d0be
parentbed4f81fc616d6ca920e5ab534d4accea9c1a9ef (diff)
downloadscummvm-rg350-dae2209e4c144ffbcf586b5cdcea9a6746274443.tar.gz
scummvm-rg350-dae2209e4c144ffbcf586b5cdcea9a6746274443.tar.bz2
scummvm-rg350-dae2209e4c144ffbcf586b5cdcea9a6746274443.zip
WINTERMUTE: Make factory-functions for the SX-classes, to avoid having to include all of them in BGame.cpp
-rw-r--r--engines/wintermute/Base/BGame.cpp18
-rw-r--r--engines/wintermute/Base/BScriptable.h10
-rw-r--r--engines/wintermute/Base/scriptables/SXArray.cpp4
-rw-r--r--engines/wintermute/Base/scriptables/SXDate.cpp4
-rw-r--r--engines/wintermute/Base/scriptables/SXFile.cpp4
-rw-r--r--engines/wintermute/Base/scriptables/SXMath.cpp4
-rw-r--r--engines/wintermute/Base/scriptables/SXMemBuffer.cpp4
-rw-r--r--engines/wintermute/Base/scriptables/SXStore.cpp4
-rw-r--r--engines/wintermute/Base/scriptables/SXString.cpp4
-rw-r--r--engines/wintermute/Base/scriptables/SxObject.cpp4
10 files changed, 48 insertions, 12 deletions
diff --git a/engines/wintermute/Base/BGame.cpp b/engines/wintermute/Base/BGame.cpp
index f643d3e302..bf7eaa561f 100644
--- a/engines/wintermute/Base/BGame.cpp
+++ b/engines/wintermute/Base/BGame.cpp
@@ -60,14 +60,8 @@
#include "engines/wintermute/Base/scriptables/ScEngine.h"
#include "engines/wintermute/Base/scriptables/ScStack.h"
#include "engines/wintermute/Base/scriptables/ScScript.h"
-#include "engines/wintermute/Base/scriptables/SXArray.h"
-#include "engines/wintermute/Base/scriptables/SXDate.h"
-#include "engines/wintermute/Base/scriptables/SXFile.h"
-#include "engines/wintermute/Base/scriptables/SXMemBuffer.h"
-#include "engines/wintermute/Base/scriptables/SxObject.h"
#include "engines/wintermute/Base/scriptables/SXMath.h"
#include "engines/wintermute/Base/scriptables/SXStore.h"
-#include "engines/wintermute/Base/scriptables/SXString.h"
#include "engines/wintermute/video/VidPlayer.h"
#include "engines/wintermute/video/VidTheoraPlayer.h"
#include "common/textconsole.h"
@@ -2966,7 +2960,7 @@ HRESULT CBGame::ExternalCall(CScScript *Script, CScStack *Stack, CScStack *ThisS
else if (strcmp(Name, "String") == 0) {
this_obj = ThisStack->GetTop();
- this_obj->SetNative(new CSXString(Game, Stack));
+ this_obj->SetNative(makeSXString(Game, Stack));
Stack->PushNULL();
}
@@ -2976,7 +2970,7 @@ HRESULT CBGame::ExternalCall(CScScript *Script, CScStack *Stack, CScStack *ThisS
else if (strcmp(Name, "MemBuffer") == 0) {
this_obj = ThisStack->GetTop();
- this_obj->SetNative(new CSXMemBuffer(Game, Stack));
+ this_obj->SetNative(makeSXMemBuffer(Game, Stack));
Stack->PushNULL();
}
@@ -2986,7 +2980,7 @@ HRESULT CBGame::ExternalCall(CScScript *Script, CScStack *Stack, CScStack *ThisS
else if (strcmp(Name, "File") == 0) {
this_obj = ThisStack->GetTop();
- this_obj->SetNative(new CSXFile(Game, Stack));
+ this_obj->SetNative(makeSXFile(Game, Stack));
Stack->PushNULL();
}
@@ -2996,7 +2990,7 @@ HRESULT CBGame::ExternalCall(CScScript *Script, CScStack *Stack, CScStack *ThisS
else if (strcmp(Name, "Date") == 0) {
this_obj = ThisStack->GetTop();
- this_obj->SetNative(new CSXDate(Game, Stack));
+ this_obj->SetNative(makeSXDate(Game, Stack));
Stack->PushNULL();
}
@@ -3006,7 +3000,7 @@ HRESULT CBGame::ExternalCall(CScScript *Script, CScStack *Stack, CScStack *ThisS
else if (strcmp(Name, "Array") == 0) {
this_obj = ThisStack->GetTop();
- this_obj->SetNative(new CSXArray(Game, Stack));
+ this_obj->SetNative(makeSXArray(Game, Stack));
Stack->PushNULL();
}
@@ -3016,7 +3010,7 @@ HRESULT CBGame::ExternalCall(CScScript *Script, CScStack *Stack, CScStack *ThisS
else if (strcmp(Name, "Object") == 0) {
this_obj = ThisStack->GetTop();
- this_obj->SetNative(new CSXObject(Game, Stack));
+ this_obj->SetNative(makeSXObject(Game, Stack));
Stack->PushNULL();
}
diff --git a/engines/wintermute/Base/BScriptable.h b/engines/wintermute/Base/BScriptable.h
index dfe36abf52..0ee7808445 100644
--- a/engines/wintermute/Base/BScriptable.h
+++ b/engines/wintermute/Base/BScriptable.h
@@ -75,6 +75,16 @@ public:
};
+// Implemented in their respective .cpp-files
+CBScriptable *makeSXArray(CBGame *inGame, CScStack *stack);
+CBScriptable *makeSXDate(CBGame *inGame, CScStack *stack);
+CBScriptable *makeSXFile(CBGame *inGame, CScStack *stack);
+CBScriptable *makeSXMath(CBGame *inGame);
+CBScriptable *makeSXMemBuffer(CBGame *inGame, CScStack *stack);
+CBScriptable *makeSXObject(CBGame *inGame, CScStack *stack);
+CBScriptable *makeSXStore(CBGame *inGame);
+CBScriptable *makeSXString(CBGame *inGame, CScStack *stack);
+
} // end of namespace WinterMute
#endif
diff --git a/engines/wintermute/Base/scriptables/SXArray.cpp b/engines/wintermute/Base/scriptables/SXArray.cpp
index 18118727da..d9b3dfe455 100644
--- a/engines/wintermute/Base/scriptables/SXArray.cpp
+++ b/engines/wintermute/Base/scriptables/SXArray.cpp
@@ -36,6 +36,10 @@ namespace WinterMute {
IMPLEMENT_PERSISTENT(CSXArray, false)
+CBScriptable *makeSXArray(CBGame *inGame, CScStack *stack) {
+ return new CSXArray(inGame, stack);
+}
+
//////////////////////////////////////////////////////////////////////////
CSXArray::CSXArray(CBGame *inGame, CScStack *Stack): CBScriptable(inGame) {
_length = 0;
diff --git a/engines/wintermute/Base/scriptables/SXDate.cpp b/engines/wintermute/Base/scriptables/SXDate.cpp
index 28b152149c..2947428dad 100644
--- a/engines/wintermute/Base/scriptables/SXDate.cpp
+++ b/engines/wintermute/Base/scriptables/SXDate.cpp
@@ -34,6 +34,10 @@ namespace WinterMute {
IMPLEMENT_PERSISTENT(CSXDate, false)
+CBScriptable *makeSXDate(CBGame *inGame, CScStack *stack) {
+ return new CSXDate(inGame, stack);
+}
+
//////////////////////////////////////////////////////////////////////////
CSXDate::CSXDate(CBGame *inGame, CScStack *Stack): CBScriptable(inGame) {
Stack->CorrectParams(6);
diff --git a/engines/wintermute/Base/scriptables/SXFile.cpp b/engines/wintermute/Base/scriptables/SXFile.cpp
index 1c6438e217..e7ac75c58b 100644
--- a/engines/wintermute/Base/scriptables/SXFile.cpp
+++ b/engines/wintermute/Base/scriptables/SXFile.cpp
@@ -50,6 +50,10 @@ namespace WinterMute {
IMPLEMENT_PERSISTENT(CSXFile, false)
+CBScriptable *makeSXFile(CBGame *inGame, CScStack *stack) {
+ return new CSXFile(inGame, stack);
+}
+
//////////////////////////////////////////////////////////////////////////
CSXFile::CSXFile(CBGame *inGame, CScStack *Stack): CBScriptable(inGame) {
Stack->CorrectParams(1);
diff --git a/engines/wintermute/Base/scriptables/SXMath.cpp b/engines/wintermute/Base/scriptables/SXMath.cpp
index 8ac70581b9..5005b885b8 100644
--- a/engines/wintermute/Base/scriptables/SXMath.cpp
+++ b/engines/wintermute/Base/scriptables/SXMath.cpp
@@ -41,6 +41,10 @@ namespace WinterMute {
IMPLEMENT_PERSISTENT(CSXMath, true)
+CBScriptable *makeSXMath(CBGame *inGame) {
+ return new CSXMath(inGame);
+}
+
//////////////////////////////////////////////////////////////////////////
CSXMath::CSXMath(CBGame *inGame): CBScriptable(inGame) {
diff --git a/engines/wintermute/Base/scriptables/SXMemBuffer.cpp b/engines/wintermute/Base/scriptables/SXMemBuffer.cpp
index 5737fe4d72..3a661b502c 100644
--- a/engines/wintermute/Base/scriptables/SXMemBuffer.cpp
+++ b/engines/wintermute/Base/scriptables/SXMemBuffer.cpp
@@ -37,6 +37,10 @@ namespace WinterMute {
IMPLEMENT_PERSISTENT(CSXMemBuffer, false)
+CBScriptable *makeSXMemBuffer(CBGame *inGame, CScStack *stack) {
+ return new CSXMemBuffer(inGame, stack);
+}
+
//////////////////////////////////////////////////////////////////////////
CSXMemBuffer::CSXMemBuffer(CBGame *inGame, CScStack *Stack): CBScriptable(inGame) {
Stack->CorrectParams(1);
diff --git a/engines/wintermute/Base/scriptables/SXStore.cpp b/engines/wintermute/Base/scriptables/SXStore.cpp
index 26d19376a1..54280e8b29 100644
--- a/engines/wintermute/Base/scriptables/SXStore.cpp
+++ b/engines/wintermute/Base/scriptables/SXStore.cpp
@@ -42,6 +42,10 @@ namespace WinterMute {
IMPLEMENT_PERSISTENT(CSXStore, false)
+CBScriptable *makeSXStore(CBGame *inGame, CScStack *stack) {
+ return new CSXStore(inGame);
+}
+
//////////////////////////////////////////////////////////////////////////
CSXStore::CSXStore(CBGame *inGame) : CBObject(inGame) {
#ifdef __IPHONEOS__
diff --git a/engines/wintermute/Base/scriptables/SXString.cpp b/engines/wintermute/Base/scriptables/SXString.cpp
index f8de678547..16cb198671 100644
--- a/engines/wintermute/Base/scriptables/SXString.cpp
+++ b/engines/wintermute/Base/scriptables/SXString.cpp
@@ -39,6 +39,10 @@ namespace WinterMute {
IMPLEMENT_PERSISTENT(CSXString, false)
+CBScriptable *makeSXString(CBGame *inGame, CScStack *stack) {
+ return new CSXString(inGame, stack);
+}
+
//////////////////////////////////////////////////////////////////////////
CSXString::CSXString(CBGame *inGame, CScStack *Stack): CBScriptable(inGame) {
_string = NULL;
diff --git a/engines/wintermute/Base/scriptables/SxObject.cpp b/engines/wintermute/Base/scriptables/SxObject.cpp
index 1af01c1045..2785606338 100644
--- a/engines/wintermute/Base/scriptables/SxObject.cpp
+++ b/engines/wintermute/Base/scriptables/SxObject.cpp
@@ -38,6 +38,10 @@ namespace WinterMute {
IMPLEMENT_PERSISTENT(CSXObject, false)
+CBScriptable *makeSXObject(CBGame *inGame, CScStack *stack) {
+ return new CSXObject(inGame, stack);
+}
+
//////////////////////////////////////////////////////////////////////////
CSXObject::CSXObject(CBGame *inGame, CScStack *Stack): CBObject(inGame) {
int NumParams = Stack->Pop()->GetInt(0);