diff --git a/AMBuildScript b/AMBuildScript index 580b0807..d2b99d54 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -249,7 +249,7 @@ class SMConfig(object): if cxx.like('gcc'): cxx.cflags += ['-O3'] elif cxx.like('msvc'): - cxx.cflags += ['/Ox'] + cxx.cflags += ['/Ox', '/Zo'] cxx.linkflags += ['/OPT:ICF', '/OPT:REF'] # Debugging @@ -257,8 +257,6 @@ class SMConfig(object): cxx.defines += ['DEBUG', '_DEBUG'] if cxx.like('msvc'): cxx.cflags += ['/Od', '/RTC1'] - if cxx.version >= 1600: - cxx.cflags += ['/d2Zi+'] # This needs to be after our optimization flags which could otherwise disable it. if cxx.vendor == 'msvc': diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index 9d9e0a4b..0978eb90 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -405,7 +405,7 @@ void PlayerManager::RunAuthChecks() pPlayer = &m_Players[m_AuthQueue[i]]; pPlayer->UpdateAuthIds(); - authstr = pPlayer->m_AuthID.c_str(); + authstr = pPlayer->m_AuthID.chars(); if (!pPlayer->IsAuthStringValidated()) { @@ -717,14 +717,14 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++) { pListener = (*iter); - pListener->OnClientAuthorized(client, steamId ? steamId : pPlayer->m_AuthID.c_str()); + pListener->OnClientAuthorized(client, steamId ? steamId : pPlayer->m_AuthID.chars()); } /* Finally, tell plugins */ if (m_clauth->GetFunctionCount()) { m_clauth->PushCell(client); /* For legacy reasons, people are expecting the Steam2 id here if using Steam auth */ - m_clauth->PushString(steamId ? steamId : pPlayer->m_AuthID.c_str()); + m_clauth->PushString(steamId ? steamId : pPlayer->m_AuthID.chars()); m_clauth->Execute(NULL); } pPlayer->Authorize_Post(); @@ -1963,6 +1963,8 @@ void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity) *ptr = '\0'; } m_IpNoPort.assign(ip2); + + UpdateAuthIds(); } void CPlayer::Connect() @@ -2001,7 +2003,12 @@ void CPlayer::UpdateAuthIds() #else authstr = engine->GetPlayerNetworkIDString(m_pEdict); #endif - m_AuthID.assign(authstr); + if (m_AuthID.compare(authstr) == 0) + { + return; + } + + m_AuthID = authstr; // Then, cache SteamId if (IsFakeClient()) @@ -2097,7 +2104,7 @@ void CPlayer::Disconnect() m_IsAuthorized = false; m_Name.clear(); m_Ip.clear(); - m_AuthID.clear(); + m_AuthID = ""; m_SteamId = k_steamIDNil; m_Steam2Id = ""; m_Steam3Id = ""; @@ -2142,7 +2149,7 @@ const char *CPlayer::GetAuthString(bool validated) return NULL; } - return m_AuthID.c_str(); + return m_AuthID.chars(); } const CSteamID &CPlayer::GetSteamId(bool validated) @@ -2451,7 +2458,7 @@ void CPlayer::DoBasicAdminChecks() } /* Check steam id */ - if ((id = adminsys->FindAdminByIdentity("steam", m_AuthID.c_str())) != INVALID_ADMIN_ID) + if ((id = adminsys->FindAdminByIdentity("steam", m_AuthID.chars())) != INVALID_ADMIN_ID) { if (g_Players.CheckSetAdmin(client, this, id)) { diff --git a/core/PlayerManager.h b/core/PlayerManager.h index 22ca01fc..3f78c9f8 100644 --- a/core/PlayerManager.h +++ b/core/PlayerManager.h @@ -123,7 +123,7 @@ private: String m_Name; String m_Ip; String m_IpNoPort; - String m_AuthID; + ke::AString m_AuthID; ke::AString m_Steam2Id; ke::AString m_Steam3Id; AdminId m_Admin; diff --git a/plugins/include/menus.inc b/plugins/include/menus.inc index 22ba0a09..c85b07f2 100644 --- a/plugins/include/menus.inc +++ b/plugins/include/menus.inc @@ -810,14 +810,28 @@ stock bool VoteMenuToAll(Handle menu, int time, int flags=0) * @param item_info Array of items, sorted by count. Use VOTEINFO_ITEM * defines. */ -typedef VoteHandler = function void ( - Menu menu, - int num_votes, - int num_clients, - const int client_info[][2], - int num_items, - const int item_info[][2] -); +typeset VoteHandler +{ + // old style + function void( + Menu menu, + int num_votes, + int num_clients, + const int client_info[][2], + int num_items, + const int item_info[][2] + ); + + // new style + function void( + Menu menu, + int num_votes, + int num_clients, + const int[][] client_info, + int num_items, + const int[][] item_info + ); +}; /** * Sets an advanced vote handling callback. If this callback is set, diff --git a/plugins/include/version.inc b/plugins/include/version.inc index 7a9d876c..8519560a 100644 --- a/plugins/include/version.inc +++ b/plugins/include/version.inc @@ -42,8 +42,8 @@ #define SOURCEMOD_V_REV 0 #define SOURCEMOD_V_CSET "0" #define SOURCEMOD_V_MAJOR 1 /**< SourceMod Major version */ -#define SOURCEMOD_V_MINOR 7 /**< SourceMod Minor version */ +#define SOURCEMOD_V_MINOR 8 /**< SourceMod Minor version */ #define SOURCEMOD_V_RELEASE 0 /**< SourceMod Release version */ -#define SOURCEMOD_VERSION "1.7.0-manual" /**< SourceMod version string (major.minor.release-tag) */ +#define SOURCEMOD_VERSION "1.8.0-manual" /**< SourceMod version string (major.minor.release-tag) */ #endif diff --git a/product.version b/product.version index de023c91..0ef074f2 100644 --- a/product.version +++ b/product.version @@ -1 +1 @@ -1.7.0-dev +1.8.0-dev diff --git a/public/sourcemod_version.h b/public/sourcemod_version.h index caa88ea3..bb30ee2d 100644 --- a/public/sourcemod_version.h +++ b/public/sourcemod_version.h @@ -52,13 +52,13 @@ #define SM_BUILD_LOCAL_REV "0" #define SM_BUILD_CSET "0" #define SM_BUILD_MAJOR "1" -#define SM_BUILD_MINOR "7" +#define SM_BUILD_MINOR "8" #define SM_BUILD_RELEASE "0" #define SM_BUILD_UNIQUEID SM_BUILD_LOCAL_REV ":" SM_BUILD_CSET #define SM_VERSION_STRING SM_BUILD_MAJOR "." SM_BUILD_MINOR "." SM_BUILD_RELEASE "-" SM_BUILD_TAG -#define SM_VERSION_FILE 1,7,0,0 +#define SM_VERSION_FILE 1,8,0,0 #endif #define SM_BUILD_TIMESTAMP __DATE__ " " __TIME__ diff --git a/pushbuild.txt b/pushbuild.txt index 0ffb229f..511bdab8 100644 --- a/pushbuild.txt +++ b/pushbuild.txt @@ -3,7 +3,7 @@ joys of buildbot, part 2: buildbot and the very lonely square-shaped duck joys of buildbot, part 3: an accidental event proves troublesome for a psychic fish joys of buildbot, part 4: a transient mummy is perplexed by a broken wand buildbot has horrible blugs -i am the very model of a modern major general +I am the very model of a modern major general It's no wonder the build always falls over when we call it pushing. h i diff --git a/sourcepawn/compiler/sc3.cpp b/sourcepawn/compiler/sc3.cpp index 7b5e6d00..d247978e 100644 --- a/sourcepawn/compiler/sc3.cpp +++ b/sourcepawn/compiler/sc3.cpp @@ -334,7 +334,7 @@ const char *type_to_name(int tag) const char *name = pc_tagname(tag); if (name) - return "unknown"; + return name; if (tag & FUNCTAG) return "function"; @@ -1698,6 +1698,10 @@ static int hier2(value *lval) } case tLABEL: /* tagname override */ tag=pc_addtag(st); + if (sc_require_newdecls) { + // Warn: old style cast used when newdecls pragma is enabled + error(240, st, type_to_name(tag)); + } lval->cmptag=tag; lvalue=hier2(lval); if ((lval->tag & OBJECTTAG) || (tag & OBJECTTAG)) { diff --git a/sourcepawn/compiler/sc5-in.scp b/sourcepawn/compiler/sc5-in.scp index 064ffd4b..0c8d1528 100644 --- a/sourcepawn/compiler/sc5-in.scp +++ b/sourcepawn/compiler/sc5-in.scp @@ -462,6 +462,7 @@ static const char *warnmsg[] = { /*237*/ "coercing functions to and from primitives is unsupported and will be removed in the future\n", /*238*/ "'%s:' is an illegal cast; use view_as<%s>(expression)\n", /*239*/ "'%s' is an illegal tag; use %s as a type\n", +/*240*/ "'%s:' is an old-style tag operation; use view_as<%s>(expression) instead\n", #else "\327 \275tr\242\231\227\266 %\204\305\206a\306\210\260", "\214\343i\215 \330\371\213t/\321cro \365", diff --git a/sourcepawn/compiler/tests/warn-oldstyle-cast.sp b/sourcepawn/compiler/tests/warn-oldstyle-cast.sp new file mode 100644 index 00000000..5f6c899c --- /dev/null +++ b/sourcepawn/compiler/tests/warn-oldstyle-cast.sp @@ -0,0 +1,18 @@ + +#pragma newdecls required + +enum MyType:{}; + +native void Print(MyType value); +native void PrintF(float value); + +public void main() +{ + int val = 2; + MyType otherVal = MyType:val; + + float value2 = Float:val; + + Print(otherVal); + PrintF(value2); +} diff --git a/sourcepawn/compiler/tests/warn-oldstyle-cast.txt b/sourcepawn/compiler/tests/warn-oldstyle-cast.txt new file mode 100644 index 00000000..21696a51 --- /dev/null +++ b/sourcepawn/compiler/tests/warn-oldstyle-cast.txt @@ -0,0 +1,2 @@ +(12) : warning 240: 'MyType:' is an old-style tag operation; use view_as(expression) instead +(14) : warning 240: 'Float:' is an old-style tag operation; use view_as(expression) instead