Skip to content

Commit

Permalink
Use the better _va syntax for all the standard stocks. And move them …
Browse files Browse the repository at this point in the history
…to be more obvious.
  • Loading branch information
Y_Less committed Apr 24, 2022
1 parent c085c3f commit d6f064c
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 64 deletions.
65 changes: 65 additions & 0 deletions YSI_Coding/y_va/y_va_entry.inc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,71 @@ Optional plugins:
#include "y_va_header"
#include "y_va_impl"

stock PlayerText:va_CreatePlayerTextDraw(playerid, Float:x, Float:y, const fmat[], GLOBAL_TAG_TYPES:...)
{
return CreatePlayerTextDraw(playerid, x, y, va_return(fmat, ___(4)));
}

stock Text:va_TextDrawCreate(Float:x, Float:y, const fmat[], GLOBAL_TAG_TYPES:...)
{
return TextDrawCreate(x, y, va_return(fmat, ___(3)));
}

stock va_TextDrawSetString(Text:text, const fmat[], GLOBAL_TAG_TYPES:...)
{
return TextDrawSetString(text, va_return(fmat, ___(2)));
}

stock va_PlayerTextDrawSetString(playerid, PlayerText:text, const fmat[], GLOBAL_TAG_TYPES:...)
{
return PlayerTextDrawSetString(playerid, text, va_return(fmat, ___(3)));
}

stock va_SendClientMessage(playerid, colour, const fmat[], GLOBAL_TAG_TYPES:...)
{
return SendClientMessage(playerid, colour, va_return(fmat, ___(3)));
}

stock va_SendClientMessageToAll(colour, const fmat[], GLOBAL_TAG_TYPES:...)
{
return SendClientMessageToAll(colour, va_return(fmat, ___(2)));
}

stock va_SendPlayerMessageToPlayer(playerid, senderid, const fmat[], GLOBAL_TAG_TYPES:...)
{
return SendPlayerMessageToPlayer(playerid, senderid, va_return(fmat, ___(3)));
}

stock va_SendPlayerMessageToAll(senderid, const fmat[], GLOBAL_TAG_TYPES:...)
{
return SendPlayerMessageToAll(senderid, va_return(fmat, ___(2)));
}

stock va_GameTextForPlayer(playerid, const fmat[], time, style, GLOBAL_TAG_TYPES:...)
{
return GameTextForPlayer(playerid, va_return(fmat, ___(4)), time, style);
}

stock va_GameTextForAll(const fmat[], time, style, GLOBAL_TAG_TYPES:...)
{
return GameTextForAll(va_return(fmat, ___(3)), time, style);
}

stock va_print(const fmat[], GLOBAL_TAG_TYPES:...)
{
return print(va_return(fmat, ___(1)));
}

stock va_fprintf(File:fhnd, const fmat[], GLOBAL_TAG_TYPES:...)
{
return fwrite(fhnd, va_return(fmat, ___(2)));
}

stock va_SendRconCommand(const command[], GLOBAL_TAG_TYPES:...)
{
return SendRconCommand(va_return(command, ___(1)));
}

#if defined YSI_TESTS
#include "y_va_tests"
#endif
Expand Down
64 changes: 0 additions & 64 deletions YSI_Coding/y_va/y_va_impl.inc
Original file line number Diff line number Diff line change
Expand Up @@ -695,67 +695,3 @@ stock va_getstring(dest[], arg, len = sizeof (dest))
#emit STACK 16
}

stock PlayerText:va_CreatePlayerTextDraw(playerid, Float:x, Float:y, const fmat[], va_args<>)
{
return CreatePlayerTextDraw(playerid, x, y, va_return(fmat, va_start<4>));
}

stock Text:va_TextDrawCreate(Float:x, Float:y, const fmat[], va_args<>)
{
return TextDrawCreate(x, y, va_return(fmat, va_start<3>));
}

stock va_TextDrawSetString(Text:text, const fmat[], va_args<>)
{
return TextDrawSetString(text, va_return(fmat, va_start<2>));
}

stock va_PlayerTextDrawSetString(playerid, PlayerText:text, const fmat[], va_args<>)
{
return PlayerTextDrawSetString(playerid, text, va_return(fmat, va_start<3>));
}

stock va_SendClientMessage(playerid, colour, const fmat[], va_args<>)
{
return SendClientMessage(playerid, colour, va_return(fmat, va_start<3>));
}

stock va_SendClientMessageToAll(colour, const fmat[], va_args<>)
{
return SendClientMessageToAll(colour, va_return(fmat, va_start<2>));
}

stock va_SendPlayerMessageToPlayer(playerid, senderid, const fmat[], va_args<>)
{
return SendPlayerMessageToPlayer(playerid, senderid, va_return(fmat, va_start<3>));
}

stock va_SendPlayerMessageToAll(senderid, const fmat[], va_args<>)
{
return SendPlayerMessageToAll(senderid, va_return(fmat, va_start<2>));
}

stock va_GameTextForPlayer(playerid, const fmat[], time, style, va_args<>)
{
return GameTextForPlayer(playerid, va_return(fmat, va_start<4>), time, style);
}

stock va_GameTextForAll(const fmat[], time, style, va_args<>)
{
return GameTextForAll(va_return(fmat, va_start<3>), time, style);
}

stock va_print(const fmat[], va_args<>)
{
return print(va_return(fmat, va_start<1>));
}

stock va_fprintf(File:fhnd, const fmat[], va_args<>)
{
return fwrite(fhnd, va_return(fmat, va_start<2>));
}

stock va_SendRconCommand(const command[], va_args<>)
{
return SendRconCommand(va_return(command, va_start<1>));
}

0 comments on commit d6f064c

Please sign in to comment.