Changed: Replace strlwr by toLower

This commit is contained in:
kervala 2016-01-09 16:07:38 +01:00
parent 8875d144bc
commit c1c836a9b3
11 changed files with 35 additions and 39 deletions

View file

@ -280,11 +280,11 @@ NLMISC_COMMAND(gotoNote, "go to a note", "<id>|<text>")
if(i != 0) tok += " "; if(i != 0) tok += " ";
tok += args[i]; tok += args[i];
} }
tok = strlwr(tok); tok = toLower(tok);
list<C3DNotes::CNote>::iterator it; list<C3DNotes::CNote>::iterator it;
for(it = Notes.Notes.begin(); it != Notes.Notes.end(); it++) for(it = Notes.Notes.begin(); it != Notes.Notes.end(); it++)
{ {
string note = strlwr((*it).Note); string note = toLower((*it).Note);
if(note.find(tok) != string::npos) if(note.find(tok) != string::npos)
{ {
pos = (*it).Position; pos = (*it).Position;

View file

@ -64,8 +64,7 @@ void CAnimationFX::buildTrack(NL3D::UAnimationSet *as)
nlassert(Sheet != NULL); nlassert(Sheet != NULL);
if (!as) return; if (!as) return;
if (Sheet->TrajectoryAnim.empty()) return; if (Sheet->TrajectoryAnim.empty()) return;
std::string animName = Sheet->TrajectoryAnim; std::string animName = NLMISC::toLower(Sheet->TrajectoryAnim);
NLMISC::strlwr(animName);
uint id = as->getAnimationIdByName(animName); uint id = as->getAnimationIdByName(animName);
NL3D::UAnimation *anim = NULL; NL3D::UAnimation *anim = NULL;
if (id != NL3D::UAnimationSet::NotFound) if (id != NL3D::UAnimationSet::NotFound)

View file

@ -204,7 +204,7 @@ void CAutomatonStateSheet::build(const NLGEORGES::UFormElm &item, const string &
for(uint mode = 0; mode<MBEHAV::NUMBER_OF_MODES; ++mode) for(uint mode = 0; mode<MBEHAV::NUMBER_OF_MODES; ++mode)
{ {
string animset; string animset;
animset = NLMISC::strlwr(MBEHAV::modeToString((MBEHAV::EMode)mode)); animset = NLMISC::toLower(MBEHAV::modeToString((MBEHAV::EMode)mode));
if(animset != "unknown_mode") if(animset != "unknown_mode")
{ {
string resultTransition; string resultTransition;
@ -495,9 +495,9 @@ void CAutomatonListSheet::build(const NLGEORGES::UFormElm &rootList)
for(uint mode = 0; mode<MBEHAV::NUMBER_OF_MODES; ++mode) for(uint mode = 0; mode<MBEHAV::NUMBER_OF_MODES; ++mode)
{ {
// Get the Mode Name // Get the Mode Name
string modeName = NLMISC::strlwr(MBEHAV::modeToString((MBEHAV::EMode)mode)); string modeName = NLMISC::toLower(MBEHAV::modeToString((MBEHAV::EMode)mode));
// Compute the automaton name // Compute the automaton name
string filename = NLMISC::strlwr(automatonType) + "_" + modeName + ".automaton"; string filename = NLMISC::toLower(automatonType) + "_" + modeName + ".automaton";
// Push some information // Push some information
nlinfo("loading automaton '%s'.", filename.c_str()); nlinfo("loading automaton '%s'.", filename.c_str());
// Load the automaton's form. // Load the automaton's form.

View file

@ -126,7 +126,7 @@ void CCharacterSheet::readEquipment(const NLGEORGES::UFormElm &form, const strin
string itemName; string itemName;
if(!form.getValueByName(itemName, string(key + ".Item").c_str() )) if(!form.getValueByName(itemName, string(key + ".Item").c_str() ))
debug(NLMISC::toString("Key '%s.Item' not found.", key.c_str())); debug(NLMISC::toString("Key '%s.Item' not found.", key.c_str()));
slot.IdItem = ClientSheetsStrings.add(NLMISC::strlwr(itemName)); slot.IdItem = ClientSheetsStrings.add(NLMISC::toLower(itemName));
// Get the texture. // Get the texture.
if(!form.getValueByName(slot.Texture, string(key + ".Texture").c_str() )) if(!form.getValueByName(slot.Texture, string(key + ".Texture").c_str() ))
@ -221,7 +221,7 @@ void CCharacterSheet::build(const NLGEORGES::UFormElm &item)
if(AnimSetBaseName.empty()) if(AnimSetBaseName.empty())
debug("AnimSetBaseName is Empty."); debug("AnimSetBaseName is Empty.");
else else
NLMISC::strlwr(AnimSetBaseName); // Force the CASE in UPPER to not be CASE SENSITIVE. AnimSetBaseName = NLMISC::toLower(AnimSetBaseName); // Force the CASE in UPPER to not be CASE SENSITIVE.
} }
else else
debug("Key '3d data.AnimSetBaseName' not found."); debug("Key '3d data.AnimSetBaseName' not found.");
@ -235,7 +235,7 @@ void CCharacterSheet::build(const NLGEORGES::UFormElm &item)
debug("Automaton is Empty."); debug("Automaton is Empty.");
// Lower Case // Lower Case
else else
NLMISC::strlwr(Automaton); Automaton = NLMISC::toLower(Automaton);
} }
// Key not Found // Key not Found
else else

View file

@ -177,28 +177,28 @@ void CItemSheet::build(const NLGEORGES::UFormElm &item)
string IconMain; string IconMain;
if(!item.getValueByName (IconMain, "3d.icon")) if(!item.getValueByName (IconMain, "3d.icon"))
debug("key '3d.icon' not found."); debug("key '3d.icon' not found.");
IconMain = strlwr (IconMain); IconMain = toLower(IconMain);
IdIconMain = ClientSheetsStrings.add(IconMain); IdIconMain = ClientSheetsStrings.add(IconMain);
// Get the icon associated. // Get the icon associated.
string IconBack; string IconBack;
if(!item.getValueByName (IconBack, "3d.icon background")) if(!item.getValueByName (IconBack, "3d.icon background"))
debug("key '3d.icon background' not found."); debug("key '3d.icon background' not found.");
IconBack = strlwr (IconBack); IconBack = toLower(IconBack);
IdIconBack = ClientSheetsStrings.add(IconBack); IdIconBack = ClientSheetsStrings.add(IconBack);
// Get the icon associated. // Get the icon associated.
string IconOver; string IconOver;
if(!item.getValueByName (IconOver, "3d.icon overlay")) if(!item.getValueByName (IconOver, "3d.icon overlay"))
debug("key '3d.icon overlay' not found."); debug("key '3d.icon overlay' not found.");
IconOver = strlwr (IconOver); IconOver = toLower(IconOver);
IdIconOver = ClientSheetsStrings.add(IconOver); IdIconOver = ClientSheetsStrings.add(IconOver);
// Get the icon associated. // Get the icon associated.
string IconOver2; string IconOver2;
if(!item.getValueByName (IconOver2, "3d.icon overlay2")) if(!item.getValueByName (IconOver2, "3d.icon overlay2"))
debug("key '3d.icon overlay2' not found."); debug("key '3d.icon overlay2' not found.");
IconOver2 = strlwr (IconOver2); IconOver2 = toLower(IconOver2);
IdIconOver2 = ClientSheetsStrings.add(IconOver2); IdIconOver2 = ClientSheetsStrings.add(IconOver2);
// Get Special modulate colors // Get Special modulate colors
@ -211,7 +211,7 @@ void CItemSheet::build(const NLGEORGES::UFormElm &item)
string IconText; string IconText;
if(!item.getValueByName (IconText, "3d.text overlay")) if(!item.getValueByName (IconText, "3d.text overlay"))
debug("key '3d.text overlay' not found."); debug("key '3d.text overlay' not found.");
IconText = strlwr (IconText); IconText = toLower(IconText);
IdIconText = ClientSheetsStrings.add(IconText); IdIconText = ClientSheetsStrings.add(IconText);
// See if this item can be hiden when equipped // See if this item can be hiden when equipped
@ -303,7 +303,7 @@ void CItemSheet::build(const NLGEORGES::UFormElm &item)
debug("key '3d.anim_set' not found."); debug("key '3d.anim_set' not found.");
// Force the CASE in UPPER to not be CASE SENSITIVE. // Force the CASE in UPPER to not be CASE SENSITIVE.
else else
NLMISC::strlwr(AnimSet); AnimSet = NLMISC::toLower(AnimSet);
IdAnimSet = ClientSheetsStrings.add(AnimSet); IdAnimSet = ClientSheetsStrings.add(AnimSet);
// Get the Trail Shape // Get the Trail Shape
@ -318,28 +318,28 @@ void CItemSheet::build(const NLGEORGES::UFormElm &item)
string Effect1; string Effect1;
if(!item.getValueByName(Effect1, "Effects.Effect1")) if(!item.getValueByName(Effect1, "Effects.Effect1"))
debug("key 'Effects.Effect1' not found."); debug("key 'Effects.Effect1' not found.");
Effect1 = strlwr(Effect1); Effect1 = toLower(Effect1);
IdEffect1 = ClientSheetsStrings.add(Effect1); IdEffect1 = ClientSheetsStrings.add(Effect1);
// Get special Effect2 // Get special Effect2
string Effect2; string Effect2;
if(!item.getValueByName(Effect2, "Effects.Effect2")) if(!item.getValueByName(Effect2, "Effects.Effect2"))
debug("key 'Effects.Effect2' not found."); debug("key 'Effects.Effect2' not found.");
Effect2 = strlwr(Effect2); Effect2 = toLower(Effect2);
IdEffect2 = ClientSheetsStrings.add(Effect2); IdEffect2 = ClientSheetsStrings.add(Effect2);
// Get special Effect3 // Get special Effect3
string Effect3; string Effect3;
if(!item.getValueByName(Effect3, "Effects.Effect3")) if(!item.getValueByName(Effect3, "Effects.Effect3"))
debug("key 'Effects.Effect3' not found."); debug("key 'Effects.Effect3' not found.");
Effect3 = strlwr(Effect3); Effect3 = toLower(Effect3);
IdEffect3 = ClientSheetsStrings.add(Effect3); IdEffect3 = ClientSheetsStrings.add(Effect3);
// Get special Effect4 // Get special Effect4
string Effect4; string Effect4;
if(!item.getValueByName(Effect4, "Effects.Effect4")) if(!item.getValueByName(Effect4, "Effects.Effect4"))
debug("key 'Effects.Effect4' not found."); debug("key 'Effects.Effect4' not found.");
Effect4 = strlwr(Effect4); Effect4 = toLower(Effect4);
IdEffect4 = ClientSheetsStrings.add(Effect4); IdEffect4 = ClientSheetsStrings.add(Effect4);
// Get its bulk // Get its bulk

View file

@ -110,28 +110,28 @@ void COutpostBuildingSheet::build(const NLGEORGES::UFormElm &root)
string IconMain; string IconMain;
if(!root.getValueByName (IconMain, "icon")) if(!root.getValueByName (IconMain, "icon"))
debug("key 'icon' not found."); debug("key 'icon' not found.");
IconMain = strlwr (IconMain); IconMain = toLower(IconMain);
IdIconMain = ClientSheetsStrings.add(IconMain); IdIconMain = ClientSheetsStrings.add(IconMain);
// Get the icon associated. // Get the icon associated.
string IconBack; string IconBack;
if(!root.getValueByName (IconBack, "icon background")) if(!root.getValueByName (IconBack, "icon background"))
debug("key 'icon background' not found."); debug("key 'icon background' not found.");
IconBack = strlwr (IconBack); IconBack = toLower(IconBack);
IdIconBack = ClientSheetsStrings.add(IconBack); IdIconBack = ClientSheetsStrings.add(IconBack);
// Get the icon associated. // Get the icon associated.
string IconOver; string IconOver;
if(!root.getValueByName (IconOver, "icon overlay")) if(!root.getValueByName (IconOver, "icon overlay"))
debug("key 'icon overlay' not found."); debug("key 'icon overlay' not found.");
IconOver = strlwr (IconOver); IconOver = toLower(IconOver);
IdIconOver = ClientSheetsStrings.add(IconOver); IdIconOver = ClientSheetsStrings.add(IconOver);
// Get the icon text associated. // Get the icon text associated.
string IconText; string IconText;
if(!root.getValueByName (IconText, "text overlay")) if(!root.getValueByName (IconText, "text overlay"))
debug("key 'text overlay' not found."); debug("key 'text overlay' not found.");
IconText = strlwr (IconText); IconText = toLower(IconText);
IdIconText = ClientSheetsStrings.add(IconText); IdIconText = ClientSheetsStrings.add(IconText);
} }

View file

@ -74,7 +74,7 @@ void CPlayerSheet::build(const NLGEORGES::UFormElm &item)
debug("Key 'AnimSetBaseName' not found."); debug("Key 'AnimSetBaseName' not found.");
// Force the CASE in UPPER to not be CASE SENSITIVE. // Force the CASE in UPPER to not be CASE SENSITIVE.
else else
NLMISC::strlwr(AnimSetBaseName); AnimSetBaseName = NLMISC::toLower(AnimSetBaseName);
// Load Lod character name // Load Lod character name
if(!item.getValueByName(LodCharacterName, "LodCharacterName")) if(!item.getValueByName(LodCharacterName, "LodCharacterName"))
@ -240,7 +240,7 @@ void CPlayerSheet::CEquipment::build(const std::string &key,const NLGEORGES::UFo
if(!item.getValueByName(itemName, string(key + ".Item").c_str() )) if(!item.getValueByName(itemName, string(key + ".Item").c_str() ))
debug(NLMISC::toString("Key '%s.Item' not found.", key.c_str())); debug(NLMISC::toString("Key '%s.Item' not found.", key.c_str()));
else else
Item = NLMISC::strlwr(itemName); Item = NLMISC::toLower(itemName);
// Get the color. // Get the color.
if(!item.getValueByName(Color, string(key + ".Color").c_str() )) if(!item.getValueByName(Color, string(key + ".Color").c_str() ))

View file

@ -113,22 +113,22 @@ void CSBrickSheet::build (const NLGEORGES::UFormElm &root)
// read icons // read icons
string Icon; string Icon;
root.getValueByName (Icon, "Client.Icon" ); root.getValueByName (Icon, "Client.Icon" );
Icon = strlwr(Icon); Icon = toLower(Icon);
IdIcon = ClientSheetsStrings.add(Icon); IdIcon = ClientSheetsStrings.add(Icon);
string IconBack; string IconBack;
root.getValueByName (IconBack, "Client.IconBack" ); root.getValueByName (IconBack, "Client.IconBack" );
IconBack = strlwr(IconBack); IconBack = toLower(IconBack);
IdIconBack = ClientSheetsStrings.add(IconBack); IdIconBack = ClientSheetsStrings.add(IconBack);
string IconOver; string IconOver;
root.getValueByName (IconOver, "Client.IconOver" ); root.getValueByName (IconOver, "Client.IconOver" );
IconOver = strlwr(IconOver); IconOver = toLower(IconOver);
IdIconOver = ClientSheetsStrings.add(IconOver); IdIconOver = ClientSheetsStrings.add(IconOver);
string IconOver2; string IconOver2;
root.getValueByName (IconOver2, "Client.IconOver2" ); root.getValueByName (IconOver2, "Client.IconOver2" );
IconOver2 = strlwr(IconOver2); IconOver2 = toLower(IconOver2);
IdIconOver2 = ClientSheetsStrings.add(IconOver2); IdIconOver2 = ClientSheetsStrings.add(IconOver2);
root.getValueByName (IconColor, "Client.IconColor" ); root.getValueByName (IconColor, "Client.IconColor" );
@ -381,8 +381,7 @@ void CSBrickSheet::build (const NLGEORGES::UFormElm &root)
for(i=0;i<listBrick.size();i++) for(i=0;i<listBrick.size();i++)
{ {
CSheetId sheetId; CSheetId sheetId;
string str= listBrick[i]; string str= toLower(listBrick[i]);
strlwr(str);
if(str.find(".sbrick")==string::npos) if(str.find(".sbrick")==string::npos)
str+= ".sbrick"; str+= ".sbrick";
sheetId.buildSheetId(str); sheetId.buildSheetId(str);

View file

@ -1326,7 +1326,7 @@ NLMISC_COMMAND(ah, "Launch an action handler", "<ActionHandler> <AHparam>")
if (args.size() == 0) if (args.size() == 0)
return false; return false;
if (!ClientCfg.AllowDebugLua && strlwr(args[0]) == "lua") if (!ClientCfg.AllowDebugLua && toLower(args[0]) == "lua")
{ {
return false; // not allowed!! return false; // not allowed!!
} }
@ -1883,7 +1883,7 @@ NLMISC_COMMAND(pos, "Change the position of the user (in local only)", "<x, y, (
if(args.size() == 1) if(args.size() == 1)
{ {
string dest = args[0]; string dest = args[0];
newPos = CTeleport::getPos(NLMISC::strlwr(dest)); newPos = CTeleport::getPos(NLMISC::toLower(dest));
if(newPos == CTeleport::Unknown) if(newPos == CTeleport::Unknown)
{ {
//here we try to teleport to a bot destination //here we try to teleport to a bot destination

View file

@ -3834,7 +3834,7 @@ void CSPhraseManager::computePhraseProgression()
pse.Text= STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedName(CSheetId(pse.ProgressInfo.SheetId)); pse.Text= STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedName(CSheetId(pse.ProgressInfo.SheetId));
// avoid mutliple sapce problem // avoid mutliple sapce problem
strFindReplace(pse.Text, " ", ""); strFindReplace(pse.Text, " ", "");
// replace each number with 001 format. strlwr // replace each number with 001 format. toLower
for(uint k=0;k<pse.Text.size();k++) for(uint k=0;k<pse.Text.size();k++)
{ {
if(pse.Text[k] < 256 && isalpha(pse.Text[k])) if(pse.Text[k] < 256 && isalpha(pse.Text[k]))

View file

@ -97,16 +97,14 @@ void CTeleport::load(const std::string &/* filename */)
string destName; string destName;
if(tpElmt->getValueByName(destName, "name")) if(tpElmt->getValueByName(destName, "name"))
{ {
// All in UPPER CASE to not be CASE SENSITIVE.
NLMISC::strlwr(destName);
// Get the position // Get the position
CVector pos; CVector pos;
if(tpElmt->getValueByName(pos.x, "position.X") if(tpElmt->getValueByName(pos.x, "position.X")
&& tpElmt->getValueByName(pos.y, "position.Y") && tpElmt->getValueByName(pos.y, "position.Y")
&& tpElmt->getValueByName(pos.z, "position.Z")) && tpElmt->getValueByName(pos.z, "position.Z"))
{ {
_Destinations.insert(make_pair(destName, pos)); // All in UPPER CASE to not be CASE SENSITIVE.
_Destinations.insert(make_pair(NLMISC::toLower(destName), pos));
} }
else else
nlwarning("CTeleport::load: Cannot find the one of the key 'position.X or Y or Z' for the element %d.", i); nlwarning("CTeleport::load: Cannot find the one of the key 'position.X or Y or Z' for the element %d.", i);