mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-07-03 06:24:32 +00:00
Some fixes for node script init/cleanup.
An Errorneous script could cause a node script instance leaking, preventing the leaked inctances from unloading, and thus locking the whole file, preventing it from re-loading when relaoding the map, until the mod was exited. Also init nodes properly when cloned or changed.
This commit is contained in:
parent
0cd0971671
commit
568178bbb4
2 changed files with 20 additions and 29 deletions
|
@ -225,6 +225,7 @@ void Path::destroy()
|
|||
|
||||
Path::~Path()
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
|
||||
bool Path::hasScript()
|
||||
|
@ -291,9 +292,8 @@ void Path::refreshScript()
|
|||
content.clear();
|
||||
label.clear();
|
||||
|
||||
// HACK: clean up
|
||||
/*+ dsq->game->sceneName + "_"*/
|
||||
script = 0;
|
||||
destroy();
|
||||
|
||||
warpMap = warpNode = "";
|
||||
toFlip = -1;
|
||||
|
||||
|
@ -430,23 +430,7 @@ void Path::refreshScript()
|
|||
{
|
||||
naijaHome = true;
|
||||
}
|
||||
//debugLog(label + " " + warpMap + " " + warpType);
|
||||
/*
|
||||
std::string parse = name;
|
||||
int pos = 0;
|
||||
|
||||
pos = parse.find('_');
|
||||
parse = parse.substr(pos+1, parse.getLength2D());
|
||||
|
||||
pos = parse.find('_');
|
||||
warpMap = parse.substr(0, pos-1);
|
||||
parse = parse.substr(pos+1, parse.getLength2D());
|
||||
|
||||
pos = parse.find('_');
|
||||
std::string
|
||||
*/
|
||||
pathType = PATH_WARP;
|
||||
|
||||
}
|
||||
else if (label == "se")
|
||||
{
|
||||
|
|
|
@ -927,8 +927,14 @@ void SceneEditor::enterName()
|
|||
Path *p = getSelectedPath();
|
||||
if (p)
|
||||
{
|
||||
p->name = dsq->getUserInputString("PathName", p->name);
|
||||
std::string newname = dsq->getUserInputString("PathName", p->name);
|
||||
bool changed = newname != p->name;
|
||||
p->name = newname;
|
||||
if (changed)
|
||||
{
|
||||
p->refreshScript();
|
||||
p->init();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3224,6 +3230,7 @@ void SceneEditor::cloneSelectedElement()
|
|||
|
||||
dsq->game->addPath(newp);
|
||||
selectedIdx = dsq->game->getNumPaths()-1;
|
||||
newp->init();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue