importing the GameLogic module was being done by adding the text "import GameLogic" to the start of all scripts used in the game engine, this meant every error line number was off by 1 (quite annoying). better to do this to the dictionary that the scripts run with.
This commit is contained in:
@@ -332,6 +332,7 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
|
||||
ketsjiengine->SetPythonDictionary(dictionaryobject);
|
||||
initRasterizer(rasterizer, canvas);
|
||||
PyObject *gameLogic = initGameLogic(startscene);
|
||||
PyDict_SetItemString(dictionaryobject, "GameLogic", gameLogic); // Same as importing the module.
|
||||
initGameKeys();
|
||||
initPythonConstraintBinding();
|
||||
|
||||
@@ -399,7 +400,14 @@ extern "C" void StartKetsjiShell(struct ScrArea *area,
|
||||
exitstring = ketsjiengine->GetExitString();
|
||||
|
||||
// when exiting the mainloop
|
||||
dictionaryClearByHand(gameLogic);
|
||||
|
||||
// Clears the dictionary by hand:
|
||||
// This prevents, extra references to global variables
|
||||
// inside the GameLogic dictionary when the python interpreter is finalized.
|
||||
// which allows the scene to safely delete them :)
|
||||
// see: (space.c)->start_game
|
||||
PyDict_Clear(PyModule_GetDict(gameLogic));
|
||||
|
||||
ketsjiengine->StopEngine();
|
||||
exitGamePythonScripting();
|
||||
networkdevice->Disconnect();
|
||||
@@ -591,6 +599,7 @@ extern "C" void StartKetsjiShellSimulation(struct ScrArea *area,
|
||||
ketsjiengine->SetPythonDictionary(dictionaryobject);
|
||||
initRasterizer(rasterizer, canvas);
|
||||
PyObject *gameLogic = initGameLogic(startscene);
|
||||
PyDict_SetItemString(dictionaryobject, "GameLogic", gameLogic); // Same as importing the module
|
||||
initGameKeys();
|
||||
initPythonConstraintBinding();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user