1
0
forked from 0ad/0ad
0ad/source/i18n/TSComponent.cpp
janwas a69ac0dee9 - fix w4 warnings
- add convenience macros for config_db(CFG_GET_SYS_VAL)
- VFSUtil::EnumDirEnts now uses flags instead of bool recursive
- UNUSED() for params, UNUSED2 (<- need better name) for variables
- config.h defines must be tested with #if (always defined) -> allows
detecting misspellings thanks to compiler warnings
- replace debug_assert(0) with debug_warn (its sole purpose)
- replace ScriptingHost::ValueToInt et al with ToPrimitive
- use nommgr.h to disable both mmgr and VC debug heap

This was SVN commit r2585.
2005-08-09 15:55:44 +00:00

42 lines
974 B
C++
Executable File

#include "precompiled.h"
#include "TSComponent.h"
#include "CLocale.h"
using namespace I18n;
// Vaguely useful utility function for deleting stuff
template<typename T> void delete_fn(T* v) { delete v; }
const StrImW TSComponentString::ToString(CLocale* UNUSED(locale), std::vector<BufferVariable*>& UNUSED(vars)) const
{
return String;
}
/**************/
const StrImW TSComponentVariable::ToString(CLocale* locale, std::vector<BufferVariable*>& vars) const
{
// This will never be out-of-bounds -- the number
// of parameters has been checked earlier
return vars[ID]->ToString(locale);
}
/**************/
const StrImW TSComponentFunction::ToString(CLocale* locale, std::vector<BufferVariable*>& vars) const
{
return locale->CallFunction(Name.c_str(), vars, Params);
}
void TSComponentFunction::AddParam(ScriptValue* p)
{
Params.push_back(p);
}
TSComponentFunction::~TSComponentFunction()
{
for_each(Params.begin(), Params.end(), delete_fn<ScriptValue>);
}