Skip to content

Commit e7ffff8

Browse files
authored
Merge pull request #1673 from Azaezel/alpha41/ContextCleanups
minor cleanups for #1672
2 parents 5981154 + 627b9bc commit e7ffff8

4 files changed

Lines changed: 11 additions & 29 deletions

File tree

Engine/source/T3D/trigger.cpp

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "console/engineAPI.h"
2929
#include "collision/boxConvex.h"
3030
#include "console/script.h"
31+
#include "console/consoleInternal.h"
3132

3233
#include "core/stream/bitStream.h"
3334
#include "math/mathIO.h"
@@ -172,8 +173,9 @@ Trigger::Trigger()
172173

173174
mPhysicsRep = NULL;
174175
mTripOnce = false;
176+
mTripped = false;
175177
mTrippedBy = 0xFFFFFFFF;
176-
mTripIf = "";
178+
mTripIf.clear();
177179

178180
//Default up a basic square
179181
Point3F vecs[3] = { Point3F(1.0, 0.0, 0.0),
@@ -748,21 +750,11 @@ void Trigger::potentialEnterObject(GameBase* enter)
748750
mObjects.push_back(enter);
749751
deleteNotify(enter);
750752

751-
if(evalCmD(&mEnterCommand))
753+
if(isServerObject() && evalCmD(&mEnterCommand))
752754
{
753755
String command = String("%obj = ") + enter->getIdString() + ";";
754756
command = command + String("%this = ") + getIdString() + ";" + mEnterCommand;
755-
756-
StringTableEntry objectName = getName();
757-
if (objectName != NULL)
758-
objectName = getIdString();
759-
760-
StringTableEntry groupName = getGroup()->getName();
761-
if (groupName != NULL)
762-
groupName = getGroup()->getIdString();
763-
764-
String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName);
765-
Con::evaluate(command.c_str(), false, context);
757+
Con::evaluate(command.c_str(), false, Con::getCurrentScriptModulePath());
766758
}
767759

768760
if( mDataBlock && testTrippable() && testCondition())
@@ -807,29 +799,19 @@ void Trigger::processTick(const Move* move)
807799
mObjects.erase(i);
808800
clearNotify(remove);
809801

810-
if (evalCmD(&mLeaveCommand))
802+
if (isServerObject() && evalCmD(&mLeaveCommand))
811803
{
812804
String command = String("%obj = ") + remove->getIdString() + ";";
813805
command = command + String("%this = ") + getIdString() + ";" + mLeaveCommand;
814-
815-
StringTableEntry objectName = getName();
816-
if (objectName != NULL)
817-
objectName = getIdString();
818-
819-
StringTableEntry groupName = getGroup()->getName();
820-
if (groupName != NULL)
821-
groupName = getGroup()->getIdString();
822-
823-
String context = String::ToString("%s\nGroup: %s, Object: %s", getFilename(), groupName, objectName);
824-
Con::evaluate(command.c_str(), false, context);
806+
Con::evaluate(command.c_str(), false, Con::getCurrentScriptModulePath());
825807
}
826808
if (testTrippable() && testCondition())
827809
mDataBlock->onLeaveTrigger_callback( this, remove );
828810
mTripped = true;
829811
}
830812
}
831813

832-
if (evalCmD(&mTickCommand))
814+
if (isServerObject() && evalCmD(&mTickCommand))
833815
{
834816
StringTableEntry objectName = getName();
835817
if (objectName != NULL)

Engine/source/gui/controls/guiGameSettingsCtrl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ void GuiGameSettingsCtrl::doScriptCommand(StringTableEntry command)
496496
setThisControl();
497497
StringTableEntry objectName = getName() != StringTable->EmptyString() ? getName() : getInternalName();
498498
String context = String::ToString("%s\nObject: %s", Platform::makeRelativePathName(getFilename(), NULL), objectName);
499-
Con::evaluate(command, false, context);
499+
Con::evaluate(command, false, context.c_str());
500500
}
501501
}
502502

Engine/source/gui/controls/guiMLTextEditCtrl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ bool GuiMLTextEditCtrl::onKeyDown(const GuiEvent& event)
213213
{
214214
StringTableEntry objectName = getName() != StringTable->EmptyString() ? getName() : getInternalName();
215215
String context = String::ToString("%s, Object: %s", Platform::makeRelativePathName(getFilename(), NULL), objectName);
216-
Con::evaluate( mEscapeCommand, false, context );
216+
Con::evaluate( mEscapeCommand, false, context.c_str());
217217
return( true );
218218
}
219219
return( Parent::onKeyDown( event ) );

Engine/source/sim/actionMap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,7 @@ bool ActionMap::processAction(const InputEventInfo* pEvent)
14861486
{
14871487
StringTableEntry objectName = getName() != StringTable->EmptyString() ? getName() : getInternalName();
14881488
String context = String::ToString("%s\nObject: %s", Platform::makeRelativePathName(getFilename(), NULL), objectName);
1489-
Con::evaluate(pNode->makeConsoleCommand, false, context);
1489+
Con::evaluate(pNode->makeConsoleCommand, false, context.c_str());
14901490
}
14911491
}
14921492
else if (pNode->flags & Node::Held)

0 commit comments

Comments
 (0)