1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:53:51 +00:00

removed a redundant function for listing global variables

This commit is contained in:
Marc Zinnschlag 2013-12-10 15:22:38 +01:00
parent 51bfa5cde3
commit b38bfe1f21
7 changed files with 16 additions and 26 deletions

View file

@ -164,8 +164,6 @@ namespace MWBase
virtual char getGlobalVariableType (const std::string& name) const = 0;
///< 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;
///< Return name of the cell.
///

View file

@ -156,10 +156,20 @@ namespace MWScript
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();
return world->getGlobals();
std::vector<std::string> ids;
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

View file

@ -652,13 +652,14 @@ namespace MWScript
void printGlobalVars(Interpreter::Runtime &runtime)
{
Interpreter::Context& context = runtime.getContext();
InterpreterContext& context =
static_cast<InterpreterContext&> (runtime.getContext());
std::stringstream str;
str<< "Global variables:";
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)
{
char type = world->getGlobalVariableType (names[i]);

View file

@ -7,16 +7,6 @@
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
{
Collection::const_iterator iter = mVariables.find (name);

View file

@ -33,8 +33,6 @@ namespace MWWorld
char getType (const std::string& name) const;
///< If there is no global variable with this name, ' ' is returned.
std::vector<std::string> getGlobals() const;
void fill (const MWWorld::ESMStore& store);
///< Replace variables with variables from \a store with default values.
};

View file

@ -464,11 +464,6 @@ namespace MWWorld
return mGlobalVariables.getType (name);
}
std::vector<std::string> World::getGlobals() const
{
return mGlobalVariables.getGlobals();
}
std::string World::getCellName (const MWWorld::CellStore *cell) const
{
if (!cell)

View file

@ -237,8 +237,6 @@ namespace MWWorld
virtual char getGlobalVariableType (const std::string& name) const;
///< 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;
///< Return name of the cell.
///