crash fix

stable-5.2
Sven Eberhardt 2009-08-11 23:12:36 +02:00
parent 63311823c6
commit 4b6f1ec264
5 changed files with 27 additions and 5 deletions

View File

@ -51,6 +51,7 @@ class C4LSector
C4ObjectList ObjectShapes; // objects with shapes that overlap this sector
void CompileFunc(StdCompiler *pComp);
void ClearObjects(); // remove all objects from object lists
friend class C4LSectors;
};
@ -73,6 +74,7 @@ class C4LSectors
void Add(C4Object *pObj, C4ObjectList *pMainList);
void Update(C4Object *pObj, C4ObjectList *pMainList); // does not update object order!
void Remove(C4Object *pObj);
void ClearObjects(); // remove all objects from object lists
void AssertObjectNotInList(C4Object *pObj); // searches all sector lists for object, and assert if it's inside a list

View File

@ -275,7 +275,15 @@ void C4AulScriptEngine::Link(C4DefList *rDefs)
Action->SetProperty(Strings.P[P_Directions], C4VInt(1));
Action->SetProperty(Strings.P[P_Step], C4VInt(1));
Action->SetProperty(Strings.P[P_Procedure], C4VInt(DFA_NONE));
GlobalNamed.GetItem("Action")->SetPropList(Action);
C4Value *pActionValDef = GlobalNamed.GetItem("Action");
if (!pActionValDef)
{
Log("WARNING: static Action not defined. Wrong System.c4g?");
}
else
{
pActionValDef->SetPropList(Action);
}
rDefs->CallEveryDefinition();
// display state

View File

@ -353,6 +353,7 @@ void C4GameObjects::PutSolidMasks()
void C4GameObjects::DeleteObjects(bool fDeleteInactive)
{
Sectors.ClearObjects();
C4ObjectList::DeleteObjects();
BackObjects.Clear();
ForeObjects.Clear();

View File

@ -43,8 +43,7 @@ void C4LSector::Init(int ix, int iy)
void C4LSector::Clear()
{
// clear objects
Objects.Clear();
ObjectShapes.Clear();
ClearObjects();
}
void C4LSector::CompileFunc(StdCompiler *pComp)
@ -55,6 +54,13 @@ void C4LSector::CompileFunc(StdCompiler *pComp)
pComp->Value(mkNamingAdapt(ObjectShapes, "ObjectShapes"));
}
void C4LSector::ClearObjects()
{
// clear objects
Objects.Clear();
ObjectShapes.Clear();
}
/* sector map */
void C4LSectors::Init(int iWdt, int iHgt)
@ -226,6 +232,12 @@ bool C4LSectors::CheckSort()
return true;
}
void C4LSectors::ClearObjects()
{
for (int cnt=0; cnt<Size; cnt++) Sectors[cnt].ClearObjects();
SectorOut.ClearObjects();
}
/* landscape area */
bool C4LArea::operator == (const C4LArea &Area) const

View File

@ -1,6 +1,5 @@
/*-- Altes Zeug, das nicht mehr in die Engine muss --*/
/* proplist changes aren't in this branch?
// stuff for the proplist changes
static const DFA_NONE =-1;
static const DFA_WALK = 0;
@ -27,7 +26,7 @@ global func GetActMapVal(string strEntry, string strAction, id idDef, int iEntry
if (!idDef) idDef = GetID();
if (strEntry == "Facet") strEntry = ["X", "Y", "Wdt", "Hgt", "OffX", "OffY"][iEntryNr];
return GetProperty(strEntry, GetProperty(strAction, idDef));
} */
}
global func ShowNeededMaterial(object pOfObject)
{