Changed: Replaced substr == by compare, because more optimized (thanks to Kaetemi for the hint!)

This commit is contained in:
kervala 2016-01-01 16:26:12 +01:00
parent da117cb631
commit 7e116c2738
2 changed files with 5 additions and 5 deletions

View file

@ -104,7 +104,7 @@ uint32 IMissionStepTemplate::sendRpStepText(CCharacter * user,const std::vector<
_User = user; _User = user;
if (_RoleplayText.substr(0, 6) == "WEBIG_") if (_RoleplayText.compare(0, 6, "WEBIG_") == 0)
{ {
TVectorParamCheck params; TVectorParamCheck params;
string name = _RoleplayText; string name = _RoleplayText;
@ -174,7 +174,7 @@ uint32 IMissionStepTemplate::sendStepText(CCharacter * user,const std::vector<ui
// If the text is overriden, add the overide parameters // If the text is overriden, add the overide parameters
if ( !_OverridenText.empty() ) if ( !_OverridenText.empty() )
{ {
if (_OverridenText.substr(0, 6) == "WEBIG_") if (_OverridenText.compare(0, 6, "WEBIG_") == 0)
{ {
string text = _OverridenText; string text = _OverridenText;
if (user) if (user)

View file

@ -2441,7 +2441,7 @@ uint32 CMissionTemplate::testPrerequisits( CCharacter * user, CPrerequisitInfos
uint32 CMissionTemplate::sendTitleText( const TDataSetRow & userRow, const TDataSetRow & giver ) const uint32 CMissionTemplate::sendTitleText( const TDataSetRow & userRow, const TDataSetRow & giver ) const
{ {
if (TitleText.substr(0, 6) == "WEBIG_") if (TitleText.compare(0, 6, "WEBIG_") == 0)
{ {
string text = TitleText; string text = TitleText;
CCharacter *user = PlayerManager.getChar(getEntityIdFromRow(userRow)); CCharacter *user = PlayerManager.getChar(getEntityIdFromRow(userRow));
@ -2469,7 +2469,7 @@ uint32 CMissionTemplate::sendTitleText( const TDataSetRow & userRow, const TData
uint32 CMissionTemplate::sendAutoText( const TDataSetRow & userRow,const NLMISC::CEntityId & giver) const uint32 CMissionTemplate::sendAutoText( const TDataSetRow & userRow,const NLMISC::CEntityId & giver) const
{ {
if (AutoText.substr(0, 6) == "WEBIG_") if (AutoText.compare(0, 6, "WEBIG_") == 0)
{ {
string text = AutoText; string text = AutoText;
CCharacter *user = PlayerManager.getChar(getEntityIdFromRow(userRow)); CCharacter *user = PlayerManager.getChar(getEntityIdFromRow(userRow));
@ -2494,7 +2494,7 @@ uint32 CMissionTemplate::sendAutoText( const TDataSetRow & userRow,const NLMISC:
uint32 CMissionTemplate::sendDescText( const TDataSetRow & userRow, const TDataSetRow & giver, uint32 descIndex) const uint32 CMissionTemplate::sendDescText( const TDataSetRow & userRow, const TDataSetRow & giver, uint32 descIndex) const
{ {
if (DescText.substr(0, 6) == "WEBIG_") if (DescText.compare(0, 6, "WEBIG_") == 0)
{ {
string text = DescText; string text = DescText;
CCharacter *user = PlayerManager.getChar(getEntityIdFromRow(userRow)); CCharacter *user = PlayerManager.getChar(getEntityIdFromRow(userRow));