mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-22 21:05:39 +00:00
Merge pull request #140 from eightyeight/missionarea-server-object
Updated logic in MissionArea::getServerObject merged into development branch.
This commit is contained in:
commit
03211bc4fd
2 changed files with 24 additions and 14 deletions
|
|
@ -52,6 +52,8 @@ ConsoleDocClass( MissionArea,
|
||||||
|
|
||||||
RectI MissionArea::smMissionArea(Point2I(768, 768), Point2I(512, 512));
|
RectI MissionArea::smMissionArea(Point2I(768, 768), Point2I(512, 512));
|
||||||
|
|
||||||
|
MissionArea * MissionArea::smServerObject = NULL;
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
MissionArea::MissionArea()
|
MissionArea::MissionArea()
|
||||||
|
|
@ -79,27 +81,24 @@ void MissionArea::setArea(const RectI & area)
|
||||||
|
|
||||||
MissionArea * MissionArea::getServerObject()
|
MissionArea * MissionArea::getServerObject()
|
||||||
{
|
{
|
||||||
SimSet * scopeAlwaysSet = Sim::getGhostAlwaysSet();
|
return smServerObject;
|
||||||
for(SimSet::iterator itr = scopeAlwaysSet->begin(); itr != scopeAlwaysSet->end(); itr++)
|
|
||||||
{
|
|
||||||
MissionArea * ma = dynamic_cast<MissionArea*>(*itr);
|
|
||||||
if(ma)
|
|
||||||
{
|
|
||||||
AssertFatal(ma->isServerObject(), "MissionArea::getServerObject: found client object in ghost always set!");
|
|
||||||
return(ma);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
bool MissionArea::onAdd()
|
bool MissionArea::onAdd()
|
||||||
{
|
{
|
||||||
if(isServerObject() && MissionArea::getServerObject())
|
if(isServerObject())
|
||||||
{
|
{
|
||||||
Con::errorf(ConsoleLogEntry::General, "MissionArea::onAdd - MissionArea already instantiated!");
|
if(MissionArea::getServerObject())
|
||||||
return(false);
|
{
|
||||||
|
Con::errorf(ConsoleLogEntry::General, "MissionArea::onAdd - MissionArea already instantiated!");
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
smServerObject = this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Parent::onAdd())
|
if(!Parent::onAdd())
|
||||||
|
|
@ -109,6 +108,14 @@ bool MissionArea::onAdd()
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MissionArea::onRemove()
|
||||||
|
{
|
||||||
|
if (smServerObject == this)
|
||||||
|
smServerObject = NULL;
|
||||||
|
|
||||||
|
Parent::onRemove();
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
void MissionArea::inspectPostApply()
|
void MissionArea::inspectPostApply()
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@ class MissionArea : public NetObject
|
||||||
F32 mFlightCeiling;
|
F32 mFlightCeiling;
|
||||||
F32 mFlightCeilingRange;
|
F32 mFlightCeilingRange;
|
||||||
|
|
||||||
|
static MissionArea * smServerObject;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MissionArea();
|
MissionArea();
|
||||||
|
|
||||||
|
|
@ -53,6 +55,7 @@ class MissionArea : public NetObject
|
||||||
/// @name SimObject Inheritance
|
/// @name SimObject Inheritance
|
||||||
/// @{
|
/// @{
|
||||||
bool onAdd();
|
bool onAdd();
|
||||||
|
void onRemove();
|
||||||
|
|
||||||
void inspectPostApply();
|
void inspectPostApply();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue