From bb49f0e021fb1fbefad44d944233fb1cf72c495c Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Wed, 1 Feb 2012 09:12:54 +0000 Subject: Introducing StringUtils - the place to be if you are a generic string routine :) No more sprintf()! git-svn-id: http://mc-server.googlecode.com/svn/trunk@209 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cPlayer.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'source/cPlayer.cpp') diff --git a/source/cPlayer.cpp b/source/cPlayer.cpp index 23c43ae25..0dd5695a4 100644 --- a/source/cPlayer.cpp +++ b/source/cPlayer.cpp @@ -43,13 +43,11 @@ #include "../iniFile/iniFile.h" #include -#ifndef _WIN32 // for mkdir -#include -#include -#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ ) -#endif #define float2int(x) ((x)<0 ? ((int)(x))-1 : (int)(x)) -extern std::vector< std::string > StringSplit( std::string str, std::string delim); + + + + CLASS_DEFINITION( cPlayer, cPawn ); @@ -557,9 +555,13 @@ bool cPlayer::CanUseCommand( const char* a_Command ) return false; } + + + + bool cPlayer::HasPermission( const char* a_Permission ) { - std::vector< std::string > Split = StringSplit( a_Permission, "." ); + AStringVector Split = StringSplit( a_Permission, "." ); PermissionMap Possibilities = m_pState->ResolvedPermissions; // Now search the namespaces while( Possibilities.begin() != Possibilities.end() ) @@ -567,7 +569,7 @@ bool cPlayer::HasPermission( const char* a_Permission ) PermissionMap::iterator itr = Possibilities.begin(); if( itr->second ) { - std::vector< std::string > OtherSplit = StringSplit( itr->first, "." ); + AStringVector OtherSplit = StringSplit( itr->first, "." ); if( OtherSplit.size() <= Split.size() ) { unsigned int i; @@ -589,6 +591,10 @@ bool cPlayer::HasPermission( const char* a_Permission ) return false; } + + + + bool cPlayer::IsInGroup( const char* a_Group ) { for( GroupList::iterator itr = m_pState->ResolvedGroups.begin(); itr != m_pState->ResolvedGroups.end(); ++itr ) @@ -743,7 +749,7 @@ void cPlayer::LoadPermissionsFromDisk() std::string Groups = IniFile.GetValue(m_pState->PlayerName, "Groups", ""); if( Groups.size() > 0 ) { - std::vector< std::string > Split = StringSplit( Groups, "," ); + AStringVector Split = StringSplit( Groups, "," ); for( unsigned int i = 0; i < Split.size(); i++ ) { AddToGroup( Split[i].c_str() ); -- cgit v1.2.3