diff --git a/YSI_Coding/y_inline/y_inline_impl.inc b/YSI_Coding/y_inline/y_inline_impl.inc index e205c4c0..65d0d212 100644 --- a/YSI_Coding/y_inline/y_inline_impl.inc +++ b/YSI_Coding/y_inline/y_inline_impl.inc @@ -295,7 +295,7 @@ stock Inline_EBC__(owner, tag) return ++timerID, //// Set a timer to kill this inline eventually. - YSI_SetTimerEx__(&Inline_TBC__, owner, false, YSI_gcI, timerID), + SetTimerEx(&Inline_TBC__, owner, false, __const(YSI_gcI), timerID), (timerID | (0x1FF << 22)) & cellmax; } else @@ -1227,7 +1227,7 @@ stock Function:GetRemoteFunction(const func[], const spec[], tag = 0) mset(closure, _:E_INDIRECTION_HANDER, _:addressof (Callback_RemoteHandler_)); mset(closure, _:E_INDIRECTION_CLAIM, _:addressof (Callback_Claim_)); mset(closure, _:E_INDIRECTION_RELEASE, _:addressof (Callback_Release_)); - mset(closure, _:E_PUBLIC_CALL_TIMER, YSI_SetTimerEx__(&Inline_MaybeFree_, 0, false, YSI_gcI, _:closure)); + mset(closure, _:E_PUBLIC_CALL_TIMER, SetTimerEx(&Inline_MaybeFree_, 0, false, __const(YSI_gcI), _:closure)); mset(closure, _:E_PUBLIC_CALL_FLAGS, e_INLINE_FLAG_PUBLIC); mset(closure, _:E_INDIRECTION_METADATA, 0); if (tag) @@ -1285,7 +1285,7 @@ stock Function:GetLocalFunction(const func[], const spec[], tag = 0) mset(closure, _:E_INDIRECTION_HANDER, _:addressof (Callback_LocalHandler_)); mset(closure, _:E_INDIRECTION_CLAIM, _:addressof (Callback_Claim_)); mset(closure, _:E_INDIRECTION_RELEASE, _:addressof (Callback_Release_)); - mset(closure, _:E_PUBLIC_CALL_TIMER, YSI_SetTimerEx__(&Inline_MaybeFree_, 0, false, YSI_gcI, _:closure)); + mset(closure, _:E_PUBLIC_CALL_TIMER, SetTimerEx(&Inline_MaybeFree_, 0, false, __const(YSI_gcI), _:closure)); mset(closure, _:E_PUBLIC_CALL_FLAGS, e_INLINE_FLAG_PUBLIC); mset(closure, _:E_INDIRECTION_METADATA, 0); if (tag) @@ -1404,7 +1404,7 @@ static stock Callback_InlineByName(const name[], tag) mset(closure, _:E_INDIRECTION_HANDER, _:addressof (Callback_CallHandler_)); mset(closure, _:E_INDIRECTION_CLAIM, _:addressof (Callback_Claim_)); mset(closure, _:E_INDIRECTION_RELEASE, _:addressof (Callback_Release_)); - mset(closure, _:E_INLINE_CALL_TIMER, YSI_SetTimerEx__(&Inline_MaybeFree_, 0, false, YSI_gcI, _:closure)); + mset(closure, _:E_INLINE_CALL_TIMER, SetTimerEx(&Inline_MaybeFree_, 0, false, __const(YSI_gcI), _:closure)); mset(closure, _:E_INLINE_CALL_FLAGS, e_INLINE_FLAG_CONST); mset(closure, _:E_INDIRECTION_METADATA, 0); mset(closure, _:E_INDIRECTION_TAG, tag); @@ -1670,7 +1670,7 @@ stock Callback_Release(const input[E_CALLBACK_DATA]) static stock Callback_Claim_(func[E_INLINE_CALL]) { KillTimer(func[E_INLINE_CALL_TIMER]); - func[E_INLINE_CALL_TIMER] = YSI_SetTimerEx__(&Inline_MaybeConst_, 0, false, YSI_gcI, AMX_Ref(func[E_INLINE_CALL:E_INDIRECTION_ALWAYS_NULL])); + func[E_INLINE_CALL_TIMER] = SetTimerEx(&Inline_MaybeConst_, 0, false, __const(YSI_gcI), AMX_Ref(func[E_INLINE_CALL:E_INDIRECTION_ALWAYS_NULL])); } /*-------------------------------------------------------------------------*//** @@ -2251,7 +2251,7 @@ stock Inline_UI_(const &header, tag) mset(closure, _:E_INDIRECTION_HANDER, _:addressof (Callback_CallHandler_)); mset(closure, _:E_INDIRECTION_CLAIM, _:addressof (Callback_Claim_)); mset(closure, _:E_INDIRECTION_RELEASE, _:addressof (Callback_Release_)); - mset(closure, _:E_INLINE_CALL_TIMER, YSI_SetTimerEx__(&Inline_MaybeFree_, 0, false, YSI_gcI, _:closure)); + mset(closure, _:E_INLINE_CALL_TIMER, SetTimerEx(&Inline_MaybeFree_, 0, false, __const(YSI_gcI), _:closure)); mset(closure, _:E_INLINE_CALL_FLAGS, e_INLINE_FLAG_CONST); mset(closure, _:E_INDIRECTION_METADATA, 0); mset(closure, _:E_INDIRECTION_TAG, tag); diff --git a/YSI_Coding/y_malloc/y_malloc_tests.inc b/YSI_Coding/y_malloc/y_malloc_tests.inc index ea23912b..c9ce50f7 100644 --- a/YSI_Coding/y_malloc/y_malloc_tests.inc +++ b/YSI_Coding/y_malloc/y_malloc_tests.inc @@ -319,6 +319,6 @@ public y_malloc_Deferred(Alloc:alloc) { mset(alloc, i, i * 2); } - YSI_SetTimerEx__("y_malloc_Deferred", 10, false, "i", _:alloc); + SetTimerEx(__const("y_malloc_Deferred"), 10, false, __const(YSI_gcI), _:alloc); } diff --git a/YSI_Coding/y_timers/y_timers_impl.inc b/YSI_Coding/y_timers/y_timers_impl.inc index 59563b1f..5d80880f 100644 --- a/YSI_Coding/y_timers/y_timers_impl.inc +++ b/YSI_Coding/y_timers/y_timers_impl.inc @@ -160,7 +160,7 @@ public OnCodeInit() Debug_Print7("Timer_OnYSIInit: %s", Unpack(buffer)); // Get the time offset for the current call. This should mean // that all the functions are nicely spread out. - YSI_SetTimerEx__(buffer, time * pre / total, false, "ii", 1, -1); + SetTimerEx(__const(buffer), time * pre / total, false, __const(YSI_gcII), 1, -1); } } } @@ -290,7 +290,7 @@ stock _y@T:_Timer_I(const func[], interval, {_, _@yT}:action, &result) { if (!result) { - result = YSI_SetTimer__(func, interval, true); + result = SetTimer(__const(func), interval, true); } } } @@ -344,13 +344,13 @@ stock _y@T:_Timer_D(const func[], interval, const {_, _@yT}:action, who, results { if (!results[who]) { - results[who] = YSI_SetTimerEx__(func, interval, true, YSI_gcI, who); + results[who] = SetTimerEx(__const(func), interval, true, __const(YSI_gcI), who); } } } else if (!results[who]) { - results[who] = YSI_SetTimerEx__(func, interval, true, YSI_gcI, who); + results[who] = SetTimerEx(__const(func), interval, true, __const(YSI_gcI), who); } } } diff --git a/YSI_Coding/y_va/y_va_entry.inc b/YSI_Coding/y_va/y_va_entry.inc index 0d956562..a46b0ce3 100644 --- a/YSI_Coding/y_va/y_va_entry.inc +++ b/YSI_Coding/y_va/y_va_entry.inc @@ -97,7 +97,7 @@ native va_print(const fmat[], GLOBAL_TAG_TYPES:...) = printf; stock va_fprintf(File:fhnd, const fmat[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(2)) - return fwrite(fhnd, fmat); + return fwrite(fhnd, __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(2)), fwrite(fhnd, YSI_UNSAFE_HUGE_STRING); @@ -109,7 +109,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. // No open.mp version yet (probably because I forgot it in y_va, so // subsequently didn't see it when doing the open.mp natives). if (YSI_CheckNumargs__(2)) - return bool:SetVehicleNumberPlate(vehicleid, fmat); + return bool:SetVehicleNumberPlate(vehicleid, __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(2)), bool:SetVehicleNumberPlate(vehicleid, YSI_UNSAFE_HUGE_STRING); @@ -149,10 +149,10 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. { // This gives a warning on purpose - `flags` is not used by open.mp. if (YSI_CheckNumargs__(3)) - return bool:AddServerRule(name, fmat); + return bool:AddServerRule(__const(name), __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(3)), - bool:AddServerRule(name, YSI_UNSAFE_HUGE_STRING); + bool:AddServerRule(__const(name), YSI_UNSAFE_HUGE_STRING); } #if defined YSI_TESTS @@ -162,7 +162,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock PlayerText:va_CreatePlayerTextDraw(playerid, Float:x, Float:y, const fmat[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(4)) - return CreatePlayerTextDraw(playerid, x, y, fmat); + return CreatePlayerTextDraw(playerid, x, y, __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(4)), CreatePlayerTextDraw(playerid, x, y, YSI_UNSAFE_HUGE_STRING); @@ -171,7 +171,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock va_SetPlayerChatBubble(playerid, const fmat[], colour, Float:drawDistance, expireTime, GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(5)) - return SetPlayerChatBubble(playerid, fmat, colour, drawDistance, expireTime); + return SetPlayerChatBubble(playerid, __const(fmat), colour, drawDistance, expireTime); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(5)), SetPlayerChatBubble(playerid, YSI_UNSAFE_HUGE_STRING, colour, drawDistance, expireTime); @@ -180,7 +180,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock Text:va_TextDrawCreate(Float:x, Float:y, const fmat[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(3)) - return TextDrawCreate(x, y, fmat); + return TextDrawCreate(x, y, __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(3)), TextDrawCreate(x, y, YSI_UNSAFE_HUGE_STRING); @@ -189,7 +189,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock bool:va_TextDrawSetString(Text:text, const fmat[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(2)) - return bool:TextDrawSetString(text, fmat); + return bool:TextDrawSetString(text, __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(2)), bool:TextDrawSetString(text, YSI_UNSAFE_HUGE_STRING); @@ -198,7 +198,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock bool:va_PlayerTextDrawSetString(playerid, PlayerText:text, const fmat[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(3)) - return bool:PlayerTextDrawSetString(playerid, text, fmat); + return bool:PlayerTextDrawSetString(playerid, text, __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(3)), bool:PlayerTextDrawSetString(playerid, text, YSI_UNSAFE_HUGE_STRING); @@ -207,7 +207,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock bool:va_SendClientMessage(playerid, colour, const fmat[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(3)) - return bool:SendClientMessage(playerid, colour, fmat); + return bool:SendClientMessage(playerid, colour, __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(3)), bool:SendClientMessage(playerid, colour, YSI_UNSAFE_HUGE_STRING); @@ -216,7 +216,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock bool:va_SendClientMessageToAll(colour, const fmat[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(2)) - return bool:SendClientMessageToAll(colour, fmat); + return bool:SendClientMessageToAll(colour, __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(2)), bool:SendClientMessageToAll(colour, YSI_UNSAFE_HUGE_STRING); @@ -225,7 +225,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock bool:va_SendPlayerMessageToPlayer(playerid, senderid, const fmat[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(3)) - return bool:SendPlayerMessageToPlayer(playerid, senderid, fmat); + return bool:SendPlayerMessageToPlayer(playerid, senderid, __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(3)), bool:SendPlayerMessageToPlayer(playerid, senderid, YSI_UNSAFE_HUGE_STRING); @@ -234,7 +234,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock bool:va_SendPlayerMessageToAll(senderid, const fmat[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(2)) - return bool:SendPlayerMessageToAll(senderid, fmat); + return bool:SendPlayerMessageToAll(senderid, __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(2)), bool:SendPlayerMessageToAll(senderid, YSI_UNSAFE_HUGE_STRING); @@ -243,7 +243,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock bool:va_GameTextForPlayer(playerid, const fmat[], time, style, GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(4)) - return bool:GameTextForPlayer(playerid, fmat, time, style); + return bool:GameTextForPlayer(playerid, __const(fmat), time, style); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(4)), bool:GameTextForPlayer(playerid, YSI_UNSAFE_HUGE_STRING, time, style); @@ -252,7 +252,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock bool:va_GameTextForAll(const fmat[], time, style, GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(3)) - return bool:GameTextForAll(fmat, time, style); + return bool:GameTextForAll(__const(fmat), time, style); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(3)), bool:GameTextForAll(YSI_UNSAFE_HUGE_STRING, time, style); @@ -261,16 +261,16 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock bool:va_SendRconCommand(const fmat[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(1)) - return bool:YSI_SendRconCommand__(fmat); + return bool:SendRconCommand(__const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(1)), - bool:YSI_SendRconCommand__(YSI_UNSAFE_HUGE_STRING); + bool:SendRconCommand(YSI_UNSAFE_HUGE_STRING); } stock bool:va_SetGameModeText(const fmat[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(1)) - return bool:SetGameModeText(fmat); + return bool:SetGameModeText(__const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(1)), bool:SetGameModeText(YSI_UNSAFE_HUGE_STRING); @@ -282,7 +282,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock DBResult:va_DBQuery(DB:db, const fmat[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(2)) - return YSI_DB_Query__(db, fmat); + return YSI_DB_Query__(db, __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(2)), YSI_DB_Query__(db, YSI_UNSAFE_HUGE_STRING); @@ -296,16 +296,16 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock bool:va_ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE:style, const title[], const fmat[], const button1[], const button2[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(7)) - return bool:Dialog_ShowPlayerNative(playerid, dialogid, style, title, fmat, button1, button2); + return bool:Dialog_ShowPlayerNative(playerid, dialogid, style, __const(title), __const(fmat), __const(button1), __const(button2)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(7)), - bool:Dialog_ShowPlayerNative(playerid, dialogid, style, title, YSI_UNSAFE_HUGE_STRING, button1, button2); + bool:Dialog_ShowPlayerNative(playerid, dialogid, style, __const(title), YSI_UNSAFE_HUGE_STRING, __const(button1), __const(button2)); } stock Menu:va_CreateMenu(const fmat[], columns, Float:x, Float:y, Float:col1width, Float:col2width = 0.0, GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(6)) - return CreateMenu(fmat, columns, x, y, col1width, col2width); + return CreateMenu(__const(fmat), columns, x, y, col1width, col2width); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(6)), CreateMenu(YSI_UNSAFE_HUGE_STRING, columns, x, y, col1width, col2width); @@ -314,7 +314,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock va_AddMenuItem(Menu:menuid, column, const fmat[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(3)) - return AddMenuItem(menuid, column, fmat); + return AddMenuItem(menuid, column, __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(3)), AddMenuItem(menuid, column, YSI_UNSAFE_HUGE_STRING); @@ -323,7 +323,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock bool:va_SetMenuColumnHeader(Menu:menuid, column, const fmat[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(3)) - return bool:SetMenuColumnHeader(menuid, column, fmat); + return bool:SetMenuColumnHeader(menuid, column, __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(3)), bool:SetMenuColumnHeader(menuid, column, YSI_UNSAFE_HUGE_STRING); @@ -339,7 +339,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. { // If you get an error here, update your includes! if (YSI_CheckNumargs__(10)) - return bool:SetObjectMaterialText(objectid, fmat, materialIndex, materialSize, fontFace, fontSize, bold, fontColour, backgroundColour, textalignment); + return bool:SetObjectMaterialText(objectid, __const(fmat), materialIndex, materialSize, fontFace, fontSize, bold, fontColour, backgroundColour, textalignment); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(10)), bool:SetObjectMaterialText(objectid, YSI_UNSAFE_HUGE_STRING, materialIndex, materialSize, fontFace, fontSize, bold, fontColour, backgroundColour, textalignment); @@ -349,7 +349,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. { // If you get an error here, update your includes! if (YSI_CheckNumargs__(11)) - return bool:SetPlayerObjectMaterialText(playerid, objectid, fmat, materialIndex, materialSize, fontFace, fontSize, bold, fontColour, backgroundColour, textalignment); + return bool:SetPlayerObjectMaterialText(playerid, objectid, __const(fmat), materialIndex, materialSize, fontFace, fontSize, bold, fontColour, backgroundColour, textalignment); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(11)), bool:SetPlayerObjectMaterialText(playerid, objectid, YSI_UNSAFE_HUGE_STRING, materialIndex, materialSize, fontFace, fontSize, bold, fontColour, backgroundColour, textalignment); @@ -358,7 +358,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock Text3D:va_Create3DTextLabel(const fmat[], colour, Float:x, Float:y, Float:z, Float:drawDistance, virtualWorld, bool:testLOS = false, GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(8)) - return Create3DTextLabel(fmat, colour, x, y, z, drawDistance, virtualWorld, testLOS); + return Create3DTextLabel(__const(fmat), colour, x, y, z, drawDistance, virtualWorld, testLOS); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(8)), Create3DTextLabel(YSI_UNSAFE_HUGE_STRING, colour, x, y, z, drawDistance, virtualWorld, testLOS); @@ -367,7 +367,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock bool:va_Update3DTextLabelText(Text3D:textid, colour, const fmat[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(3)) - return bool:Update3DTextLabelText(textid, colour, fmat); + return bool:Update3DTextLabelText(textid, colour, __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(3)), bool:Update3DTextLabelText(textid, colour, YSI_UNSAFE_HUGE_STRING); @@ -376,7 +376,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock PlayerText3D:va_CreatePlayer3DTextLabel(playerid, const fmat[], colour, Float:x, Float:y, Float:z, Float:drawDistance, parentPlayerid = INVALID_PLAYER_ID, parentVehicleid = INVALID_VEHICLE_ID, bool:testLOS = false, GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(10)) - return CreatePlayer3DTextLabel(playerid, fmat, colour, x, y, z, drawDistance, parentPlayerid, parentVehicleid, testLOS); + return CreatePlayer3DTextLabel(playerid, __const(fmat), colour, x, y, z, drawDistance, parentPlayerid, parentVehicleid, testLOS); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(10)), CreatePlayer3DTextLabel(playerid, YSI_UNSAFE_HUGE_STRING, colour, x, y, z, drawDistance, parentPlayerid, parentVehicleid, testLOS); @@ -385,7 +385,7 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock bool:va_UpdatePlayer3DTextLabelText(playerid, PlayerText3D:textid, colour, const fmat[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(4)) - return bool:UpdatePlayer3DTextLabelText(playerid, textid, colour, fmat); + return bool:UpdatePlayer3DTextLabelText(playerid, textid, colour, __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(4)), bool:UpdatePlayer3DTextLabelText(playerid, textid, colour, YSI_UNSAFE_HUGE_STRING); @@ -395,20 +395,20 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. { // If you get an error here, update your includes! if (YSI_CheckNumargs__(2)) - return bool:SetSVarString(svar, fmat); + return bool:SetSVarString(__const(svar), __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(2)), - bool:SetSVarString(svar, YSI_UNSAFE_HUGE_STRING); + bool:SetSVarString(__const(svar), YSI_UNSAFE_HUGE_STRING); } - stock bool:va_SetPVarString(playerid, const svar[], const fmat[], GLOBAL_TAG_TYPES:...) + stock bool:va_SetPVarString(playerid, const pvar[], const fmat[], GLOBAL_TAG_TYPES:...) { // If you get an error here, update your includes! if (YSI_CheckNumargs__(3)) - return bool:SetPVarString(playerid, svar, fmat); + return bool:SetPVarString(playerid, __const(pvar), __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(3)), - bool:SetPVarString(playerid, svar, YSI_UNSAFE_HUGE_STRING); + bool:SetPVarString(playerid, __const(pvar), YSI_UNSAFE_HUGE_STRING); } // YSF @@ -416,19 +416,19 @@ stock bool:va_SetVehicleNumberPlate(vehicleid, const fmat[], GLOBAL_TAG_TYPES:.. stock bool:va_AddServerRule(const name[], const fmat[], E_SERVER_RULE_FLAGS:flags = E_SERVER_RULE_FLAGS:4, GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(3)) - return bool:AddServerRule(name, fmat, flags); + return bool:AddServerRule(__const(name), __const(fmat), flags); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(3)), - bool:AddServerRule(name, YSI_UNSAFE_HUGE_STRING, flags); + bool:AddServerRule(__const(name), YSI_UNSAFE_HUGE_STRING, flags); } stock bool:va_SetServerRule(const name[], const fmat[], GLOBAL_TAG_TYPES:...) { if (YSI_CheckNumargs__(2)) - return bool:SetServerRule(name, fmat); + return bool:SetServerRule(__const(name), __const(fmat)); return format(YSI_UNSAFE_HUGE_STRING, YSI_UNSAFE_HUGE_LENGTH, fmat, ___(2)), - bool:SetServerRule(name, YSI_UNSAFE_HUGE_STRING); + bool:SetServerRule(__const(name), YSI_UNSAFE_HUGE_STRING); } native bool:va_TextDrawSetStringForPlayer(Text:text, playerid, const fmat[], GLOBAL_TAG_TYPES:...) = TextDrawSetStringForPlayer; diff --git a/YSI_Core/y_core/y_const_correct.inc b/YSI_Core/y_core/y_const_correct.inc new file mode 100644 index 00000000..79c6ac0b --- /dev/null +++ b/YSI_Core/y_core/y_const_correct.inc @@ -0,0 +1,83 @@ +#if defined _INC_y_const_correct + #endinput +#endif +#define _INC_y_const_correct + +// There are four main cases to consider when writing code that must be fully +// compatible with all compilers and libraries in being const-correct: +// +// 1. Old compiler, old includes - `const` isn't checked, so it doesn't matter +// whether it is used or not. For this case we gate the `#pragma` because +// it doesn't exist. +// +// 2. Old compiler, new includes - As above. +// +// 3. New compiler, new includes - `const` is checked, and the code is const- +// correct. +// +// 4. New compiler, old includes - This is the tricky one, because people have +// updated one part of their stack, but not another one. Supporting this +// edge-case required either new native definitions or `#pragma warning`, +// but we can now bypass the compiler const check within our const-correct +// boundary. +// +// The obvious solution is to make this code not const-correct either, but +// that's not an option for people who are on the new compiler and want +// const-correctness; and is just pushing the issue further up the stack. +// So we need to make the external API of this library const-correct, but +// internally call const-incorrect code. +// +// First check if people are on the newest compiler, and don't have any const- +// correct includes. If they don't, define `SAMP_CONST_INCORRECT`. Also has +// extra checks for the two known const-correct define variants. While another +// one may be introduced by another library, I, Y_Less, hereby solemnly swear +// this I will not add a new mutually-exclusive define (`OPEN_MP_CONST_CORRECT` +// already exists, but along-side `SAMP_CONST_CORRECT`). +#if defined FIX_const + #if FIX_const + // We get const-correctness from fixes.inc. + #define SAMP_CONST_CORRECT + #endif +#endif + +#if !defined __const + #define __const +#endif + +#if !defined SAMP_CONST_CORRECT + // The libraries are not const-corret. + #define SAMP_CONST_INCORRECT + #if defined __PawnBuild + #if __PawnBuild >= 9 + // But they should be. + #undef __const + #define __const __const_impl + #endif + #endif +#endif + +#if !defined __const_decl + #define __const_decl + + // Again, this is required because of the restriction to not redefine + // natives. I've named it `__const` because it is very core. + stock __const_impl(const arr[]) + { + // This works by replacing the hidden return address on the stack with + // the true address of our data then lying to the compiler to say we're + // passing a normal array. + // + // Sadly the `__emit` version doesn't work. If it did this would be + // acceptable as const-correctness and `__emit` are in the same compiler + // versions: + // + // #define __const(%0) __emit(load.s.pri %0, push.pri) + // + #emit LOAD.S.pri arr + #emit STOR.S.pri 16 + #emit RETN + new ret[1]; + return ret; + } +#endif + diff --git a/YSI_Core/y_core/y_core_entry.inc b/YSI_Core/y_core/y_core_entry.inc index bbdc98bd..4194e815 100644 --- a/YSI_Core/y_core/y_core_entry.inc +++ b/YSI_Core/y_core/y_core_entry.inc @@ -119,6 +119,9 @@ Optional plugins: #define volatile #endif +// Completely stand-alone code. +#include "y_const_correct" + // The most first include, since it determines compiler settings that might be // used by literally any other include. #include "..\..\YSI_Server\y_thirdpartyinclude\y_addressof" diff --git a/YSI_Core/y_core/y_rconfix.inc b/YSI_Core/y_core/y_rconfix.inc index 45b717ce..89dcfc10 100644 --- a/YSI_Core/y_core/y_rconfix.inc +++ b/YSI_Core/y_core/y_rconfix.inc @@ -122,7 +122,7 @@ Server_LoadRconFix() <> { // Test if the fix has already been loaded. setproperty(27, YSI_gscOnClientCheckResponse, 0); - YSI_SendRconCommand__(YSI_gscOnClientCheckResponse); + SendRconCommand(__const(YSI_gscOnClientCheckResponse)); if (getproperty(27, YSI_gscOnClientCheckResponse) != 0) { return; @@ -197,7 +197,7 @@ Server_LoadRconFix() <> } if (fexist(YSI_gscRconFixFS)) { - YSI_SendRconCommand__("loadfs ../scriptfiles/callbackfix"); + SendRconCommand(__const("loadfs ../scriptfiles/callbackfix")); #if defined YSI_FIX_CALLBACKS state OnClientCheckResponse : OnClientCheckResponse_GM; #endif @@ -228,7 +228,7 @@ stock Server_UnloadRconFix() <> { if (Server_IsSAMP()) { - YSI_SendRconCommand__("unloadfs ../scriptfiles/callbackfix"); + SendRconCommand(__const("unloadfs ../scriptfiles/callbackfix")); } } diff --git a/YSI_Core/y_core/y_samp_natives.inc b/YSI_Core/y_core/y_samp_natives.inc index b73e3984..02b18bea 100644 --- a/YSI_Core/y_core/y_samp_natives.inc +++ b/YSI_Core/y_core/y_samp_natives.inc @@ -150,24 +150,6 @@ static stock const #emit SCTRL __cip } -/*-------------------------------------------------------------------------*//** - * y_samp_natives - * - * Const-correct SetTimer. - * - *//*------------------------------------------------------------------------**/ - -native YSI_SetTimer__(const funcname[], interval, bool:repeating) = SetTimer; - -/*-------------------------------------------------------------------------*//** - * y_samp_natives - * - * Const-correct SetTimerEx. - * - *//*------------------------------------------------------------------------**/ - -native YSI_SetTimerEx__(const funcname[], interval, bool:repeating, const format[], GLOBAL_TAG_TYPES:...) = SetTimerEx; - /*-------------------------------------------------------------------------*//** * y_samp_natives * @@ -177,7 +159,7 @@ native YSI_SetTimerEx__(const funcname[], interval, bool:repeating, const format stock SetTimerAddr(addr, time, bool:repeat) { - return YSI_SetTimerEx__(YSI_gscTimerStub, time, repeat, YSI_gcI, addr); + return SetTimerEx(__const(YSI_gscTimerStub), time, repeat, __const(YSI_gcI), addr); } #if defined _ALS_SetTimer @@ -189,8 +171,6 @@ stock SetTimerAddr(addr, time, bool:repeat) #define @yS2:addressof(%0<%9><>) @yS2:addressof(%0<>) #define SetTimer(&%0,%1) SetTimerAddr(_:@yS2:addressof(%0<>),%1) -#define YSI_SetTimer__(&%0,%1) SetTimerAddr(_:@yS2:addressof(%0<>),%1) -//#define SetTimerAddr(&%0,%1) SetTimerAddr(_:@yS2:addressof(%0<>),%1) /*-------------------------------------------------------------------------*//** * y_samp_natives @@ -252,8 +232,6 @@ stock SetTimerExAddr(dummy__ = 0, time, bool:repeat, const fmt[], addr, GLOBAL_T #define @yS1:addressof(%0),%1) (Y_HOOKS_ADDRESSOF(%0(%1))),%1) #define SetTimerEx(&%0,%1,%2,%3,%4) SetTimerExAddr(_,%1,%2,%3,_:@yS0:@yS1:addressof(%0),%4) -#define YSI_SetTimerEx__(&%0,%1,%2,%3,%4) SetTimerExAddr(_,%1,%2,%3,_:@yS0:@yS1:addressof(%0),%4) -//#define SetTimerExAddr(&%0,%1,%2,%3,%4) SetTimerExAddr(_,%1,%2,%3,_:@yS0:@yS1:addressof(%0),%4) /*-------------------------------------------------------------------------*//** * y_samp_natives @@ -276,15 +254,6 @@ native YSI_HTTP__(index, HTTP_METHOD:method, const url[], const data[], const ca native YSI_Format__(dest[], size = sizeof (dest), const format[], GLOBAL_TAG_TYPES:...) = format; -/*-------------------------------------------------------------------------*//** - * y_samp_natives - * - * Const-correct SendRconCommand. - * - *//*------------------------------------------------------------------------**/ - -native YSI_SendRconCommand__(const str[]) = SendRconCommand; - /*-------------------------------------------------------------------------*//** * y_samp_natives * @@ -365,23 +334,6 @@ native _YSI_FGetChar__(File:handle, value, bool:utf8 = true) = fgetchar; #define DIALOG_STYLE: _: #endif -/*-------------------------------------------------------------------------*//** - * y_samp_natives - * - * Const- and tag-correct ShowPlayerDialog. - * - *//*------------------------------------------------------------------------**/ - -#if defined _ALS_ShowPlayerDialog - static stock Dialog_ShowPlayerNative__(playerid, dialogid, DIALOG_STYLE:style, const caption[], const info[], const button1[], const button2[]) - { - return false; - } - #define Dialog_ShowPlayerNative ShowPlayerDialog -#else - native bool:Dialog_ShowPlayerNative(playerid, dialogid, DIALOG_STYLE:style, const caption[], const info[], const button1[], const button2[]) = ShowPlayerDialog; -#endif - /*-------------------------------------------------------------------------*//** * y_samp_natives * diff --git a/YSI_Core/y_core/y_scriptinit_impl.inc b/YSI_Core/y_core/y_scriptinit_impl.inc index dd2e6cdb..f4ed4a98 100644 --- a/YSI_Core/y_core/y_scriptinit_impl.inc +++ b/YSI_Core/y_core/y_scriptinit_impl.inc @@ -1803,7 +1803,7 @@ ScriptInit_Purge_clean: fremove(tmp); // Recheck once an hour. ScriptInit_Purge_retry: - YSI_gsPurgeTimer = YSI_SetTimer__(&ScriptInit_PurgeTemporaries<>, 1000 * 60 * 60, false); + YSI_gsPurgeTimer = SetTimer(&ScriptInit_PurgeTemporaries<>, 1000 * 60 * 60, false); } /*-------------------------------------------------------------------------*//** diff --git a/YSI_Extra/y_inline_timers.inc b/YSI_Extra/y_inline_timers.inc index 1d286667..41e63fa5 100644 --- a/YSI_Extra/y_inline_timers.inc +++ b/YSI_Extra/y_inline_timers.inc @@ -129,7 +129,7 @@ static stock Timer_InlineCount(Func:func<>, time, count) { // Initial repeating timer, to set the time offset. //printf("delay = %d", timer); - Indirect_SetMeta(func, YSI_SetTimerEx__(&Timer_InlineRepeat, time, true, YSI_gcI, _:func)); + Indirect_SetMeta(func, SetTimerEx(&Timer_InlineRepeat, time, true, __const(YSI_gcI), _:func)); // Call the function after setting the meta, incase it kills the timer. @.func(); } @@ -143,7 +143,7 @@ static stock Timer_InlineCount(Func:func<>, time, count) else { // Call after meta. - Indirect_SetMeta(func, YSI_SetTimerEx__(&Timer_InlineCount, time, false, YSI_gcIII, _:func, time, count)); + Indirect_SetMeta(func, SetTimerEx(&Timer_InlineCount, time, false, __const(YSI_gcIII), _:func, time, count)); @.func(); } } @@ -200,7 +200,7 @@ stock Timer_CreateCallback(Func:func<>, initialOrTime, timeOrCount = 0, count = // the initial offset time. // Repeat N times. Indirect_Claim(func); - Indirect_SetMeta(func, YSI_SetTimerEx__(&Timer_InlineCount, initialOrTime, false, YSI_gcIII, _:func, timeOrCount, count)); + Indirect_SetMeta(func, SetTimerEx(&Timer_InlineCount, initialOrTime, false, __const(YSI_gcIII), _:func, timeOrCount, count)); return _:func; } diff --git a/YSI_Players/y_android/y_android_entry.inc b/YSI_Players/y_android/y_android_entry.inc index 4a119362..5f8277b2 100644 --- a/YSI_Players/y_android/y_android_entry.inc +++ b/YSI_Players/y_android/y_android_entry.inc @@ -127,14 +127,12 @@ public OnClientCheckResponse(playerid, actionid, memaddr, retndata) return 1; } -forward OnAndroidTimer(playerid); - -public OnAndroidTimer(playerid) +static stock OnAndroidTimer(playerid) { if (YSI_g_sIsAndroid[playerid] != true) { YSI_g_sIsAndroid[playerid] = true; - CallRemoteFunction("OnAndroidCheck", "ii", playerid, true); + CallRemoteFunction(__const("OnAndroidCheck"), __const(YSI_gcII), playerid, true); } //#if defined Android_OnAndroidTimer // Android_OnAndroidTimer(playerid); @@ -161,7 +159,7 @@ public OnPlayerConnect(playerid) if (!Script_IsFilterscript()) { YSI_SendClientCheck__(playerid, 0x48, 0, 0, 2); - YSI_g_sTimers[playerid] = YSI_SetTimerEx__("OnAndroidTimer", 10000, false, YSI_gcI, playerid); + YSI_g_sTimers[playerid] = SetTimerEx(&OnAndroidTimer, 10000, false, __const(YSI_gcI), playerid); } #if defined Android_OnPlayerConnect Android_OnPlayerConnect(playerid); diff --git a/YSI_Players/y_users/y_users_impl.inc b/YSI_Players/y_users/y_users_impl.inc index f67a98e6..28667a11 100644 --- a/YSI_Players/y_users/y_users_impl.inc +++ b/YSI_Players/y_users/y_users_impl.inc @@ -379,7 +379,7 @@ stock bool:User_ConfirmEmail(playerid, string:email[]) } // Defer the call, so it looks like a callback in the same way as // confirming a password. Check the length first. - YSI_SetTimerEx__("OnConfirmEmail", 0, false, "ii", playerid, len == end - start && strcmp(YSI_g_sUserEmail[playerid], email[start], false, len) == 0); + SetTimerEx(__const("OnConfirmEmail"), 0, false, __const(YSI_gcII), playerid, len == end - start && strcmp(YSI_g_sUserEmail[playerid], email[start], false, len) == 0); return true; } } diff --git a/YSI_Server/y_flooding/y_flooding_entry.inc b/YSI_Server/y_flooding/y_flooding_entry.inc index 855c6190..bb021301 100644 --- a/YSI_Server/y_flooding/y_flooding_entry.inc +++ b/YSI_Server/y_flooding/y_flooding_entry.inc @@ -233,7 +233,7 @@ static Flooding_CheckIP(playerid, ip[]) cmd[22] = "banip "; strcat(cmd, ip); SendRconCommand(cmd); - YSI_SetTimerEx__(&Flooding_UnbanIP, 10000, false, YSI_gcI, ip32); + SetTimerEx(&Flooding_UnbanIP, 10000, false, __const(YSI_gcI), ip32); } case e_FLOOD_ACTION_OTHER: { diff --git a/YSI_Server/y_natives/y_natives_entry.inc b/YSI_Server/y_natives/y_natives_entry.inc index 03913f3f..d6017494 100644 --- a/YSI_Server/y_natives/y_natives_entry.inc +++ b/YSI_Server/y_natives/y_natives_entry.inc @@ -93,35 +93,23 @@ if (defined("MAYBE_CreateDynamicCircle")) #define _@yN%0\32; _@yN -#define @native(%3)%0(%1) @decorator__(yN@_:yN_@:)(%3)%0(%1) +#define @native(%3)%0(%1) @decorator__(yN@_:yN_@)(%3)%0(%1) // TODO: `void:` and `string:` return support. -#define yN@_:yN_@:%8$(%0)(%1)(%2)(%3)(%4)(%5); %8$native _@yN%2()=heapspace;stock %1%2(%3){static s=1;return _yN@(%0,.s=s),%1_@yN%2();} -#define yN_@:%8$(%0)(%1)(%2)(%3)(%4)(%5) %8$native _@yN%2()=heapspace;stock %1%2(%3){static s=3;return _yN@(%0,.s=s,.f=_:addressof(_@%2<%4>)),%1_@yN%2();}%1_@%2(%3) - -//#define NATIVE_DECORATOR:%8$("%0")(%1)(%2)(%3)(%4)(%5) %8$native %1_@yN%2(%3)=heapspace;stock %1%2(%3){static s=1;if(s)s=_yN@(#%0,NATIVE_IDXOF(_@yN%2(%5)));return _@yN%2(%5);} - -//stock _y@N(ret) -//{ -// // When this is called the true return value is still in `alt`. Get it out -// // as quickly as possible! -// #emit POP.pri // Get the original caller's frame. -// #emit SCTRL __frm -// #emit MOVE.pri -// // Discard two values (now the return address is safely in `pri`). -// #emit STACK __2_cells -// #emit SWAP.pri // Get the return value and save the address. -// -//} +#define yN@_:yN_@:%8$(%0)(%1)(%2)(%3)(%4)(%5); %8$native _@yN%2()=heapspace;stock %1%2(%3){static s=-1;return _yN@(%0,.s=s),%1_@yN%2();} +#define yN_@:%8$(%0)(%1)(%2)(%3)(%4)(%5) %8$native _@yN%2()=heapspace;stock %1%2(%3){static s=-3;return _yN@(%0,.s=s,.f=_:addressof(_@%2<%4>)),%1_@yN%2();}%1_@%2(%3) stock _yN@(const string:name[], &s, const string:requires[] = "", f = 0) { + Debug_Print4("_yN@ called: %s, %d, %s, %d", name, s, requires, f); // This code doesn't use switch (s) { // These values are all odd because they can't be addresses. case -1, -3, -5: + { + Debug_Print5("_yN@: Looking up the native"); // Request the native address. new addrLow, @@ -131,6 +119,7 @@ stock _yN@(const string:name[], &s, const string:requires[] = "", f = 0) // `-5` - Warnings and fallback. if (Server_GetNative(name, addrLow, addrHigh)) { + Debug_Print5("_yN@: Found native at %08x, %08x", addrLow, addrHigh); // Get the next `SYSREQ.C` opcode to read the index from. // Shamelessly ripped from amx-assembly (but I wrote it in the first // place, so I said it was OK). @@ -145,15 +134,15 @@ stock _yN@(const string:name[], &s, const string:requires[] = "", f = 0) if (ctx[DisasmContext_opcode] == OP_SYSREQ_C) #endif { - new - idx = DisasmGetOperand(ctx); - //printf("Found native %d (%d) with address %d, %d", idx, AMX_GetEntryFromNativeIndex(idx), addrLow, addrHigh); + s = DisasmGetOperand(ctx); // The native exists. Write both components of the address // pointer, despite the fact that we may only need one // depending on what server bit-width we're running on (not // worth working it out). - idx = AMX_GetEntryFromNativeIndex(idx), - AMX_Write(idx, addrLow); + f = AMX_GetEntryFromNativeIndex(s), + AMX_Write(f, addrLow); + Debug_Print5("_yN@: Found SYSREQ at %d, %08x", s, f); + //printf("Found native %d (%d) with address %d, %d", s, f, addrLow, addrHigh); #if cellbits == 32 // If we are running on a 32-bit machine this code does // nothing. If we are running on a 64-bit machine this @@ -164,7 +153,7 @@ stock _yN@(const string:name[], &s, const string:requires[] = "", f = 0) // However, if this were a 64-bit script we wouldn't // need to write the second address at all so there's no // danger of clobbering data in either case. - AMX_Write(idx + 4, addrHigh); + AMX_Write(f + 4, addrHigh); #else #pragma unused addrHigh #endif @@ -181,7 +170,7 @@ stock _yN@(const string:name[], &s, const string:requires[] = "", f = 0) { // Fallback mode. Don't print the errors here. } - else if (IsNull(requires) + else if (IsNull(requires)) { // Don't replace anything. The server will fall back to calling // `heapspace`, which is essentially a no-op. @@ -197,18 +186,15 @@ stock _yN@(const string:name[], &s, const string:requires[] = "", f = 0) { s = -7; // Jump straight back to the calling function. - #emit STACK __7_cells + #emit STACK __9_cells #emit CONST.pri 0 #emit RETN return 0; } - // Get the next `PROC` opcode (dangerous...). - // Call the fallback (now in `s`). - // Make it negative. - //return 0; - s = -9 + // Call the fallback + s = -9; // Use the fallback function. - #emit STACK __6_cells // Dump the function header. + #emit STACK __8_cells // Dump the function header. #emit POP.alt // Get `f`. #emit POP.pri // Dump data. #emit POP.pri @@ -216,6 +202,7 @@ stock _yN@(const string:name[], &s, const string:requires[] = "", f = 0) #emit MOVE.pri #emit SCTRL __cip // Jump to the fallback code. } + } case -7: { // Previously failed, no fallback. @@ -236,7 +223,21 @@ stock _yN@(const string:name[], &s, const string:requires[] = "", f = 0) #emit SCTRL __cip // Jump to the fallback code. } } + {} + Debug_Print5("_yN@: Calling native %d", s); // Call the native. + #emit LREF.S.pri s + #emit STACK __7_cells + #emit MOVE.alt + #emit POP.pri + #emit SCTRL __frm // Reset the frame pointer. + #emit MOVE.pri + #emit POP.alt + #emit SYSREQ.pri + #emit PUSH.alt + #emit PROC + #emit RETN + return 1; } diff --git a/YSI_Server/y_serverdata/y_serverdata_entry.inc b/YSI_Server/y_serverdata/y_serverdata_entry.inc index 94c5d74f..b32fa1d2 100644 --- a/YSI_Server/y_serverdata/y_serverdata_entry.inc +++ b/YSI_Server/y_serverdata/y_serverdata_entry.inc @@ -374,11 +374,11 @@ global bool:Server_GetNative(const string:name[], &addrLow, &addrHigh) deleteproperty(27, YSI_gscResultA); if (YSI_g_sLastNative[0] == '-') { - YSI_SendRconCommand__("loadfs ../scriptfiles/ysi_aux_runtime"); + SendRconCommand(__const("loadfs ../scriptfiles/ysi_aux_runtime")); } else { - YSI_SendRconCommand__("reloadfs ../scriptfiles/ysi_aux_runtime"); + SendRconCommand(__const("reloadfs ../scriptfiles/ysi_aux_runtime")); } if (existproperty(27, YSI_gscResultA)) { @@ -397,7 +397,7 @@ global bool:Server_GetNative(const string:name[], &addrLow, &addrHigh) Server_WriteNative(YSI_g_sLastNative); if (Server_DumpFile()) { - YSI_SendRconCommand__("loadfs ../scriptfiles/ysi_aux_runtime"); + SendRconCommand(__const("loadfs ../scriptfiles/ysi_aux_runtime")); } } @@ -492,13 +492,13 @@ global void:Server_DoAuxRuntimeLoad() // unknown RCON command error. // Test if the fix has already been loaded. setproperty(27, YSI_gscOnClientCheckResponse, 0); - YSI_SendRconCommand__(YSI_gscOnClientCheckResponse); + SendRconCommand(__const(YSI_gscOnClientCheckResponse)); // Another script has already loaded one of the two. Unload them both. new res = getproperty(27, YSI_gscOnClientCheckResponse); if (res == 27) { // rconfix. - YSI_SendRconCommand__("unloadfs ../scriptfiles/callbackfix"); + SendRconCommand(__const("unloadfs ../scriptfiles/callbackfix")); } else if (res == Master_ID()) { @@ -513,7 +513,7 @@ global void:Server_DoAuxRuntimeLoad() // when I originally wrote the callbackfix FS, this does mean that // we will never have any conflicts. This could also be `42` from // the old version of the AUX runtime. - YSI_SendRconCommand__("unloadfs ../scriptfiles/ysi_aux_runtime"); + SendRconCommand(__const("unloadfs ../scriptfiles/ysi_aux_runtime")); } } // Now clear to load our new version. @@ -544,7 +544,7 @@ global void:Server_DoAuxRuntimeLoad() // Always re-dump the file if we get to here. Server_DumpFile(); - YSI_SendRconCommand__("loadfs ../scriptfiles/ysi_aux_runtime"); + SendRconCommand(__const("loadfs ../scriptfiles/ysi_aux_runtime")); if (fexist("ysi_aux_runtime.amx")) { #if defined YSI_FIX_CALLBACKS @@ -588,7 +588,7 @@ Server_LoadRconFix() <_ALS : _ALS_go> stock Server_UnloadRconFix() <_ALS : _ALS_go> { - YSI_SendRconCommand__("unloadfs ../scriptfiles/ysi_aux_runtime"); + SendRconCommand(__const("unloadfs ../scriptfiles/ysi_aux_runtime")); } #if defined YSI_TESTS diff --git a/YSI_Server/y_td/y_td_entry.inc b/YSI_Server/y_td/y_td_entry.inc index 890201d1..f1a083f8 100644 --- a/YSI_Server/y_td/y_td_entry.inc +++ b/YSI_Server/y_td/y_td_entry.inc @@ -170,10 +170,10 @@ static stock //static stock TD_SetTimer(playerid, Text:td, time, revision) //{ -// YSI_SetTimerEx__("TD_HideForPlayer", time, false, "iii", playerid, _:td, revision); +// SetTimerEx(__const("TD_HideForPlayer"), time, false, __const("iii"), playerid, _:td, revision); //} -#define TD_SetTimer(%0,%1,%2,%3) YSI_SetTimerEx__("TD_HideForPlayerPub", (%2), false, "iii", (%0), _:(%1), (%3)) +#define TD_SetTimer(%0,%1,%2,%3) SetTimerEx(__const("TD_HideForPlayerPub"), (%2), false, __const("iii"), (%0), _:(%1), (%3)) /*-------------------------------------------------------------------------*//** * Text draw style to check validity of, @@ -1162,7 +1162,7 @@ stock TD_Update(Style:id, bool:pos = false) // Update the apperance after a load of updates have been applied. if (YSI_g_sTDData[id][E_TD_DATA_UPDATE] == -1) { - YSI_g_sTDData[id][E_TD_DATA_UPDATE] = YSI_SetTimerEx__("TD_UpdateInternal", 1, false, YSI_gcI, _:id); + YSI_g_sTDData[id][E_TD_DATA_UPDATE] = SetTimerEx(__const("TD_UpdateInternal"), 1, false, __const(YSI_gcI), _:id); } } @@ -1655,7 +1655,7 @@ stock TD_ShowForPlayer(playerid, Text:textDraw) }*/ if (time) { - //YSI_g_sTDTimers[textDraw][playerid] = YSI_SetTimerEx__("TD_HideForPlayer", time, false, "ii", playerid, _:textDraw); + //YSI_g_sTDTimers[textDraw][playerid] = SetTimerEx(__const("TD_HideForPlayer"), time, false, __const(YSI_gcII), playerid, _:textDraw); TD_SetTimer(playerid, textDraw, time, YSI_g_sTDDisplay[textDraw][E_TD_DISPLAY_REVISION]); } return 1; @@ -1934,8 +1934,8 @@ stock TD_Morph(Text:textDraw, Style:style, time, delay = 0) //FOREACH__ (new playerid : PS(players)) //{ //TD_MorphInternal(playerid, textDraw, style); - YSI_SetTimerEx__("TD_MorphTDInternal", delay + Y_TD_FRAME_TIME, false, "iiiiii", _:textDraw, _:TD_GetDisplayStyle(textDraw), _:style, time, Y_TD_FRAME_TIME, YSI_g_sTDDisplay[textDraw][E_TD_DISPLAY_REVISION]); //, YSI_g_sTDDisplay[textDraw][E_TD_DISPLAY_REAL]); - //YSI_SetTimerEx__("TD_MorphTDInternal", delay + Y_TD_FRAME_TIME, false, "iiiiii", _:textDraw, TD_GetDisplayStyle()); + SetTimerEx(__const("TD_MorphTDInternal"), delay + Y_TD_FRAME_TIME, false, __const("iiiiii"), _:textDraw, _:TD_GetDisplayStyle(textDraw), _:style, time, Y_TD_FRAME_TIME, YSI_g_sTDDisplay[textDraw][E_TD_DISPLAY_REVISION]); //, YSI_g_sTDDisplay[textDraw][E_TD_DISPLAY_REAL]); + //SetTimerEx(__const("TD_MorphTDInternal"), delay + Y_TD_FRAME_TIME, false, __const("iiiiii"), _:textDraw, TD_GetDisplayStyle()); //} return 1; } @@ -2050,7 +2050,7 @@ public TD_MorphTDInternal(Text:td, Style:from, Style:to, speed, pos, revision) // Even though "td" changes in the loop, the end condition is that "td" // is the same as when the loop started, meaning that it's fine to reuse // it here. - YSI_SetTimerEx__("TD_MorphTDInternal", Y_TD_FRAME_TIME, false, "iiiiii", _:td, _:from, _:to, speed, pos + Y_TD_FRAME_TIME, revision); + SetTimerEx(__const("TD_MorphTDInternal"), Y_TD_FRAME_TIME, false, __const("iiiiii"), _:td, _:from, _:to, speed, pos + Y_TD_FRAME_TIME, revision); } return 1; } diff --git a/YSI_Visual/y_classes/y_classes_classcontrol.inc b/YSI_Visual/y_classes/y_classes_classcontrol.inc index 53e5028f..5dd43cd5 100644 --- a/YSI_Visual/y_classes/y_classes_classcontrol.inc +++ b/YSI_Visual/y_classes/y_classes_classcontrol.inc @@ -270,7 +270,7 @@ MASTER_REHOOK__ OnPlayerSpawn(playerid) // YSI_g_sPlayerFlags[playerid] |= (e_SPAWN_FLAGS_IGNORE_ONCE); // TogglePlayerSpectating(playerid, false); // //SpawnPlayer(playerid); - // //YSI_g_sTimer[playerid] = YSI_SetTimerEx__("_Class_SpawnPlayer3", 20, false, YSI_gcI, playerid); + // //YSI_g_sTimer[playerid] = SetTimerEx(__const("_Class_SpawnPlayer3"), 20, false, __const(YSI_gcI), playerid); // //Class_TK(playerid); // } @@ -306,11 +306,11 @@ MASTER_REHOOK__ OnPlayerSpawn(playerid) // Class_Spectate(playerid); // if (YSI_g_sPlayerFlags[playerid] & (e_SPAWN_FLAGS_ENABLED)) // { - // YSI_g_sTimer[playerid] = YSI_SetTimerEx__("_Class_SpawnPlayer1", 10, false, YSI_gcI, playerid); + // YSI_g_sTimer[playerid] = SetTimerEx(__const("_Class_SpawnPlayer1"), 10, false, __const(YSI_gcI), playerid); // } // else // { - // YSI_g_sTimer[playerid] = YSI_SetTimerEx__("_Class_SpawnPlayer2", 10, false, YSI_gcI, playerid); + // YSI_g_sTimer[playerid] = SetTimerEx(__const("_Class_SpawnPlayer2"), 10, false, __const(YSI_gcI), playerid); // } // //Class_TK(playerid); // //YSI_g_sPlayerFlags[playerid] |= (e_SPAWN_FLAGS_IGNORE_ONCE); @@ -325,7 +325,7 @@ MASTER_REHOOK__ OnPlayerSpawn(playerid) // Debug_Print1("_Class_Return called: %d", playerid); // Class_ReturnToSelection(playerid); // //Class_TK(playerid); - // //YSI_g_sTimer[playerid] = YSI_SetTimerEx__("_Class_NotSpawned", 500, false, YSI_gcI, playerid); + // //YSI_g_sTimer[playerid] = SetTimerEx(__const("_Class_NotSpawned"), 500, false, __const(YSI_gcI), playerid); // } // forward _Class_NotSpawned(playerid); @@ -337,7 +337,7 @@ MASTER_REHOOK__ OnPlayerSpawn(playerid) // Class_DisableSelection(playerid); // //SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746); // //SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746); - // YSI_SetTimerEx__("_Class_Return", 10, false, YSI_gcI, playerid); + // SetTimerEx(__const("_Class_Return"), 10, false, __const(YSI_gcI), playerid); // YSI_g_sPlayerFlags[playerid] |= (e_SPAWN_FLAGS_RETURNED | e_SPAWN_FLAGS_INSTANT); // } diff --git a/YSI_Visual/y_dialog/y_dialog_impl.inc b/YSI_Visual/y_dialog/y_dialog_impl.inc index 02312bc3..86918e6f 100644 --- a/YSI_Visual/y_dialog/y_dialog_impl.inc +++ b/YSI_Visual/y_dialog/y_dialog_impl.inc @@ -109,7 +109,7 @@ stock bool:Dialog_ShowCallback(playerid, {F@_@iiiis, F@_@iis}:callback, DIALOG_S Indirect_SetMeta(callback, tag), // Works tag-safely because the compile-time tag check uses ``. YSI_g_sPlayerCallback[playerid] = callback; - return bool:Dialog_ShowPlayerNative(playerid, YSI_DIALOG_ID_1, style, title, caption, button1, button2); + return bool:ShowPlayerDialog(playerid, YSI_DIALOG_ID_1, style, __const(title), __const(caption), __const(button1), __const(button2)); } #if __COMPILER_WARNING_SUPPRESSION @@ -130,7 +130,7 @@ stock bool:Dialog_Show(playerid, DIALOG_STYLE:style, const string:title[], const { BROADCAST_FUNC__ Dialog_Set(playerid, YSI_DIALOG_ID_2); YSI_g_sPlayerCallback[playerid] = YSI_DIALOG_INVALID; - return bool:Dialog_ShowPlayerNative(playerid, YSI_DIALOG_ID_2, style, title, caption, button1, button2); + return bool:ShowPlayerDialog(playerid, YSI_DIALOG_ID_2, style, __const(title), __const(caption), __const(button1), __const(button2)); } stock bool:Dialog_Hide(playerid) @@ -140,7 +140,7 @@ stock bool:Dialog_Hide(playerid) return bool:HidePlayerDialog(playerid); #else // This almost looks like a Windows API function call! - return bool:Dialog_ShowPlayerNative(playerid, -1, DIALOG_STYLE_MSGBOX, NULL, NULL, NULL, NULL); + return bool:ShowPlayerDialog(playerid, -1, DIALOG_STYLE_MSGBOX, NULL, NULL, NULL, NULL); #endif } @@ -165,7 +165,7 @@ HOOK__ OnPlayerDisconnect(playerid, reason) #if defined HidePlayerDialog HidePlayerDialog(playerid); #else - Dialog_ShowPlayerNative(playerid, -1, DIALOG_STYLE_MSGBOX, NULL, NULL, NULL, NULL); + ShowPlayerDialog(playerid, -1, DIALOG_STYLE_MSGBOX, NULL, NULL, NULL, NULL); #endif } return 1; @@ -223,7 +223,7 @@ stock bool:Dialog_ShowPlayerDialog(playerid, dialog, DIALOG_STYLE:style, const s } BROADCAST_FUNC__ Dialog_Set(playerid, dialog); YSI_g_sPlayerCallback[playerid] = YSI_DIALOG_INVALID; - return bool:Dialog_ShowPlayerNative(playerid, dialog, style, title, caption, button1, button2); + return bool:ShowPlayerDialog(playerid, dialog, style, __const(title), __const(caption), __const(button1), __const(button2)); } #if defined _ALS_ShowPlayerDialog diff --git a/YSI_Visual/y_properties/y_properties_entry.inc b/YSI_Visual/y_properties/y_properties_entry.inc index 26649f18..8b8de2af 100644 --- a/YSI_Visual/y_properties/y_properties_entry.inc +++ b/YSI_Visual/y_properties/y_properties_entry.inc @@ -1085,7 +1085,7 @@ HOOK__ OnPlayerLeaveCPEx(playerid, cpid) else Text_SendFormat(playerid, "YSI_PROP_HOUSE_OWNED", ReturnPlayerName(owner)); } } - YSI_g_sPickupTimer[playerid] = YSI_SetTimerEx__("Property_PickupTimeCheck", 500, true, "ii", playerid, pickupid); + YSI_g_sPickupTimer[playerid] = SetTimerEx(__const("Property_PickupTimeCheck"), 500, true, __const(YSI_gcII), playerid, pickupid); } Debug_Print2("Property_OnPlayerPickUpPickup() end"); return 1; @@ -1935,7 +1935,7 @@ YCMD:buy(playerid, params[], help) } else if (YSI_g_sRebuyDelay) { - YSI_SetTimerEx__("Property_ResetRebuy", YSI_g_sRebuyDelay, false, YSI_gcI, prop); + SetTimerEx(__const("Property_ResetRebuy"), YSI_g_sRebuyDelay, false, __const(YSI_gcI), prop); #if defined _YSI_VISUAL_PICKUPS if (Property_GetOption(5, flag)) Pickup_Show(cpid, 0); diff --git a/YSI_Visual/y_races/y_races_impl.inc b/YSI_Visual/y_races/y_races_impl.inc index 97bcf736..983f2f1f 100644 --- a/YSI_Visual/y_races/y_races_impl.inc +++ b/YSI_Visual/y_races/y_races_impl.inc @@ -150,9 +150,6 @@ _Y_RACES_STATIC stock YSI_g_sCPIndex, Iterator:YSI_g_sRacePeople[MAX_RACES]; -forward Race_Countdown(race, time); -forward Race_Timeout(playerid); - loadtext core[ysi_race]; /*-------------------------------------------------------------------------*//** @@ -590,7 +587,7 @@ GLOBAL__ void:Race_SetEntry(raceid, cost) _Y_RACES_STATIC Race_Dropout(playerid) { - YSI_SetTimerEx__("Race_Timeout", (YSI_g_sRaceData[(YSI_g_sPlayerRace[playerid][E_RACE_PLAYER_RACE])][E_RACE_FLAGS] & e_RACE_FLAGS_EXIT_TIME), false, "i", playerid); + SetTimerEx(&Race_Timeout, (YSI_g_sRaceData[(YSI_g_sPlayerRace[playerid][E_RACE_PLAYER_RACE])][E_RACE_FLAGS] & e_RACE_FLAGS_EXIT_TIME), false, __const(YSI_gcI), playerid); YSI_g_sPlayerRace[playerid][E_RACE_PLAYER_RACE] |= RACE_PLAYER_OUT; YSI_g_sPlayerRace[playerid][E_RACE_PLAYER_TOUT] = GetTickCount(); } @@ -615,7 +612,7 @@ _Y_RACES_STATIC Race_Rejoin(playerid) * player fails the race. *//*------------------------------------------------------------------------**/ -public Race_Timeout(playerid) +static stock Race_Timeout(playerid) { if (YSI_g_sPlayerRace[playerid][E_RACE_PLAYER_RACE] & RACE_PLAYER_OUT) Race_Exit(playerid); } @@ -878,13 +875,13 @@ GLOBAL__ Race_Start(race) * Seconds remaining. *//*------------------------------------------------------------------------**/ -public Race_Countdown(race, time) +static stock Race_Countdown(race, time) { if (!(YSI_g_sRaceData[race][E_RACE_FLAGS] & e_RACE_FLAGS_ACTIVE)) return; if (time) { Text_Send(YSI_g_sRacers[race], $YSI_RACE_COUNTDOWN, time); - YSI_SetTimerEx__("Race_Countdown", 1000, false, "ii", race, time - 1); + SetTimerEx(&Race_Countdown, 1000, false, __const(YSI_gcII), race, time - 1); } else { diff --git a/YSI_Visual/y_zonenames/y_zonenames_entry.inc b/YSI_Visual/y_zonenames/y_zonenames_entry.inc index 48704547..30a13aa7 100644 --- a/YSI_Visual/y_zonenames/y_zonenames_entry.inc +++ b/YSI_Visual/y_zonenames/y_zonenames_entry.inc @@ -180,7 +180,7 @@ stock ZoneNames_Show(playerid, id) td = Text_GetLastID(); if (td != -1) { - YSI_SetTimerEx__(&ZoneNames_Hide, 3000, false, YSI_gcI, playerid), + SetTimerEx(&ZoneNames_Hide, 3000, false, __const(YSI_gcI), playerid), YSI_g_sZNTD[playerid] = td; } } diff --git a/YSI_Visual/y_zonepulse/y_zonepulse_impl.inc b/YSI_Visual/y_zonepulse/y_zonepulse_impl.inc index 52270599..a81c579e 100644 --- a/YSI_Visual/y_zonepulse/y_zonepulse_impl.inc +++ b/YSI_Visual/y_zonepulse/y_zonepulse_impl.inc @@ -89,13 +89,13 @@ static stock GangZoneDoPulse(playerid, zone, from, to, time, stage, delay, time2 if (stage == time) { GangZoneShowForPlayer(playerid, zone, to); - SetPVarInt(playerid, YSI_g_sTimer, YSI_SetTimerEx__(&GangZoneDoPulse, delay, false, YSI_gcIIIIIIIIIIIIIIIII, playerid, zone, from, to, time, stage, delay, time2, delay2, r0, g0, b0, a0, r1, g1, b1, a1)); + SetPVarInt(playerid, YSI_g_sTimer, SetTimerEx(&GangZoneDoPulse, delay, false, __const(YSI_gcIIIIIIIIIIIIIIIII), playerid, zone, from, to, time, stage, delay, time2, delay2, r0, g0, b0, a0, r1, g1, b1, a1)); return; } else if (stage == 0) { GangZoneShowForPlayer(playerid, zone, from); - SetPVarInt(playerid, YSI_g_sTimer, YSI_SetTimerEx__(&GangZoneDoPulse, delay2, false, YSI_gcIIIIIIIIIIIIIIIII, playerid, zone, from, to, time, 0, delay, time2, delay2, r0, g0, b0, a0, r1, g1, b1, a1)); + SetPVarInt(playerid, YSI_g_sTimer, SetTimerEx(&GangZoneDoPulse, delay2, false, __const(YSI_gcIIIIIIIIIIIIIIIII), playerid, zone, from, to, time, 0, delay, time2, delay2, r0, g0, b0, a0, r1, g1, b1, a1)); return; } if (stage > time) @@ -110,7 +110,7 @@ static stock GangZoneDoPulse(playerid, zone, from, to, time, stage, delay, time2 //Debug_Print7("GangZoneDoPulse: %d %d %x %x %x %x", playerid, zone, r & 0xFF, g & 0xFF, b & 0xFF, a & 0xFF); GangZoneShowForPlayer(playerid, zone, ((r1 * multiplier / time2 + r0) << 24) | (((g1 * multiplier / time2 + g0) & 0xFF) << 16) | (((b1 * multiplier / time2 + b0) & 0xFF) << 8) | ((a1 * multiplier / time2 + a0) & 0xFF)); //GangZoneShowForPlayer(playerid, zone, (r << 24) | ((g & 0xFF) << 16) | ((b & 0xFF) << 8) | (a & 0xFF)); - SetPVarInt(playerid, YSI_g_sTimer, YSI_SetTimerEx__(&GangZoneDoPulse, ZONE_PULSE_STAGE_TIME, false, YSI_gcIIIIIIIIIIIIIIIII, playerid, zone, from, to, time, stage, delay, time2, delay2, r0, g0, b0, a0, r1, g1, b1, a1)); + SetPVarInt(playerid, YSI_g_sTimer, SetTimerEx(&GangZoneDoPulse, ZONE_PULSE_STAGE_TIME, false, __const(YSI_gcIIIIIIIIIIIIIIIII), playerid, zone, from, to, time, stage, delay, time2, delay2, r0, g0, b0, a0, r1, g1, b1, a1)); } else { @@ -122,7 +122,7 @@ static stock GangZoneDoPulse(playerid, zone, from, to, time, stage, delay, time2 // a = a1 * stage / time + a0; //Debug_Print7("GangZoneDoPulse: %d %d %x %x %x %x", playerid, zone, r & 0xFF, g & 0xFF, b & 0xFF, a & 0xFF); GangZoneShowForPlayer(playerid, zone, ((r1 * stage / time + r0) << 24) | (((g1 * stage / time + g0) & 0xFF) << 16) | (((b1 * stage / time + b0) & 0xFF) << 8) | ((a1 * stage / time + a0) & 0xFF)); - SetPVarInt(playerid, YSI_g_sTimer, YSI_SetTimerEx__(&GangZoneDoPulse, ZONE_PULSE_STAGE_TIME, false, YSI_gcIIIIIIIIIIIIIIIII, playerid, zone, from, to, time, stage, delay, time2, delay2, r0, g0, b0, a0, r1, g1, b1, a1)); + SetPVarInt(playerid, YSI_g_sTimer, SetTimerEx(&GangZoneDoPulse, ZONE_PULSE_STAGE_TIME, false, __const(YSI_gcIIIIIIIIIIIIIIIII), playerid, zone, from, to, time, stage, delay, time2, delay2, r0, g0, b0, a0, r1, g1, b1, a1)); } return; } @@ -175,7 +175,7 @@ stock _GangZonePulse(@PlayerSet:ps, zone, from, to, time, delay = ZONE_PULSE_STA GangZoneShowForPlayer(p, zone, from); // Don't delay at the start (because that's just silly, it already is // that colour). - SetPVarInt(p, YSI_g_sTimer, YSI_SetTimerEx__(&GangZoneDoPulse, ZONE_PULSE_STAGE_TIME, false, YSI_gcIIIIIIIIIIIIIIIII, p, zone, from, to, time, 0, delay, time2, delay2, r0, g0, b0, a0, r1, g1, b1, a1)); + SetPVarInt(p, YSI_g_sTimer, SetTimerEx(&GangZoneDoPulse, ZONE_PULSE_STAGE_TIME, false, __const(YSI_gcIIIIIIIIIIIIIIIII), p, zone, from, to, time, 0, delay, time2, delay2, r0, g0, b0, a0, r1, g1, b1, a1)); } } diff --git a/YSI_Visual/y_zonepulse/y_zonepulse_tests.inc b/YSI_Visual/y_zonepulse/y_zonepulse_tests.inc index 59572cf2..599e50c6 100644 --- a/YSI_Visual/y_zonepulse/y_zonepulse_tests.inc +++ b/YSI_Visual/y_zonepulse/y_zonepulse_tests.inc @@ -256,7 +256,7 @@ static @test(.group = "y_zonepulse") GangZoneStopPulse2(playerid) { GangZonePulseForPlayer(playerid, gZone, 0xFF0000AA, 0x00FF00AA, 1000); - YSI_SetTimerEx__("GangZoneStopPulse2", 4000, false, YSI_gcI, playerid); + SetTimerEx(__const("GangZoneStopPulse2"), 4000, false, __const(YSI_gcI), playerid); ASK("Does the pulsing stop after four seconds?"); }