mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-05 08:45:33 +00:00
Merge remote-tracking branch 'zini/master' into animation2
Conflicts: components/nifogre/ogre_nif_loader.cpp
This commit is contained in:
commit
23ac1c2de5
30 changed files with 267 additions and 261 deletions
|
@ -7,6 +7,8 @@
|
|||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
|
||||
MwIniImporter::MwIniImporter()
|
||||
: mVerbose(false)
|
||||
|
@ -793,7 +795,7 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, multistrmap &ini) {
|
|||
|
||||
for(std::vector<std::string>::iterator entry = it->second.begin(); entry!=it->second.end(); ++entry) {
|
||||
std::string filetype(entry->substr(entry->length()-4, 3));
|
||||
std::transform(filetype.begin(), filetype.end(), filetype.begin(), ::tolower);
|
||||
Misc::StringUtils::toLower(filetype);
|
||||
|
||||
if(filetype.compare("esm") == 0) {
|
||||
esmFiles.push_back(*entry);
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <QVariant>
|
||||
|
||||
#include "columnbase.hpp"
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
|
@ -152,10 +153,7 @@ namespace CSMWorld
|
|||
template<typename ESXRecordT>
|
||||
void IdCollection<ESXRecordT>::add (const ESXRecordT& record)
|
||||
{
|
||||
std::string id;
|
||||
|
||||
std::transform (record.mId.begin(), record.mId.end(), std::back_inserter (id),
|
||||
(int(*)(int)) std::tolower);
|
||||
std::string id = Misc::StringUtils::lowerCase(record.mId);
|
||||
|
||||
std::map<std::string, int>::iterator iter = mIndex.find (id);
|
||||
|
||||
|
@ -281,10 +279,7 @@ namespace CSMWorld
|
|||
template<typename ESXRecordT>
|
||||
int IdCollection<ESXRecordT>::searchId (const std::string& id) const
|
||||
{
|
||||
std::string id2;
|
||||
|
||||
std::transform (id.begin(), id.end(), std::back_inserter (id2),
|
||||
(int(*)(int)) std::tolower);
|
||||
std::string id2 = Misc::StringUtils::lowerCase(id);
|
||||
|
||||
std::map<std::string, int>::const_iterator iter = mIndex.find (id2);
|
||||
|
||||
|
|
|
@ -164,9 +164,6 @@ void OMW::Engine::loadBSA()
|
|||
dataDirectory = iter->string();
|
||||
std::cout << "Data dir " << dataDirectory << std::endl;
|
||||
Bsa::addDir(dataDirectory, mFSStrict);
|
||||
|
||||
// Workaround until resource listing capabilities are added to DirArchive, we need those to list available splash screens
|
||||
addResourcesDirectory (dataDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -97,11 +97,11 @@ namespace MWClass
|
|||
|
||||
// make key id lowercase
|
||||
std::string keyId = ptr.getCellRef().mKey;
|
||||
std::transform(keyId.begin(), keyId.end(), keyId.begin(), ::tolower);
|
||||
Misc::StringUtils::toLower(keyId);
|
||||
for (MWWorld::ContainerStoreIterator it = invStore.begin(); it != invStore.end(); ++it)
|
||||
{
|
||||
std::string refId = it->getCellRef().mRefID;
|
||||
std::transform(refId.begin(), refId.end(), refId.begin(), ::tolower);
|
||||
Misc::StringUtils::toLower(refId);
|
||||
if (refId == keyId)
|
||||
{
|
||||
hasKey = true;
|
||||
|
|
|
@ -84,11 +84,11 @@ namespace MWClass
|
|||
|
||||
// make key id lowercase
|
||||
std::string keyId = ptr.getCellRef().mKey;
|
||||
std::transform(keyId.begin(), keyId.end(), keyId.begin(), ::tolower);
|
||||
Misc::StringUtils::toLower(keyId);
|
||||
for (MWWorld::ContainerStoreIterator it = invStore.begin(); it != invStore.end(); ++it)
|
||||
{
|
||||
std::string refId = it->getCellRef().mRefID;
|
||||
std::transform(refId.begin(), refId.end(), refId.begin(), ::tolower);
|
||||
Misc::StringUtils::toLower(refId);
|
||||
if (refId == keyId)
|
||||
{
|
||||
hasKey = true;
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace MWClass
|
|||
if (!ref->mBase->mFaction.empty())
|
||||
{
|
||||
std::string faction = ref->mBase->mFaction;
|
||||
boost::algorithm::to_lower(faction);
|
||||
Misc::StringUtils::toLower(faction);
|
||||
if(ref->mBase->mNpdt52.mGold != -10)
|
||||
{
|
||||
data->mNpcStats.getFactionRanks()[faction] = (int)ref->mBase->mNpdt52.mRank;
|
||||
|
|
|
@ -17,24 +17,11 @@
|
|||
|
||||
#include "selectwrapper.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
std::string toLower (const std::string& name)
|
||||
{
|
||||
std::string lowerCase;
|
||||
|
||||
std::transform (name.begin(), name.end(), std::back_inserter (lowerCase),
|
||||
(int(*)(int)) std::tolower);
|
||||
|
||||
return lowerCase;
|
||||
}
|
||||
}
|
||||
|
||||
bool MWDialogue::Filter::testActor (const ESM::DialInfo& info) const
|
||||
{
|
||||
// actor id
|
||||
if (!info.mActor.empty())
|
||||
if (toLower (info.mActor)!=MWWorld::Class::get (mActor).getId (mActor))
|
||||
if ( Misc::StringUtils::lowerCase (info.mActor)!=MWWorld::Class::get (mActor).getId (mActor))
|
||||
return false;
|
||||
|
||||
bool isCreature = (mActor.getTypeName() != typeid (ESM::NPC).name());
|
||||
|
@ -47,7 +34,7 @@ bool MWDialogue::Filter::testActor (const ESM::DialInfo& info) const
|
|||
|
||||
MWWorld::LiveCellRef<ESM::NPC> *cellRef = mActor.get<ESM::NPC>();
|
||||
|
||||
if (toLower (info.mRace)!=toLower (cellRef->mBase->mRace))
|
||||
if (Misc::StringUtils::lowerCase (info.mRace)!= Misc::StringUtils::lowerCase (cellRef->mBase->mRace))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -59,7 +46,7 @@ bool MWDialogue::Filter::testActor (const ESM::DialInfo& info) const
|
|||
|
||||
MWWorld::LiveCellRef<ESM::NPC> *cellRef = mActor.get<ESM::NPC>();
|
||||
|
||||
if (toLower (info.mClass)!=toLower (cellRef->mBase->mClass))
|
||||
if ( Misc::StringUtils::lowerCase (info.mClass)!= Misc::StringUtils::lowerCase (cellRef->mBase->mClass))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -70,7 +57,7 @@ bool MWDialogue::Filter::testActor (const ESM::DialInfo& info) const
|
|||
return false;
|
||||
|
||||
MWMechanics::NpcStats& stats = MWWorld::Class::get (mActor).getNpcStats (mActor);
|
||||
std::map<std::string, int>::iterator iter = stats.getFactionRanks().find (toLower (info.mNpcFaction));
|
||||
std::map<std::string, int>::iterator iter = stats.getFactionRanks().find ( Misc::StringUtils::lowerCase (info.mNpcFaction));
|
||||
|
||||
if (iter==stats.getFactionRanks().end())
|
||||
return false;
|
||||
|
@ -99,7 +86,7 @@ bool MWDialogue::Filter::testPlayer (const ESM::DialInfo& info) const
|
|||
if (!info.mPcFaction.empty())
|
||||
{
|
||||
MWMechanics::NpcStats& stats = MWWorld::Class::get (player).getNpcStats (player);
|
||||
std::map<std::string,int>::iterator iter = stats.getFactionRanks().find (toLower (info.mPcFaction));
|
||||
std::map<std::string,int>::iterator iter = stats.getFactionRanks().find (Misc::StringUtils::lowerCase (info.mPcFaction));
|
||||
|
||||
if(iter==stats.getFactionRanks().end())
|
||||
return false;
|
||||
|
@ -111,7 +98,7 @@ bool MWDialogue::Filter::testPlayer (const ESM::DialInfo& info) const
|
|||
|
||||
// check cell
|
||||
if (!info.mCell.empty())
|
||||
if (toLower (player.getCell()->mCell->mName) != toLower (info.mCell))
|
||||
if (Misc::StringUtils::lowerCase (player.getCell()->mCell->mName) != Misc::StringUtils::lowerCase (info.mCell))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -242,7 +229,7 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
|
|||
std::string name = select.getName();
|
||||
|
||||
for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end(); ++iter)
|
||||
if (toLower(iter->getCellRef().mRefID) == name)
|
||||
if (Misc::StringUtils::lowerCase(iter->getCellRef().mRefID) == name)
|
||||
sum += iter->getRefData().getCount();
|
||||
|
||||
return sum;
|
||||
|
@ -408,23 +395,23 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
|||
|
||||
case SelectWrapper::Function_Id:
|
||||
|
||||
return select.getName()==toLower (MWWorld::Class::get (mActor).getId (mActor));
|
||||
return select.getName()==Misc::StringUtils::lowerCase (MWWorld::Class::get (mActor).getId (mActor));
|
||||
|
||||
case SelectWrapper::Function_Faction:
|
||||
|
||||
return toLower (mActor.get<ESM::NPC>()->mBase->mFaction)==select.getName();
|
||||
return Misc::StringUtils::lowerCase (mActor.get<ESM::NPC>()->mBase->mFaction)==select.getName();
|
||||
|
||||
case SelectWrapper::Function_Class:
|
||||
|
||||
return toLower (mActor.get<ESM::NPC>()->mBase->mClass)==select.getName();
|
||||
return Misc::StringUtils::lowerCase (mActor.get<ESM::NPC>()->mBase->mClass)==select.getName();
|
||||
|
||||
case SelectWrapper::Function_Race:
|
||||
|
||||
return toLower (mActor.get<ESM::NPC>()->mBase->mRace)==select.getName();
|
||||
return Misc::StringUtils::lowerCase (mActor.get<ESM::NPC>()->mBase->mRace)==select.getName();
|
||||
|
||||
case SelectWrapper::Function_Cell:
|
||||
|
||||
return toLower (mActor.getCell()->mCell->mName)==select.getName();
|
||||
return Misc::StringUtils::lowerCase (mActor.getCell()->mCell->mName)==select.getName();
|
||||
|
||||
case SelectWrapper::Function_SameGender:
|
||||
|
||||
|
@ -433,8 +420,8 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
|||
|
||||
case SelectWrapper::Function_SameRace:
|
||||
|
||||
return toLower (mActor.get<ESM::NPC>()->mBase->mRace)!=
|
||||
toLower (player.get<ESM::NPC>()->mBase->mRace);
|
||||
return Misc::StringUtils::lowerCase (mActor.get<ESM::NPC>()->mBase->mRace)!=
|
||||
Misc::StringUtils::lowerCase (player.get<ESM::NPC>()->mBase->mRace);
|
||||
|
||||
case SelectWrapper::Function_SameFaction:
|
||||
|
||||
|
|
|
@ -8,18 +8,10 @@
|
|||
#include <sstream>
|
||||
#include <iterator>
|
||||
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
std::string toLower (const std::string& name)
|
||||
{
|
||||
std::string lowerCase;
|
||||
|
||||
std::transform (name.begin(), name.end(), std::back_inserter (lowerCase),
|
||||
(int(*)(int)) std::tolower);
|
||||
|
||||
return lowerCase;
|
||||
}
|
||||
|
||||
template<typename T1, typename T2>
|
||||
bool selectCompareImp (char comp, T1 value1, T2 value2)
|
||||
{
|
||||
|
@ -307,5 +299,5 @@ bool MWDialogue::SelectWrapper::selectCompare (bool value) const
|
|||
|
||||
std::string MWDialogue::SelectWrapper::getName() const
|
||||
{
|
||||
return toLower (mSelect.mSelectRule.substr (5));
|
||||
return Misc::StringUtils::lowerCase (mSelect.mSelectRule.substr (5));
|
||||
}
|
||||
|
|
|
@ -37,10 +37,7 @@ namespace {
|
|||
|
||||
std::string lower_string(const std::string& str)
|
||||
{
|
||||
std::string lowerCase;
|
||||
|
||||
std::transform (str.begin(), str.end(), std::back_inserter (lowerCase),
|
||||
(int(*)(int)) std::tolower);
|
||||
std::string lowerCase = Misc::StringUtils::lowerCase (str);
|
||||
|
||||
return lowerCase;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <OgreCompositorChain.h>
|
||||
#include <OgreMaterial.h>
|
||||
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include <openengine/ogre/fader.hpp>
|
||||
|
@ -16,6 +17,9 @@
|
|||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include <components/esm/records.hpp>
|
||||
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
|
@ -214,27 +218,15 @@ namespace MWGui
|
|||
void LoadingScreen::changeWallpaper ()
|
||||
{
|
||||
if (mResources.isNull ())
|
||||
{
|
||||
mResources = Ogre::StringVectorPtr (new Ogre::StringVector);
|
||||
mResources = Ogre::ResourceGroupManager::getSingleton ().findResourceNames ("General", "Splash_*.tga");
|
||||
|
||||
Ogre::StringVectorPtr resources = Ogre::ResourceGroupManager::getSingleton ().listResourceNames ("General", false);
|
||||
for (Ogre::StringVector::const_iterator it = resources->begin(); it != resources->end(); ++it)
|
||||
{
|
||||
if (it->size() < 6)
|
||||
continue;
|
||||
std::string start = it->substr(0, 6);
|
||||
boost::to_lower(start);
|
||||
|
||||
if (start == "splash")
|
||||
mResources->push_back (*it);
|
||||
}
|
||||
}
|
||||
|
||||
if (mResources->size())
|
||||
{
|
||||
std::string randomSplash = mResources->at (rand() % mResources->size());
|
||||
std::string const & randomSplash = mResources->at (rand() % mResources->size());
|
||||
|
||||
Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton ().load (randomSplash, "General");
|
||||
|
||||
mBackgroundImage->setImageTexture (randomSplash);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -263,11 +263,11 @@ namespace MWMechanics
|
|||
|
||||
bool ActiveSpells::isSpellActive(std::string id) const
|
||||
{
|
||||
boost::algorithm::to_lower(id);
|
||||
Misc::StringUtils::toLower(id);
|
||||
for (TContainer::iterator iter = mSpells.begin(); iter != mSpells.end(); ++iter)
|
||||
{
|
||||
std::string left = iter->first;
|
||||
boost::algorithm::to_lower(left);
|
||||
Misc::StringUtils::toLower(left);
|
||||
|
||||
if (iter->first == id)
|
||||
return true;
|
||||
|
|
|
@ -377,16 +377,6 @@ namespace MWMechanics
|
|||
mUpdatePlayer = true;
|
||||
}
|
||||
|
||||
std::string toLower (const std::string& name)
|
||||
{
|
||||
std::string lowerCase;
|
||||
|
||||
std::transform (name.begin(), name.end(), std::back_inserter (lowerCase),
|
||||
(int(*)(int)) std::tolower);
|
||||
|
||||
return lowerCase;
|
||||
}
|
||||
|
||||
int MechanicsManager::getDerivedDisposition(const MWWorld::Ptr& ptr)
|
||||
{
|
||||
MWMechanics::NpcStats npcSkill = MWWorld::Class::get(ptr).getNpcStats(ptr);
|
||||
|
@ -398,7 +388,7 @@ namespace MWMechanics
|
|||
MWMechanics::CreatureStats playerStats = MWWorld::Class::get(playerPtr).getCreatureStats(playerPtr);
|
||||
MWMechanics::NpcStats playerNpcStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr);
|
||||
|
||||
if (toLower(npc->mBase->mRace) == toLower(player->mBase->mRace)) x += MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fDispRaceMod")->getFloat();
|
||||
if (Misc::StringUtils::lowerCase(npc->mBase->mRace) == Misc::StringUtils::lowerCase(player->mBase->mRace)) x += MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fDispRaceMod")->getFloat();
|
||||
|
||||
x += MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fDispPersonalityMult")->getFloat()
|
||||
* (playerStats.getAttribute(ESM::Attribute::Personality).getModified() - MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fDispPersonalityBase")->getFloat());
|
||||
|
@ -408,21 +398,21 @@ namespace MWMechanics
|
|||
std::string npcFaction = "";
|
||||
if(!npcSkill.getFactionRanks().empty()) npcFaction = npcSkill.getFactionRanks().begin()->first;
|
||||
|
||||
if (playerNpcStats.getFactionRanks().find(toLower(npcFaction)) != playerNpcStats.getFactionRanks().end())
|
||||
if (playerNpcStats.getFactionRanks().find(Misc::StringUtils::lowerCase(npcFaction)) != playerNpcStats.getFactionRanks().end())
|
||||
{
|
||||
for(std::vector<ESM::Faction::Reaction>::const_iterator it = MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(toLower(npcFaction))->mReactions.begin();
|
||||
it != MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(toLower(npcFaction))->mReactions.end(); it++)
|
||||
for(std::vector<ESM::Faction::Reaction>::const_iterator it = MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.begin();
|
||||
it != MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.end(); it++)
|
||||
{
|
||||
if(toLower(it->mFaction) == toLower(npcFaction)) reaction = it->mReaction;
|
||||
if(Misc::StringUtils::lowerCase(it->mFaction) == Misc::StringUtils::lowerCase(npcFaction)) reaction = it->mReaction;
|
||||
}
|
||||
rank = playerNpcStats.getFactionRanks().find(toLower(npcFaction))->second;
|
||||
rank = playerNpcStats.getFactionRanks().find(Misc::StringUtils::lowerCase(npcFaction))->second;
|
||||
}
|
||||
else if (npcFaction != "")
|
||||
{
|
||||
for(std::vector<ESM::Faction::Reaction>::const_iterator it = MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(toLower(npcFaction))->mReactions.begin();
|
||||
it != MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(toLower(npcFaction))->mReactions.end();it++)
|
||||
for(std::vector<ESM::Faction::Reaction>::const_iterator it = MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.begin();
|
||||
it != MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(Misc::StringUtils::lowerCase(npcFaction))->mReactions.end();it++)
|
||||
{
|
||||
if(playerNpcStats.getFactionRanks().find(toLower(it->mFaction)) != playerNpcStats.getFactionRanks().end() )
|
||||
if(playerNpcStats.getFactionRanks().find(Misc::StringUtils::lowerCase(it->mFaction)) != playerNpcStats.getFactionRanks().end() )
|
||||
{
|
||||
if(it->mReaction<reaction) reaction = it->mReaction;
|
||||
}
|
||||
|
|
|
@ -90,6 +90,7 @@ namespace MWMechanics
|
|||
|
||||
virtual void getPersuasionDispositionChange (const MWWorld::Ptr& npc, PersuasionType type,
|
||||
float currentTemporaryDispositionDelta, bool& success, float& tempChange, float& permChange);
|
||||
void toLower(std::string npcFaction);
|
||||
///< Perform a persuasion action on NPC
|
||||
};
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
|
|||
mHairModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHair)->mModel;
|
||||
|
||||
mBodyPrefix = "b_n_" + mNpc->mRace;
|
||||
std::transform(mBodyPrefix.begin(), mBodyPrefix.end(), mBodyPrefix.begin(), ::tolower);
|
||||
Misc::StringUtils::toLower(mBodyPrefix);
|
||||
|
||||
bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0;
|
||||
std::string smodel = (!isBeast ? "meshes\\base_anim.nif" : "meshes\\base_animkna.nif");
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace MWScript
|
|||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
std::string cell = (runtime.getStringLiteral (runtime[0].mInteger));
|
||||
boost::algorithm::to_lower(cell);
|
||||
Misc::StringUtils::toLower(cell);
|
||||
runtime.pop();
|
||||
|
||||
// "Will match complete or partial cells, so ShowMap, "Vivec" will show cells Vivec and Vivec, Fred's House as well."
|
||||
|
@ -115,7 +115,7 @@ namespace MWScript
|
|||
for (; it != cells.extEnd(); ++it)
|
||||
{
|
||||
std::string name = it->mName;
|
||||
boost::algorithm::to_lower(name);
|
||||
Misc::StringUtils::toLower(name);
|
||||
if (name.find(cell) != std::string::npos)
|
||||
MWBase::Environment::get().getWindowManager()->addVisitedLocation (
|
||||
it->mName,
|
||||
|
|
|
@ -512,7 +512,7 @@ namespace MWScript
|
|||
factionID = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
}
|
||||
boost::algorithm::to_lower(factionID);
|
||||
Misc::StringUtils::toLower(factionID);
|
||||
if(factionID != "")
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
|
@ -541,7 +541,7 @@ namespace MWScript
|
|||
factionID = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
}
|
||||
boost::algorithm::to_lower(factionID);
|
||||
Misc::StringUtils::toLower(factionID);
|
||||
if(factionID != "")
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
|
@ -574,7 +574,7 @@ namespace MWScript
|
|||
factionID = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
}
|
||||
boost::algorithm::to_lower(factionID);
|
||||
Misc::StringUtils::toLower(factionID);
|
||||
if(factionID != "")
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
|
@ -612,7 +612,7 @@ namespace MWScript
|
|||
factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first;
|
||||
}
|
||||
}
|
||||
boost::algorithm::to_lower(factionID);
|
||||
Misc::StringUtils::toLower(factionID);
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
if(factionID!="")
|
||||
{
|
||||
|
@ -674,7 +674,7 @@ namespace MWScript
|
|||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
runtime.push (MWWorld::Class::get (ptr).getNpcStats (ptr).getBaseDisposition());
|
||||
runtime.push (MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(ptr));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -714,7 +714,7 @@ namespace MWScript
|
|||
if (factionId.empty())
|
||||
throw std::runtime_error ("failed to determine faction");
|
||||
|
||||
boost::algorithm::to_lower (factionId);
|
||||
Misc::StringUtils::toLower (factionId);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
runtime.push (
|
||||
|
@ -750,7 +750,7 @@ namespace MWScript
|
|||
if (factionId.empty())
|
||||
throw std::runtime_error ("failed to determine faction");
|
||||
|
||||
boost::algorithm::to_lower (factionId);
|
||||
Misc::StringUtils::toLower (factionId);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Class::get (player).getNpcStats (player).setFactionReputation (factionId, value);
|
||||
|
@ -785,7 +785,7 @@ namespace MWScript
|
|||
if (factionId.empty())
|
||||
throw std::runtime_error ("failed to determine faction");
|
||||
|
||||
boost::algorithm::to_lower (factionId);
|
||||
Misc::StringUtils::toLower (factionId);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Class::get (player).getNpcStats (player).setFactionReputation (factionId,
|
||||
|
@ -830,11 +830,11 @@ namespace MWScript
|
|||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
std::string race = runtime.getStringLiteral(runtime[0].mInteger);
|
||||
boost::algorithm::to_lower(race);
|
||||
Misc::StringUtils::toLower(race);
|
||||
runtime.pop();
|
||||
|
||||
std::string npcRace = ptr.get<ESM::NPC>()->mBase->mRace;
|
||||
boost::algorithm::to_lower(npcRace);
|
||||
Misc::StringUtils::toLower(npcRace);
|
||||
|
||||
runtime.push (npcRace == race);
|
||||
}
|
||||
|
@ -878,7 +878,7 @@ namespace MWScript
|
|||
factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first;
|
||||
}
|
||||
}
|
||||
boost::algorithm::to_lower(factionID);
|
||||
Misc::StringUtils::toLower(factionID);
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
if(factionID!="")
|
||||
{
|
||||
|
@ -929,7 +929,7 @@ namespace MWScript
|
|||
if(factionID!="")
|
||||
{
|
||||
std::set<std::string>& expelled = MWWorld::Class::get(player).getNpcStats(player).getExpelled ();
|
||||
boost::algorithm::to_lower(factionID);
|
||||
Misc::StringUtils::toLower(factionID);
|
||||
expelled.insert(factionID);
|
||||
}
|
||||
}
|
||||
|
@ -965,7 +965,7 @@ namespace MWScript
|
|||
if(factionID!="")
|
||||
{
|
||||
std::set<std::string>& expelled = MWWorld::Class::get(player).getNpcStats(player).getExpelled ();
|
||||
boost::algorithm::to_lower(factionID);
|
||||
Misc::StringUtils::toLower(factionID);
|
||||
expelled.erase (factionID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,10 +153,7 @@ MWWorld::Ptr MWWorld::Cells::getPtr (const std::string& name, Ptr::CellStore& ce
|
|||
|
||||
if (cell.mState==Ptr::CellStore::State_Preloaded)
|
||||
{
|
||||
std::string lowerCase;
|
||||
|
||||
std::transform (name.begin(), name.end(), std::back_inserter (lowerCase),
|
||||
(int(*)(int)) std::tolower);
|
||||
std::string lowerCase = Misc::StringUtils::lowerCase(name);
|
||||
|
||||
if (std::binary_search (cell.mIds.begin(), cell.mIds.end(), lowerCase))
|
||||
{
|
||||
|
|
|
@ -56,10 +56,7 @@ namespace MWWorld
|
|||
// Get each reference in turn
|
||||
while (mCell->getNextRef (esm, ref))
|
||||
{
|
||||
std::string lowerCase;
|
||||
|
||||
std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase),
|
||||
(int(*)(int)) std::tolower);
|
||||
std::string lowerCase = Misc::StringUtils::lowerCase (ref.mRefID);
|
||||
|
||||
mIds.push_back (lowerCase);
|
||||
}
|
||||
|
@ -82,10 +79,7 @@ namespace MWWorld
|
|||
// Get each reference in turn
|
||||
while(mCell->getNextRef(esm, ref))
|
||||
{
|
||||
std::string lowerCase;
|
||||
|
||||
std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase),
|
||||
(int(*)(int)) std::tolower);
|
||||
std::string lowerCase = Misc::StringUtils::lowerCase(ref.mRefID);
|
||||
|
||||
int rec = store.find(ref.mRefID);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace
|
|||
|
||||
bool compare_string_ci(std::string str1, std::string str2)
|
||||
{
|
||||
boost::algorithm::to_lower(str1);
|
||||
Misc::StringUtils::toLower(str1);
|
||||
return str1 == str2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -497,7 +497,7 @@ void WeatherManager::update(float duration)
|
|||
if (exterior)
|
||||
{
|
||||
std::string regionstr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->mCell->mRegion;
|
||||
boost::algorithm::to_lower(regionstr);
|
||||
Misc::StringUtils::toLower(regionstr);
|
||||
|
||||
if (mWeatherUpdateTime <= 0 || regionstr != mCurrentRegion)
|
||||
{
|
||||
|
|
|
@ -37,28 +37,142 @@ namespace
|
|||
using namespace Ogre;
|
||||
using namespace Bsa;
|
||||
|
||||
struct ciLessBoost : std::binary_function<std::string, std::string, bool>
|
||||
struct PathPatternMatcher
|
||||
{
|
||||
bool operator() (const std::string & s1, const std::string & s2) const {
|
||||
//case insensitive version of is_less
|
||||
return boost::ilexicographical_compare(s1, s2);
|
||||
}
|
||||
};
|
||||
|
||||
struct pathComparer
|
||||
{
|
||||
private:
|
||||
std::string find;
|
||||
|
||||
public:
|
||||
pathComparer(const std::string& toFind) : find(toFind) { }
|
||||
|
||||
bool operator() (const std::string& other)
|
||||
PathPatternMatcher (char const * pattern) : pattern (pattern)
|
||||
{
|
||||
return boost::iequals(find, other);
|
||||
}
|
||||
|
||||
bool operator () (char const * input)
|
||||
{
|
||||
char const * p = pattern;
|
||||
char const * i = input;
|
||||
|
||||
while (*p && *i)
|
||||
{
|
||||
if (*p == '*')
|
||||
{
|
||||
++p;
|
||||
|
||||
while (*i && *i != *p && *i != '/' && *i != '\\')
|
||||
++i;
|
||||
}
|
||||
else
|
||||
if (*p == '?')
|
||||
{
|
||||
if (*i == '/' || *i == '\\')
|
||||
break;
|
||||
|
||||
++i, ++p;
|
||||
}
|
||||
if (*p == '/' || *p == '\\')
|
||||
{
|
||||
if (*i != '/' && *i != '\\')
|
||||
break;
|
||||
|
||||
++i, ++p;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*i != *p)
|
||||
break;
|
||||
|
||||
++i, ++p;
|
||||
}
|
||||
}
|
||||
|
||||
return *p == 0 && *i == 0;
|
||||
}
|
||||
|
||||
private:
|
||||
char const * pattern;
|
||||
};
|
||||
|
||||
struct FileNameGatherer
|
||||
{
|
||||
StringVectorPtr ptr;
|
||||
|
||||
FileNameGatherer (StringVectorPtr ptr) : ptr (ptr)
|
||||
{
|
||||
}
|
||||
|
||||
void operator () (std::string const & filename) const
|
||||
{
|
||||
ptr->push_back (filename);
|
||||
}
|
||||
};
|
||||
|
||||
struct FileInfoGatherer
|
||||
{
|
||||
Archive const * archive;
|
||||
FileInfoListPtr ptr;
|
||||
|
||||
FileInfoGatherer (Archive const * archive, FileInfoListPtr ptr) :
|
||||
archive (archive), ptr (ptr)
|
||||
{
|
||||
}
|
||||
|
||||
void operator () (std::string filename) const
|
||||
{
|
||||
FileInfo fi;
|
||||
|
||||
std::size_t pt = filename.rfind ('/');
|
||||
if (pt == std::string::npos)
|
||||
pt = 0;
|
||||
|
||||
fi.archive = const_cast <Archive *> (archive);
|
||||
fi.path = filename.substr (0, pt);
|
||||
fi.filename = filename.substr (pt);
|
||||
fi.compressedSize = fi.uncompressedSize = 0;
|
||||
|
||||
ptr->push_back(fi);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename file_iterator, typename filename_extractor, typename match_handler>
|
||||
void matchFiles (bool recursive, std::string const & pattern, file_iterator begin, file_iterator end, filename_extractor filenameExtractor, match_handler matchHandler)
|
||||
{
|
||||
if (recursive && pattern == "*")
|
||||
{
|
||||
for (file_iterator i = begin; i != end; ++i)
|
||||
matchHandler (filenameExtractor (*i));
|
||||
}
|
||||
else
|
||||
{
|
||||
PathPatternMatcher matcher (pattern.c_str ());
|
||||
|
||||
if (recursive)
|
||||
{
|
||||
for (file_iterator i = begin; i != end; ++i)
|
||||
{
|
||||
char const * filename = filenameExtractor (*i);
|
||||
char const * matchable_part = filename;
|
||||
|
||||
for (char const * j = matchable_part; *j; ++j)
|
||||
{
|
||||
if (*j == '/' || *j == '\\')
|
||||
matchable_part = j + 1;
|
||||
}
|
||||
|
||||
if (matcher (matchable_part))
|
||||
matchHandler (filename);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (file_iterator i = begin; i != end; ++i)
|
||||
{
|
||||
char const * filename = filenameExtractor (*i);
|
||||
|
||||
if (matcher (filename))
|
||||
matchHandler (filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static bool fsstrict = false;
|
||||
|
||||
/// An OGRE Archive wrapping a BSAFile archive
|
||||
|
@ -94,6 +208,11 @@ class DirArchive: public Ogre::Archive
|
|||
return mIndex.find (normalized);
|
||||
}
|
||||
|
||||
static char const * extractFilename (index::value_type const & entry)
|
||||
{
|
||||
return entry.first.c_str ();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
DirArchive(const String& name)
|
||||
|
@ -143,27 +262,20 @@ public:
|
|||
|
||||
StringVectorPtr list(bool recursive = true, bool dirs = false)
|
||||
{
|
||||
StringVectorPtr ptr = StringVectorPtr(new StringVector());
|
||||
std::cout << "DirArchive<" << getName () << ">::list" << std::endl;
|
||||
return ptr;
|
||||
return find ("*", recursive, dirs);
|
||||
}
|
||||
|
||||
FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false)
|
||||
{
|
||||
FileInfoListPtr ptr = FileInfoListPtr(new FileInfoList());
|
||||
std::cout << "DirArchive<" << getName () << ">::listFileInfo" << std::endl;
|
||||
return ptr;
|
||||
return findFileInfo ("*", recursive, dirs);
|
||||
}
|
||||
|
||||
StringVectorPtr find(const String& pattern, bool recursive = true,
|
||||
bool dirs = false)
|
||||
{
|
||||
std::string normalizedPattern = normalize_path (pattern.begin (), pattern.end ());
|
||||
StringVectorPtr ptr = StringVectorPtr(new StringVector());
|
||||
|
||||
if (pattern == "*")
|
||||
for (index::const_iterator i = mIndex.begin (); i != mIndex.end (); ++i)
|
||||
ptr->push_back (i->first);
|
||||
|
||||
matchFiles (recursive, normalizedPattern, mIndex.begin (), mIndex.end (), extractFilename, FileNameGatherer (ptr));
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
@ -178,21 +290,20 @@ public:
|
|||
bool dirs = false) const
|
||||
{
|
||||
FileInfoListPtr ptr = FileInfoListPtr(new FileInfoList());
|
||||
FileInfoGatherer gatherer (this, ptr);
|
||||
|
||||
index::const_iterator i = lookup_filename (pattern);
|
||||
std::string normalizedPattern = normalize_path (pattern.begin (), pattern.end ());
|
||||
|
||||
index::const_iterator i = mIndex.find (normalizedPattern);
|
||||
|
||||
if (i != mIndex.end ())
|
||||
{
|
||||
FileInfo fi;
|
||||
gatherer (i->first);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
std::size_t npos = i->first.rfind ('/');
|
||||
|
||||
fi.archive = this;
|
||||
fi.filename = npos != std::string::npos ? i->first.substr (npos) : i->first;
|
||||
fi.path = npos != std::string::npos ? i->first.substr (0, npos) : "";
|
||||
fi.compressedSize = fi.uncompressedSize = 0;
|
||||
|
||||
ptr->push_back(fi);
|
||||
matchFiles (recursive, normalizedPattern, mIndex.begin (), mIndex.end (), extractFilename, gatherer);
|
||||
}
|
||||
|
||||
return ptr;
|
||||
|
@ -203,6 +314,11 @@ class BSAArchive : public Archive
|
|||
{
|
||||
BSAFile arc;
|
||||
|
||||
static char const * extractFilename (BSAFile::FileStruct const & entry)
|
||||
{
|
||||
return entry.name;
|
||||
}
|
||||
|
||||
public:
|
||||
BSAArchive(const String& name)
|
||||
: Archive(name, "BSA")
|
||||
|
@ -230,26 +346,18 @@ public:
|
|||
return arc.exists(filename.c_str());
|
||||
}
|
||||
|
||||
bool cexists(const String& filename) const {
|
||||
return arc.exists(filename.c_str());
|
||||
}
|
||||
|
||||
time_t getModifiedTime(const String&) { return 0; }
|
||||
|
||||
// This is never called as far as I can see.
|
||||
StringVectorPtr list(bool recursive = true, bool dirs = false)
|
||||
{
|
||||
//std::cout << "list(" << recursive << ", " << dirs << ")\n";
|
||||
StringVectorPtr ptr = StringVectorPtr(new StringVector());
|
||||
return ptr;
|
||||
return find ("*", recursive, dirs);
|
||||
}
|
||||
|
||||
// Also never called.
|
||||
FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false)
|
||||
{
|
||||
//std::cout << "listFileInfo(" << recursive << ", " << dirs << ")\n";
|
||||
FileInfoListPtr ptr = FileInfoListPtr(new FileInfoList());
|
||||
return ptr;
|
||||
return findFileInfo ("*", recursive, dirs);
|
||||
}
|
||||
|
||||
// After load() is called, find("*") is called once. It doesn't seem
|
||||
|
@ -258,16 +366,8 @@ public:
|
|||
StringVectorPtr find(const String& pattern, bool recursive = true,
|
||||
bool dirs = false)
|
||||
{
|
||||
//std::cout << "find(" << pattern << ", " << recursive
|
||||
// << ", " << dirs << ")\n";
|
||||
StringVectorPtr ptr = StringVectorPtr(new StringVector());
|
||||
|
||||
BSAFile::FileList const & files = arc.getList ();
|
||||
|
||||
if (pattern == "*")
|
||||
for (BSAFile::FileList::const_iterator i = files.begin (); i != files.end (); ++i)
|
||||
ptr->push_back (i->name);
|
||||
|
||||
matchFiles (recursive, pattern, arc.getList ().begin (), arc.getList ().end (), extractFilename, FileNameGatherer (ptr));
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
@ -283,45 +383,7 @@ public:
|
|||
bool dirs = false) const
|
||||
{
|
||||
FileInfoListPtr ptr = FileInfoListPtr(new FileInfoList());
|
||||
|
||||
// Check if the file exists (only works for single files - wild
|
||||
// cards and recursive search isn't implemented.)
|
||||
if(cexists(pattern))
|
||||
{
|
||||
FileInfo fi;
|
||||
fi.archive = this;
|
||||
fi.filename = pattern;
|
||||
// It apparently doesn't matter that we return bogus
|
||||
// information
|
||||
fi.path = "";
|
||||
fi.compressedSize = fi.uncompressedSize = 0;
|
||||
|
||||
ptr->push_back(fi);
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
FileInfoListPtr findFileInfo(const String& pattern, bool recursive = true,
|
||||
bool dirs = false)
|
||||
{
|
||||
FileInfoListPtr ptr = FileInfoListPtr(new FileInfoList());
|
||||
|
||||
// Check if the file exists (only works for single files - wild
|
||||
// cards and recursive search isn't implemented.)
|
||||
if(cexists(pattern))
|
||||
{
|
||||
FileInfo fi;
|
||||
fi.archive = this;
|
||||
fi.filename = pattern;
|
||||
// It apparently doesn't matter that we return bogus
|
||||
// information
|
||||
fi.path = "";
|
||||
fi.compressedSize = fi.uncompressedSize = 0;
|
||||
|
||||
ptr->push_back(fi);
|
||||
}
|
||||
|
||||
matchFiles (recursive, pattern, arc.getList ().begin (), arc.getList ().end (), extractFilename, FileInfoGatherer (this, ptr));
|
||||
return ptr;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "stringparser.hpp"
|
||||
#include "extensions.hpp"
|
||||
#include "context.hpp"
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
|
@ -199,8 +200,8 @@ namespace Compiler
|
|||
{
|
||||
mMemberOp = false;
|
||||
|
||||
std::string name2 = toLower (name);
|
||||
std::string id = toLower (mExplicit);
|
||||
std::string name2 = Misc::StringUtils::lowerCase (name);
|
||||
std::string id = Misc::StringUtils::lowerCase (mExplicit);
|
||||
|
||||
char type = getContext().getMemberType (name2, id);
|
||||
|
||||
|
@ -285,7 +286,7 @@ namespace Compiler
|
|||
{
|
||||
start();
|
||||
|
||||
std::string name2 = toLower (name);
|
||||
std::string name2 = Misc::StringUtils::lowerCase (name);
|
||||
|
||||
char type = mLocals.getType (name2);
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "locals.hpp"
|
||||
#include "generator.hpp"
|
||||
#include "extensions.hpp"
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
|
@ -91,13 +92,13 @@ namespace Compiler
|
|||
return false;
|
||||
}
|
||||
|
||||
std::string name2 = toLower (name);
|
||||
std::string name2 = Misc::StringUtils::lowerCase (name);
|
||||
|
||||
char type = mLocals.getType (name2);
|
||||
|
||||
if (type!=' ')
|
||||
{
|
||||
getErrorHandler().error ("can't re-declare local variable", loc);
|
||||
getErrorHandler().error ("catoLowern't re-declare local variable", loc);
|
||||
SkipParser skip (getErrorHandler(), getContext());
|
||||
scanner.scan (skip);
|
||||
return false;
|
||||
|
@ -112,7 +113,7 @@ namespace Compiler
|
|||
|
||||
if (mState==SetState)
|
||||
{
|
||||
std::string name2 = toLower (name);
|
||||
std::string name2 = Misc::StringUtils::lowerCase (name);
|
||||
mName = name2;
|
||||
|
||||
// local variable?
|
||||
|
@ -138,7 +139,7 @@ namespace Compiler
|
|||
|
||||
if (mState==SetMemberVarState)
|
||||
{
|
||||
mMemberName = toLower (name);
|
||||
mMemberName = Misc::StringUtils::lowerCase (name);
|
||||
char type = getContext().getMemberType (mMemberName, mName);
|
||||
|
||||
if (type!=' ')
|
||||
|
@ -205,13 +206,13 @@ namespace Compiler
|
|||
if (mState==BeginState && getContext().isId (name))
|
||||
{
|
||||
mState = PotentialExplicitState;
|
||||
mExplicit = toLower (name);
|
||||
mExplicit = Misc::StringUtils::lowerCase (name);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mState==BeginState && mAllowExpression)
|
||||
{
|
||||
std::string name2 = toLower (name);
|
||||
std::string name2 = Misc::StringUtils::lowerCase (name);
|
||||
|
||||
char type = mLocals.getType (name2);
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "exception.hpp"
|
||||
#include "scanner.hpp"
|
||||
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
// Report the error and throw an exception.
|
||||
|
@ -57,10 +59,7 @@ namespace Compiler
|
|||
|
||||
std::string Parser::toLower (const std::string& name)
|
||||
{
|
||||
std::string lowerCase;
|
||||
|
||||
std::transform (name.begin(), name.end(), std::back_inserter (lowerCase),
|
||||
(int(*)(int)) std::tolower);
|
||||
std::string lowerCase = Misc::StringUtils::lowerCase(name);
|
||||
|
||||
return lowerCase;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include "parser.hpp"
|
||||
#include "extensions.hpp"
|
||||
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
bool Scanner::get (char& c)
|
||||
|
@ -268,11 +270,7 @@ namespace Compiler
|
|||
|
||||
int i = 0;
|
||||
|
||||
std::string lowerCase;
|
||||
lowerCase.reserve (name.size());
|
||||
|
||||
std::transform (name.begin(), name.end(), std::back_inserter (lowerCase),
|
||||
(int(*)(int)) std::tolower);
|
||||
std::string lowerCase = Misc::StringUtils::lowerCase(name);
|
||||
|
||||
for (; keywords[i]; ++i)
|
||||
if (lowerCase==keywords[i])
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "scanner.hpp"
|
||||
#include "generator.hpp"
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
|
@ -22,7 +23,7 @@ namespace Compiler
|
|||
{
|
||||
start();
|
||||
if (mSmashCase)
|
||||
Generator::pushString (mCode, mLiterals, toLower (name));
|
||||
Generator::pushString (mCode, mLiterals, Misc::StringUtils::lowerCase (name));
|
||||
else
|
||||
Generator::pushString (mCode, mLiterals, name);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <iostream>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <../components/misc/stringops.hpp>
|
||||
|
||||
namespace Files
|
||||
{
|
||||
|
@ -45,14 +45,14 @@ namespace Files
|
|||
if( !acceptableExtensions.empty() )
|
||||
{
|
||||
fileExtension = boost::filesystem::path (listIter->extension()).string();
|
||||
boost::algorithm::to_lower(fileExtension);
|
||||
Misc::StringUtils::toLower(fileExtension);
|
||||
if(!containsVectorString(acceptableExtensions, fileExtension))
|
||||
continue;
|
||||
}
|
||||
|
||||
type = boost::filesystem::path (listIter->parent_path().leaf()).string();
|
||||
if (!strict)
|
||||
boost::algorithm::to_lower(type);
|
||||
Misc::StringUtils::toLower(type);
|
||||
|
||||
mMap[type].push_back(*listIter);
|
||||
// std::cout << "Added path: " << listIter->string() << " in section "<< type <<std::endl;
|
||||
|
@ -63,7 +63,7 @@ namespace Files
|
|||
bool FileLibrary::containsSection(std::string sectionName, bool strict)
|
||||
{
|
||||
if (!strict)
|
||||
boost::algorithm::to_lower(sectionName);
|
||||
Misc::StringUtils::toLower(sectionName);
|
||||
StringPathContMap::const_iterator mapIter = mMap.find(sectionName);
|
||||
if (mapIter == mMap.end())
|
||||
return false;
|
||||
|
@ -75,7 +75,7 @@ namespace Files
|
|||
const PathContainer* FileLibrary::section(std::string sectionName, bool strict)
|
||||
{
|
||||
if (!strict)
|
||||
boost::algorithm::to_lower(sectionName);
|
||||
Misc::StringUtils::toLower(sectionName);
|
||||
StringPathContMap::const_iterator mapIter = mMap.find(sectionName);
|
||||
if (mapIter == mMap.end())
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <../components/misc/stringops.hpp>
|
||||
|
||||
namespace Files
|
||||
{
|
||||
|
@ -87,7 +88,7 @@ bool isFile(const char *name)
|
|||
|
||||
if (!strict)
|
||||
{
|
||||
boost::algorithm::to_lower(toFindStr);
|
||||
Misc::StringUtils::toLower(toFindStr);
|
||||
}
|
||||
|
||||
for (Files::PathContainer::const_iterator it = list.begin(); it != list.end(); ++it)
|
||||
|
@ -99,7 +100,7 @@ bool isFile(const char *name)
|
|||
|
||||
if (!strict)
|
||||
{
|
||||
boost::algorithm::to_lower(fullPath);
|
||||
Misc::StringUtils::toLower(fullPath);
|
||||
}
|
||||
if(endingMatches(fullPath, toFindStr))
|
||||
{
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <extern/shiny/Main/Factory.hpp>
|
||||
|
||||
#include <components/nif/node.hpp>
|
||||
#include <components/misc/stringops.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
#include <components/nifoverrides/nifoverrides.hpp>
|
||||
|
||||
|
@ -297,11 +298,8 @@ static TextKeyMap extractTextKeys(const Nif::NiTextKeyExtraData *tk)
|
|||
}
|
||||
|
||||
std::string::size_type nextpos = std::min(str.find('\r', pos), str.find('\n', pos));
|
||||
std::string result;
|
||||
result.reserve(str.length());
|
||||
std::transform(str.begin()+pos, str.begin()+std::min(str.length(), nextpos),
|
||||
std::back_inserter(result), ::tolower);
|
||||
textkeys.insert(std::make_pair(tk->list[i].time, result));
|
||||
std::string result = str.substr(pos, nextpos-pos);
|
||||
textkeys.insert(std::make_pair(tk->list[i].time, Misc::StringUtils::toLower(result)));
|
||||
|
||||
pos = nextpos;
|
||||
}
|
||||
|
@ -1073,7 +1071,7 @@ public:
|
|||
if(mSkelName.length() > 0 && mName != mSkelName)
|
||||
fullname += "@skel="+mSkelName;
|
||||
|
||||
std::transform(fullname.begin(), fullname.end(), fullname.begin(), ::tolower);
|
||||
Misc::StringUtils::toLower(fullname);
|
||||
Ogre::MeshPtr mesh = meshMgr.getByName(fullname);
|
||||
if(mesh.isNull())
|
||||
{
|
||||
|
@ -1157,7 +1155,7 @@ EntityList Loader::createEntities(Ogre::SceneNode *parentNode, std::string name,
|
|||
{
|
||||
EntityList entitylist;
|
||||
|
||||
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
|
||||
Misc::StringUtils::toLower(name);
|
||||
MeshInfoList meshes = load(name, name, group);
|
||||
if(meshes.size() == 0)
|
||||
return entitylist;
|
||||
|
@ -1206,14 +1204,14 @@ EntityList Loader::createEntities(Ogre::Entity *parent, const std::string &bonen
|
|||
{
|
||||
EntityList entitylist;
|
||||
|
||||
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
|
||||
Misc::StringUtils::toLower(name);
|
||||
MeshInfoList meshes = load(name, parent->getMesh()->getSkeletonName(), group);
|
||||
if(meshes.size() == 0)
|
||||
return entitylist;
|
||||
|
||||
Ogre::SceneManager *sceneMgr = parentNode->getCreator();
|
||||
std::string filter; filter.resize(bonename.length());
|
||||
std::transform(bonename.begin(), bonename.end(), filter.begin(), ::tolower);
|
||||
std::string filter = bonename;
|
||||
Misc::StringUtils::toLower(filter);
|
||||
for(size_t i = 0;i < meshes.size();i++)
|
||||
{
|
||||
Ogre::Entity *ent = sceneMgr->createEntity(meshes[i].mMeshName);
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
#include <OgreStringConverter.h>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <../components/misc/stringops.hpp>
|
||||
|
||||
|
||||
using namespace NifOverrides;
|
||||
|
||||
|
@ -19,7 +20,7 @@ TransparencyResult Overrides::getTransparencyOverride(const std::string& texture
|
|||
result.first = false;
|
||||
|
||||
std::string tex = texture;
|
||||
boost::to_lower(tex);
|
||||
Misc::StringUtils::toLower(tex);
|
||||
|
||||
Ogre::ConfigFile::SectionIterator seci = mTransparencyOverrides.getSectionIterator();
|
||||
while (seci.hasMoreElements())
|
||||
|
|
Loading…
Reference in a new issue