Fix for crash when opening editor on subsequent mission
by Joel Baxter · in Torque Game Engine · 03/31/2002 (12:09 am) · 1 replies
If you do some editing, and then change missions (not using the load mission function of the editor) and later decide to do some more editing, the app will take an exception.
The editor GUI objects are not deleted across the mission boundary. So when you fire the editor up again, the same object for doing a treeview of the MissionGroup is used, but it no longer has a handle on a valid MissionGroup to display... crashy crashy.
I think the easiest way to solve this problem is just to re-initialize the editor objects when loading a new mission. In loadMissionStage2 in common/server/missionLoad.cs, after exec-ing the mission file and checking that a valid MissionGroup exists, we can then do this:
Seems to make things happy.
The editor GUI objects are not deleted across the mission boundary. So when you fire the editor up again, the same object for doing a treeview of the MissionGroup is used, but it no longer has a handle on a valid MissionGroup to display... crashy crashy.
I think the easiest way to solve this problem is just to re-initialize the editor objects when loading a new mission. In loadMissionStage2 in common/server/missionLoad.cs, after exec-ing the mission file and checking that a valid MissionGroup exists, we can then do this:
// If there's an existing EditorGui, init it so it can know about the
// MissionGroup.
if (isObject(EditorGui)) {
EditorGui.init();
}And in EditorDoLoadMission in common/editor/EditorGui.cs, remove the EditorGui init from that function so it just looks like this:function EditorDoLoadMission(%file)
{
loadMission(%file, true) ;
EditorGui.loadingMission = true;
}(Otherwise, with our new addition to the mission load process, we would have redundant editor initializations when loading a mission from within the editor.)Seems to make things happy.
Torque Owner Shawn