This commit is contained in:
vl 2010-05-17 15:27:56 +02:00
commit 6e0bb8765e
12 changed files with 44 additions and 43 deletions

View file

@ -11,8 +11,8 @@ using namespace NLMISC;
void explodeSubStrings(const std::string &str, vector<std::string> &strings, sint32 parenthesis=0)
{
const std::string separators("(),");
uint32 current=0;
uint32 nextCurrent=current;
string::size_type current=0;
string::size_type nextCurrent=current;
strings.clear();
nextCurrent=str.find_first_of(separators.c_str(), current);
@ -1060,7 +1060,7 @@ CFightScriptComp *CFightScriptCompReader::createScriptComp (const string &str) t
{
string scriptCompName;
{
const uint32 index=str.find_first_of("()", 0);
const string::size_type index=str.find_first_of("()", 0);
if (index==string::npos)
throw ReadFightActionException("ScriptComp Creation of :"+str+" Failed because of bad Syntax");
scriptCompName=str.substr(0,index);

View file

@ -35,8 +35,8 @@ void stripWhitespaces(std::string& str)
{
if(str.empty()) return;
int startIndex = str.find_first_not_of(" ");
int endIndex = str.find_last_not_of(" ");
string::size_type startIndex = str.find_first_not_of(" ");
string::size_type endIndex = str.find_last_not_of(" ");
std::string tmp = str;
str.erase();
@ -46,7 +46,7 @@ void stripWhitespaces(std::string& str)
std::string removeComment(const std::string &str)
{
uint newPos= str.find("//",0);
string::size_type newPos= str.find("//",0);
if (newPos != string::npos)
{

View file

@ -1117,7 +1117,7 @@ void CCompiler::dumpByteCode (const string &sourceCode, const string &fullName,
{
// Build a valid filename
string tmp = fullName;
int pos;
string::size_type pos;
while ((pos=tmp.find (':')) != string::npos)
tmp[pos] = '-';

View file

@ -1245,17 +1245,17 @@ NLMISC_COMMAND (createItemInBag, "Create an item and put it in the player bag",
}
// banners are the only items in game which use privilege
if( sheetName.find("banner") != -1 )
if( sheetName.find("banner") != string::npos )
{
CPlayer * player = PlayerManager.getPlayer( PlayerManager.getPlayerId(eid) );
// if (player != NULL && !player->havePriv(":DEV:") )
if (player != NULL && player->havePriv(BannerPriv) )
{
if( sheetName.find("_gu") != -1 && !player->havePriv(":G:") ) return false;
if( sheetName.find("_sgu") != -1 && !player->havePriv(":SG:") ) return false;
if( sheetName.find("_vgu") != -1 && !player->havePriv(":VG:") ) return false;
if( sheetName.find("_gm") != -1 && !player->havePriv(":GM:") ) return false;
if( sheetName.find("_sgm") != -1 && !player->havePriv(":SGM:") ) return false;
if( sheetName.find("_gu") != string::npos && !player->havePriv(":G:") ) return false;
if( sheetName.find("_sgu") != string::npos && !player->havePriv(":SG:") ) return false;
if( sheetName.find("_vgu") != string::npos && !player->havePriv(":VG:") ) return false;
if( sheetName.find("_gm") != string::npos && !player->havePriv(":GM:") ) return false;
if( sheetName.find("_sgm") != string::npos && !player->havePriv(":SGM:") ) return false;
}
}
@ -1333,16 +1333,16 @@ NLMISC_COMMAND (createItemInTmpInv, "Create an item and put it in the player tem
}
// banners are the only items in game which use privilege
if( sheetName.find("banner") != -1 )
if( sheetName.find("banner") != string::npos )
{
CPlayer * player = PlayerManager.getPlayer( PlayerManager.getPlayerId(eid) );
if (player != NULL && player->havePriv(BannerPriv) )
{
if( sheetName.find("_gu") != -1 && !player->havePriv(":G:") ) return false;
if( sheetName.find("_sgu") != -1 && !player->havePriv(":SG:") ) return false;
if( sheetName.find("_vgu") != -1 && !player->havePriv(":VG:") ) return false;
if( sheetName.find("_gm") != -1 && !player->havePriv(":GM:") ) return false;
if( sheetName.find("_sgm") != -1 && !player->havePriv(":SGM:") ) return false;
if( sheetName.find("_gu") != string::npos && !player->havePriv(":G:") ) return false;
if( sheetName.find("_sgu") != string::npos && !player->havePriv(":SG:") ) return false;
if( sheetName.find("_vgu") != string::npos && !player->havePriv(":VG:") ) return false;
if( sheetName.find("_gm") != string::npos && !player->havePriv(":GM:") ) return false;
if( sheetName.find("_sgm") != string::npos && !player->havePriv(":SGM:") ) return false;
}
}
@ -1403,16 +1403,16 @@ NLMISC_COMMAND (createItemInInv, "Create items and put them in the given invento
}
// banners are the only items in game which use privilege
if( sheetName.find("banner") != -1 )
if( sheetName.find("banner") != string::npos )
{
CPlayer * player = PlayerManager.getPlayer( PlayerManager.getPlayerId(eid) );
if (player != NULL && player->havePriv(BannerPriv) )
{
if( sheetName.find("_gu") != -1 && !player->havePriv(":G:") ) return false;
if( sheetName.find("_sgu") != -1 && !player->havePriv(":SG:") ) return false;
if( sheetName.find("_vgu") != -1 && !player->havePriv(":VG:") ) return false;
if( sheetName.find("_gm") != -1 && !player->havePriv(":GM:") ) return false;
if( sheetName.find("_sgm") != -1 && !player->havePriv(":SGM:") ) return false;
if( sheetName.find("_gu") != string::npos && !player->havePriv(":G:") ) return false;
if( sheetName.find("_sgu") != string::npos && !player->havePriv(":SG:") ) return false;
if( sheetName.find("_vgu") != string::npos && !player->havePriv(":VG:") ) return false;
if( sheetName.find("_gm") != string::npos && !player->havePriv(":GM:") ) return false;
if( sheetName.find("_sgm") != string::npos && !player->havePriv(":SGM:") ) return false;
}
}
@ -4039,12 +4039,12 @@ NLMISC_COMMAND(broadcast,"[repeat=<num repeat> or during=<time in seconds>] [eve
uint32 during = 0;
uint32 every = 0;
sint32 posMessage = 0;
string::size_type posMessage = 0;
sint32 pos = message.find("repeat");
string::size_type pos = message.find("repeat");
if( pos != string::npos )
{
sint32 posEgale = message.find("=", pos);
string::size_type posEgale = message.find("=", pos);
if( posEgale != string::npos )
{
repeat = atoi( message.substr( posEgale+1 ).c_str() );
@ -4056,7 +4056,7 @@ NLMISC_COMMAND(broadcast,"[repeat=<num repeat> or during=<time in seconds>] [eve
pos = message.find("during");
if( pos != string::npos )
{
sint32 posEgale = message.find("=", pos);
string::size_type posEgale = message.find("=", pos);
if( posEgale != string::npos )
{
during = atoi( message.substr( posEgale+1 ).c_str() );
@ -4068,7 +4068,7 @@ NLMISC_COMMAND(broadcast,"[repeat=<num repeat> or during=<time in seconds>] [eve
pos = message.find("every");
if( pos != string::npos )
{
sint32 posEgale = message.find("=", pos);
string::size_type posEgale = message.find("=", pos);
if( posEgale != string::npos )
{
every = atoi( message.substr( posEgale+1 ).c_str() );

View file

@ -335,7 +335,7 @@ void CStaticBrick::readStaticBrick( const NLGEORGES::UFormElm &root, const NLMIS
if(Family==BRICK_FAMILIES::Unknown)
{
string sheetName= sheetId.toString();
sint end= sheetName.find(".sbrick")-NB_LETTERS_AFTER_FAMILY;
string::size_type end= sheetName.find(".sbrick")-NB_LETTERS_AFTER_FAMILY;
string sub = sheetName.substr(0,end);
sub = strupr(sub);
Family = BRICK_FAMILIES::toSBrickFamily ( sub );

View file

@ -976,8 +976,8 @@ void loadCosmetics( NLGEORGES::UFormElm &root, CStaticItem *item, const NLMISC:
std::string name = sheetId.toString();
sint pos = (sint)name.find('.',0);
if ( pos == (sint) string::npos)
string::size_type pos = name.find('.',0);
if ( pos == string::npos)
nlwarning("<loadCosmetics> Can't load the VPValue from sheet name in sheet %s", sheetId.toString().c_str() );
else
{

View file

@ -119,7 +119,7 @@ void CAIAliasTranslator::buildBotTree(const NLLIGO::IPrimitive* prim)
NLMISC::strlwr(name);
//remove AI name parameters
uint trash = name.find('$');
string::size_type trash = name.find('$');
if ( trash != string::npos )
{
name.resize(trash);
@ -157,7 +157,7 @@ void CAIAliasTranslator::buildBotTree(const NLLIGO::IPrimitive* prim)
// NLMISC::strlwr(name);
//remove AI name parameters
// uint trash = name.find('$');
// string::size_type trash = name.find('$');
// if ( trash != string::npos )
// {
// name.resize(trash);

View file

@ -60,7 +60,7 @@ bool CMissionStepQueueStart::buildStep( uint32 line, const vector< string > & sc
QueueName = missionData.Name + "_" + script[1];
// remove all blanks in name
uint pos = QueueName.find_first_of(" ");
string::size_type pos = QueueName.find_first_of(" ");
while ( pos != string::npos )
{
QueueName.erase(pos,1);
@ -203,7 +203,7 @@ bool CMissionStepQueueEnd::buildStep( uint32 line, const vector< string > & scri
QueueName = missionData.Name + "_" + script[1];
// remove all blanks in name
uint pos = QueueName.find_first_of(" ");
string::size_type pos = QueueName.find_first_of(" ");
while ( pos != string::npos )
{
QueueName.erase(pos,1);

View file

@ -674,7 +674,7 @@ bool CMissionStepDynChat::buildStep( uint32 line, const std::vector< std::string
for (uint i = 3; i < script.size(); i++ )
{
string answerStr = CMissionParser::getNoBlankString( script[i] );
uint pos = answerStr.find( ' ' );
string::size_type pos = answerStr.find( ' ' );
if( pos == string::npos || answerStr.empty() )
{
MISLOGERROR1("invalid answer '%s'", answerStr.c_str());

View file

@ -598,7 +598,7 @@ void CPDSLib::update()
// setup update logs with full timestamp
if (!_DbMessageQueue.empty())
{
i = _UpdateLogs.size();
i = (uint)_UpdateLogs.size();
_UpdateLogs.resize(_DbMessageQueue.size());
for (; i<_UpdateLogs.size(); ++i)
@ -1025,7 +1025,7 @@ std::string CPDSLib::getPDSRootDirectory(const std::string& shard, bool wantRemo
}
std::string findstr("$shard");
uint p = dir.find(findstr);
std::string::size_type p = dir.find(findstr);
if (p != std::string::npos)
dir.replace(p, findstr.size(), shard);

View file

@ -605,7 +605,7 @@ bool CUpdateLog::selectMessages(const CDBDescriptionParser& description, const N
{
bool selected = false;
uint pos = valuePath.find('.');
std::string::size_type pos = valuePath.find('.');
if (pos == std::string::npos)
return false;

View file

@ -571,7 +571,8 @@ bool CDbManager::parsePath(const string &strPath, CLocatePath &lpath)
anode.Set = false;
anode.Array = false;
uint pos = node.find_first_of("[<");
string::size_type pos = node.find_first_of("[<");
if (pos != string::npos)
{
if (node[pos] == '[')
@ -581,7 +582,7 @@ bool CDbManager::parsePath(const string &strPath, CLocatePath &lpath)
anode.Name = node.substr(0, pos);
uint end = node.find((anode.Array ? ']' : '>'), pos);
string::size_type end = node.find((anode.Array ? ']' : '>'), pos);
if (end == string::npos)
return false;