mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-19 22:53:47 +00:00
substitutions -- Implementation of special substitution statements on datablock fields.
This commit is contained in:
parent
9391fcad4e
commit
0b84fccdd2
12 changed files with 464 additions and 4 deletions
|
|
@ -20,6 +20,10 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
||||
// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
|
||||
// Copyright (C) 2015 Faust Logic, Inc.
|
||||
//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
|
||||
#ifndef _SIMDATABLOCK_H_
|
||||
#define _SIMDATABLOCK_H_
|
||||
|
||||
|
|
@ -172,6 +176,32 @@ public:
|
|||
/// Used by the console system to automatically tell datablock classes apart
|
||||
/// from non-datablock classes.
|
||||
static const bool __smIsDatablock = true;
|
||||
protected:
|
||||
struct SubstitutionStatement
|
||||
{
|
||||
StringTableEntry slot;
|
||||
S32 idx;
|
||||
char* value;
|
||||
SubstitutionStatement(StringTableEntry slot, S32 idx, const char* value);
|
||||
~SubstitutionStatement();
|
||||
void replaceValue(const char* value);
|
||||
};
|
||||
Vector<SubstitutionStatement*> substitutions;
|
||||
void clear_substitutions();
|
||||
public:
|
||||
/*C*/ SimDataBlock(const SimDataBlock&, bool = false);
|
||||
/*D*/ ~SimDataBlock();
|
||||
|
||||
void addSubstitution(StringTableEntry field, S32 idx, const char* subst);
|
||||
const char* getSubstitution(StringTableEntry field, S32 idx);
|
||||
S32 getSubstitutionCount() { return substitutions.size(); }
|
||||
void performSubstitutions(SimDataBlock*, const SimObject*, S32 index=0);
|
||||
void copySubstitutionsFrom(SimDataBlock* other);
|
||||
void printSubstitutions();
|
||||
bool fieldHasSubstitution(StringTableEntry slot);
|
||||
virtual void onAddSubstitution(StringTableEntry, S32 idx, const char* subst) { }
|
||||
virtual void onRemoveSubstitution(StringTableEntry, S32 idx) { }
|
||||
virtual void onPerformSubstitutions() { }
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue