mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 18:06:42 +00:00
removed a redundant function for listing global variables
This commit is contained in:
parent
51bfa5cde3
commit
b38bfe1f21
7 changed files with 16 additions and 26 deletions
|
@ -164,8 +164,6 @@ namespace MWBase
|
||||||
virtual char getGlobalVariableType (const std::string& name) const = 0;
|
virtual char getGlobalVariableType (const std::string& name) const = 0;
|
||||||
///< Return ' ', if there is no global variable with this name.
|
///< Return ' ', if there is no global variable with this name.
|
||||||
|
|
||||||
virtual std::vector<std::string> getGlobals () const = 0;
|
|
||||||
|
|
||||||
virtual std::string getCellName (const MWWorld::CellStore *cell = 0) const = 0;
|
virtual std::string getCellName (const MWWorld::CellStore *cell = 0) const = 0;
|
||||||
///< Return name of the cell.
|
///< Return name of the cell.
|
||||||
///
|
///
|
||||||
|
|
|
@ -156,10 +156,20 @@ namespace MWScript
|
||||||
MWBase::Environment::get().getWorld()->setGlobalFloat (name, value);
|
MWBase::Environment::get().getWorld()->setGlobalFloat (name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> InterpreterContext::getGlobals () const
|
std::vector<std::string> InterpreterContext::getGlobals() const
|
||||||
{
|
{
|
||||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
std::vector<std::string> ids;
|
||||||
return world->getGlobals();
|
|
||||||
|
const MWWorld::Store<ESM::Global>& globals =
|
||||||
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Global>();
|
||||||
|
|
||||||
|
for (MWWorld::Store<ESM::Global>::iterator iter = globals.begin(); iter!=globals.end();
|
||||||
|
++iter)
|
||||||
|
{
|
||||||
|
ids.push_back (iter->mId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
char InterpreterContext::getGlobalType (const std::string& name) const
|
char InterpreterContext::getGlobalType (const std::string& name) const
|
||||||
|
|
|
@ -652,13 +652,14 @@ namespace MWScript
|
||||||
|
|
||||||
void printGlobalVars(Interpreter::Runtime &runtime)
|
void printGlobalVars(Interpreter::Runtime &runtime)
|
||||||
{
|
{
|
||||||
Interpreter::Context& context = runtime.getContext();
|
InterpreterContext& context =
|
||||||
|
static_cast<InterpreterContext&> (runtime.getContext());
|
||||||
|
|
||||||
std::stringstream str;
|
std::stringstream str;
|
||||||
str<< "Global variables:";
|
str<< "Global variables:";
|
||||||
|
|
||||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
std::vector<std::string> names = world->getGlobals();
|
std::vector<std::string> names = context.getGlobals();
|
||||||
for(size_t i = 0;i < names.size();++i)
|
for(size_t i = 0;i < names.size();++i)
|
||||||
{
|
{
|
||||||
char type = world->getGlobalVariableType (names[i]);
|
char type = world->getGlobalVariableType (names[i]);
|
||||||
|
|
|
@ -7,16 +7,6 @@
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
std::vector<std::string> Globals::getGlobals() const
|
|
||||||
{
|
|
||||||
std::vector<std::string> ids;
|
|
||||||
|
|
||||||
for (Collection::const_iterator iter = mVariables.begin(); iter!=mVariables.end(); ++iter)
|
|
||||||
ids.push_back (iter->first);
|
|
||||||
|
|
||||||
return ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
Globals::Collection::const_iterator Globals::find (const std::string& name) const
|
Globals::Collection::const_iterator Globals::find (const std::string& name) const
|
||||||
{
|
{
|
||||||
Collection::const_iterator iter = mVariables.find (name);
|
Collection::const_iterator iter = mVariables.find (name);
|
||||||
|
|
|
@ -33,8 +33,6 @@ namespace MWWorld
|
||||||
char getType (const std::string& name) const;
|
char getType (const std::string& name) const;
|
||||||
///< If there is no global variable with this name, ' ' is returned.
|
///< If there is no global variable with this name, ' ' is returned.
|
||||||
|
|
||||||
std::vector<std::string> getGlobals() const;
|
|
||||||
|
|
||||||
void fill (const MWWorld::ESMStore& store);
|
void fill (const MWWorld::ESMStore& store);
|
||||||
///< Replace variables with variables from \a store with default values.
|
///< Replace variables with variables from \a store with default values.
|
||||||
};
|
};
|
||||||
|
|
|
@ -464,11 +464,6 @@ namespace MWWorld
|
||||||
return mGlobalVariables.getType (name);
|
return mGlobalVariables.getType (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> World::getGlobals() const
|
|
||||||
{
|
|
||||||
return mGlobalVariables.getGlobals();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string World::getCellName (const MWWorld::CellStore *cell) const
|
std::string World::getCellName (const MWWorld::CellStore *cell) const
|
||||||
{
|
{
|
||||||
if (!cell)
|
if (!cell)
|
||||||
|
|
|
@ -237,8 +237,6 @@ namespace MWWorld
|
||||||
virtual char getGlobalVariableType (const std::string& name) const;
|
virtual char getGlobalVariableType (const std::string& name) const;
|
||||||
///< Return ' ', if there is no global variable with this name.
|
///< Return ' ', if there is no global variable with this name.
|
||||||
|
|
||||||
virtual std::vector<std::string> getGlobals () const;
|
|
||||||
|
|
||||||
virtual std::string getCellName (const MWWorld::CellStore *cell = 0) const;
|
virtual std::string getCellName (const MWWorld::CellStore *cell = 0) const;
|
||||||
///< Return name of the cell.
|
///< Return name of the cell.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue