From c8d69c41bcf961b528d1b5938d158b2b244dadad Mon Sep 17 00:00:00 2001 From: Pavol Marko Date: Tue, 18 Oct 2005 21:05:52 +0000 Subject: [PATCH] Hello quickfix 64bit negative values to executeForwards -> now upcasting everything 32bit to cell before passing to executeForwards --- amxmodx/CEvent.cpp | 2 +- amxmodx/CTask.cpp | 4 ++-- amxmodx/CTask.h | 8 ++++---- amxmodx/meta_api.cpp | 40 +++++++++++++++++++++++----------------- amxmodx/newmenus.cpp | 2 +- amxmodx/srvcmd.cpp | 3 ++- 6 files changed, 33 insertions(+), 26 deletions(-) diff --git a/amxmodx/CEvent.cpp b/amxmodx/CEvent.cpp index 9093d34a..f34909c2 100755 --- a/amxmodx/CEvent.cpp +++ b/amxmodx/CEvent.cpp @@ -425,7 +425,7 @@ void EventsMngr::executeEvents() } (*iter).m_Stamp = (float)*m_Timer; - executeForwards((*iter).m_Func, m_ParseVault ? m_ParseVault[0].iValue : 0); + executeForwards((*iter).m_Func, static_cast(m_ParseVault ? m_ParseVault[0].iValue : 0)); } m_CurrentMsgType = -1; diff --git a/amxmodx/CTask.cpp b/amxmodx/CTask.cpp index b4e47c3c..2cd33de9 100755 --- a/amxmodx/CTask.cpp +++ b/amxmodx/CTask.cpp @@ -44,7 +44,7 @@ CPluginMngr::CPlugin *CTaskMngr::CTask::getPlugin() const return m_pPlugin; } -void CTaskMngr::CTask::set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat, float fCurrentTime) +void CTaskMngr::CTask::set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, cell iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat, float fCurrentTime) { clear(); m_bFree = false; @@ -226,7 +226,7 @@ void CTaskMngr::registerTimers(float *pCurrentTime, float *pTimeLimit, float *pT m_pTmr_TimeLeft = pTimeLeft; } -void CTaskMngr::registerTask(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat) +void CTaskMngr::registerTask(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, cell iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat) { // first, search for free tasks TaskListIter iter = m_Tasks.find(CTaskDescriptor(0, NULL, true)); diff --git a/amxmodx/CTask.h b/amxmodx/CTask.h index ebe1dc48..223d42f1 100755 --- a/amxmodx/CTask.h +++ b/amxmodx/CTask.h @@ -41,7 +41,7 @@ private: // task settings CPluginMngr::CPlugin *m_pPlugin; - int m_iId; + cell m_iId; int m_iFunc; int m_iRepeat; @@ -57,7 +57,7 @@ private: // execution float m_fNextExecTime; public: - void set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat, float fCurrentTime); + void set(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, cell iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat, float fCurrentTime); void clear(); bool isFree() const; @@ -78,7 +78,7 @@ private: class CTaskDescriptor { public: - int m_iId; + cell m_iId; AMX *m_pAmx; bool m_bFree; @@ -112,7 +112,7 @@ public: ~CTaskMngr(); void registerTimers(float *pCurrentTime, float *pTimeLimit, float *pTimeLeft); // The timers will always point to the right value - void registerTask(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, int iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat); + void registerTask(CPluginMngr::CPlugin *pPlugin, int iFunc, int iFlags, cell iId, float fBase, int iParamsLen, const cell *pParams, int iRepeat); int removeTasks(int iId, AMX *pAmx); // remove all tasks that match the id and amx int changeTasks(int iId, AMX *pAmx, float fNewBase); // change all tasks that match the id and amx diff --git a/amxmodx/meta_api.cpp b/amxmodx/meta_api.cpp index 213008d9..8a36a1e4 100755 --- a/amxmodx/meta_api.cpp +++ b/amxmodx/meta_api.cpp @@ -200,7 +200,8 @@ int C_InconsistentFile(const edict_t *player, const char *filename, char *discon { CPlayer *pPlayer = GET_PLAYER_POINTER((edict_t *)player); - if (executeForwards(FF_InconsistentFile, pPlayer->index, filename, disconnect_message) == 1) + if (executeForwards(FF_InconsistentFile, static_cast(pPlayer->index), + filename, disconnect_message) == 1) RETURN_META_VALUE(MRES_SUPERCEDE, FALSE); RETURN_META_VALUE(MRES_SUPERCEDE, TRUE); @@ -462,7 +463,7 @@ void C_ServerDeactivate() { CPlayer *pPlayer = GET_PLAYER_POINTER_I(i); if (pPlayer->initialized) - executeForwards(FF_ClientDisconnect, pPlayer->index); + executeForwards(FF_ClientDisconnect, static_cast(pPlayer->index)); if (pPlayer->ingame) { @@ -573,7 +574,7 @@ BOOL C_ClientConnect_Post(edict_t *pEntity, const char *pszName, const char *psz if (!pPlayer->bot) { bool a = pPlayer->Connect(pszName, pszAddress); - executeForwards(FF_ClientConnect, pPlayer->index); + executeForwards(FF_ClientConnect, static_cast(pPlayer->index)); if (a) { @@ -582,7 +583,7 @@ BOOL C_ClientConnect_Post(edict_t *pEntity, const char *pszName, const char *psz g_auth.put(aa); } else { pPlayer->Authorize(); - executeForwards(FF_ClientAuthorized, pPlayer->index); + executeForwards(FF_ClientAuthorized, static_cast(pPlayer->index)); } } @@ -593,7 +594,7 @@ void C_ClientDisconnect(edict_t *pEntity) { CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); if (pPlayer->initialized) - executeForwards(FF_ClientDisconnect, pPlayer->index); + executeForwards(FF_ClientDisconnect, static_cast(pPlayer->index)); if (pPlayer->ingame) { @@ -611,7 +612,7 @@ void C_ClientPutInServer_Post(edict_t *pEntity) { pPlayer->PutInServer(); ++g_players_num; - executeForwards(FF_ClientPutInServer, pPlayer->index); + executeForwards(FF_ClientPutInServer, static_cast(pPlayer->index)); } RETURN_META(MRES_IGNORED); @@ -620,7 +621,7 @@ void C_ClientPutInServer_Post(edict_t *pEntity) void C_ClientUserInfoChanged_Post(edict_t *pEntity, char *infobuffer) { CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); - executeForwards(FF_ClientInfoChanged, pPlayer->index); + executeForwards(FF_ClientInfoChanged, static_cast(pPlayer->index)); const char* name = INFOKEY_VALUE(infobuffer, "name"); // Emulate bot connection and putinserver @@ -632,15 +633,15 @@ void C_ClientUserInfoChanged_Post(edict_t *pEntity, char *infobuffer) { pPlayer->Connect(name, "127.0.0.1"/*CVAR_GET_STRING("net_address")*/); - executeForwards(FF_ClientConnect, pPlayer->index); + executeForwards(FF_ClientConnect, static_cast(pPlayer->index)); pPlayer->Authorize(); - executeForwards(FF_ClientAuthorized, pPlayer->index); + executeForwards(FF_ClientAuthorized, static_cast(pPlayer->index)); pPlayer->PutInServer(); ++g_players_num; - executeForwards(FF_ClientPutInServer, pPlayer->index); + executeForwards(FF_ClientPutInServer, static_cast(pPlayer->index)); } RETURN_META(MRES_IGNORED); @@ -684,7 +685,7 @@ void C_ClientCommand(edict_t *pEntity) } } - if (executeForwards(FF_ClientCommand, pPlayer->index) > 0) + if (executeForwards(FF_ClientCommand, static_cast(pPlayer->index)) > 0) RETURN_META(MRES_SUPERCEDE); /* check for command and if needed also for first argument and call proper function */ @@ -698,7 +699,8 @@ void C_ClientCommand(edict_t *pEntity) { if ((*aa).matchCommandLine(cmd, arg) && (*aa).getPlugin()->isExecutable((*aa).getFunction())) { - ret = executeForwards((*aa).getFunction(), pPlayer->index, (*aa).getFlags(), (*aa).getId()); + ret = executeForwards((*aa).getFunction(), static_cast(pPlayer->index), + static_cast((*aa).getFlags()), static_cast((*aa).getId())); if (ret & 2) result = MRES_SUPERCEDE; if (ret & 1) RETURN_META(MRES_SUPERCEDE); } @@ -732,7 +734,8 @@ void C_ClientCommand(edict_t *pEntity) { Menu *pMenu = g_NewMenus[menu]; int item = pMenu->PagekeyToItem(pPlayer->page, pressed_key); - ret = executeForwards((*a).getFunction(), pPlayer->index, menu, item); + ret = executeForwards((*a).getFunction(), static_cast(pPlayer->index), + static_cast(menu), static_cast(item)); if (ret & 2) result = MRES_SUPERCEDE; @@ -755,7 +758,8 @@ void C_ClientCommand(edict_t *pEntity) } } } else { - ret = executeForwards((*a).getFunction(), pPlayer->index, pressed_key, 0); + ret = executeForwards((*a).getFunction(), static_cast(pPlayer->index), + static_cast(pressed_key), 0); if (ret & 2) result = MRES_SUPERCEDE; if (ret & 1) RETURN_META(MRES_SUPERCEDE); @@ -790,7 +794,7 @@ void C_StartFrame_Post(void) if (strcmp(auth, "STEAM_ID_PENDING")) { (*a)->Authorize(); - executeForwards(FF_ClientAuthorized, (*a)->index); + executeForwards(FF_ClientAuthorized, static_cast((*a)->index)); a.remove(); continue; @@ -1108,10 +1112,12 @@ void C_CvarValue(const edict_t *pEdict, const char *value) if (pQuery->paramLen) { cell arr = prepareCellArray(pQuery->params, pQuery->paramLen); - executeForwards(pQuery->resultFwd, ENTINDEX(pEdict), pQuery->cvarName.c_str(), value, arr); + executeForwards(pQuery->resultFwd, static_cast(ENTINDEX(pEdict)), + pQuery->cvarName.c_str(), value, arr); } else - executeForwards(pQuery->resultFwd, ENTINDEX(pEdict), pQuery->cvarName.c_str(), value); + executeForwards(pQuery->resultFwd, static_cast(ENTINDEX(pEdict)), + pQuery->cvarName.c_str(), value); unregisterSPForward(pQuery->resultFwd); diff --git a/amxmodx/newmenus.cpp b/amxmodx/newmenus.cpp index 18918613..3940c188 100755 --- a/amxmodx/newmenus.cpp +++ b/amxmodx/newmenus.cpp @@ -219,7 +219,7 @@ const char *Menu::GetTextString(int player, page_t page, int &keys) if (pItem->handler != -1) { - ret = executeForwards(pItem->handler, player, thisId, i); + ret = executeForwards(pItem->handler, static_cast(player), static_cast(thisId), static_cast(i)); if (ret == ITEM_ENABLED) enabled = true; else if (ret == ITEM_DISABLED) diff --git a/amxmodx/srvcmd.cpp b/amxmodx/srvcmd.cpp index a1f1cdc9..739ba3bd 100755 --- a/amxmodx/srvcmd.cpp +++ b/amxmodx/srvcmd.cpp @@ -254,7 +254,8 @@ void plugin_srvcmd() { if ((*a).matchCommand(cmd) && (*a).getPlugin()->isExecutable((*a).getFunction())) { - cell ret = executeForwards((*a).getFunction(), g_srvindex, (*a).getFlags(), (*a).getId()); + cell ret = executeForwards((*a).getFunction(), static_cast(g_srvindex), + static_cast((*a).getFlags()), static_cast((*a).getId())); if (ret) break; } ++a;