1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-18 19:29:09 +00:00

Fix Age.SetSDL commands...

- General code cleanups
- Don't send the entire SDL blob. This is wasteful.
- Actually update the doggone state immediately. Don't screw around!
This commit is contained in:
2014-05-18 14:40:06 -04:00
parent f4ad75978e
commit e08229e2e3
3 changed files with 32 additions and 71 deletions

View File

@ -166,18 +166,23 @@ void plPythonSDLModifier::SetItem(const plString& key, PyObject* value)
IDirtySynchState(key);
}
void plPythonSDLModifier::SetItemFromSDLVar(plSimpleStateVariable* var)
template<>
void plPythonSDLModifier::SetItem(const plString& key, int index, bool value)
{
plString name = var->GetName();
// Get the SDL value in Python format
PyObject* pyVar = ISDLVarToPython(var);
ISetItem(name, pyVar);
Py_XDECREF(pyVar);
// let the sender do the dirty sync state stuff
SetItemIdx(key, index, PyBool_FromLong(value), true);
}
template<>
void plPythonSDLModifier::SetItem(const plString& key, int index, float value)
{
SetItemIdx(key, index, PyFloat_FromDouble(value), true);
}
template<>
void plPythonSDLModifier::SetItem(const plString& key, int index, int value)
{
SetItemIdx(key, index, PyLong_FromLong(value), true);
}
void plPythonSDLModifier::SetDefault(const plString& key, PyObject* value)
{
@ -578,12 +583,12 @@ const plSDLModifier *ExternFindAgeSDL()
return plPythonSDLModifier::FindAgeSDL();
}
const plPythonSDLModifier *ExternFindAgePySDL()
plPythonSDLModifier* ExternFindAgePySDL()
{
return plPythonSDLModifier::FindAgeSDL();
}
const plPythonSDLModifier* plPythonSDLModifier::FindAgeSDL()
plPythonSDLModifier* plPythonSDLModifier::FindAgeSDL()
{
const char* ageName = cyMisc::GetAgeName();

View File

@ -99,11 +99,10 @@ public:
GETINTERFACE_ANY(plPythonSDLModifier, plSDLModifier);
virtual const char* GetSDLName() const;
virtual void SetItemFromSDLVar(plSimpleStateVariable* var);
static bool HasSDL(const plString& pythonFile);
// find the Age global SDL guy... if there is one
static const plPythonSDLModifier* FindAgeSDL();
static plPythonSDLModifier* FindAgeSDL();
static plKey FindAgeSDLTarget();
void SetDefault(const plString& key, PyObject* value);
@ -111,7 +110,11 @@ public:
void SetNotify(pyKey& selfkey, const plString& key, float tolerance);
PyObject* GetItem(const plString& key);
template<typename T>
void SetItem(const plString& key, int index, T value);
void SetItem(const plString& key, PyObject* value);
void SetItemIdx(const plString& key, int idx, PyObject* value, bool sendImmediate = false);
void SetFlags(const plString& name, bool sendImmediate, bool skipOwnershipCheck);
void SetTagString(const plString& name, const plString& tag);