pawn-lang / samp-stdlib

The San Andreas Multiplayer Pawn Standard Library Package - designed for the sampctl package management system.
http://sampctl.com
48 stars 30 forks source link

Const-correctness #3

Closed Y-Less closed 6 years ago

Y-Less commented 6 years ago

As in fixes.inc. Some SA:MP natives could use const more, which would allow custom functions to use const more as well. However, they don't.

I don't know if this is a comprehensive list, but:

native ApplyActorAnimation(actorid, const animlib[], const animname[], Float:fDelta, loop, lockx, locky, freeze, time);
native HTTP(index, type, const url[], const data[], const callback[]);
native SetObjectMaterial(objectid, materialindex, modelid, const txdname[], const texturename[], materialcolor = 0);
native SetPlayerObjectMaterial(playerid, objectid, materialindex, modelid, const txdname[], const texturename[], materialcolor = 0);
native SetObjectMaterialText(objectid, const text[], materialindex = 0, materialsize = OBJECT_MATERIAL_SIZE_256x128, const fontface[] = "Arial", fontsize = 24, bold = 1, fontcolor = 0xFFFFFFFF, backcolor = 0, textalignment = 0);
native SetPlayerObjectMaterialText(playerid, objectid, const text[], materialindex = 0, materialsize = OBJECT_MATERIAL_SIZE_256x128, const fontface[] = "Arial", fontsize = 24, bold = 1, fontcolor = 0xFFFFFFFF, backcolor = 0, textalignment = 0);
native PlayAudioStreamForPlayer(playerid, const url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0);
native SetPlayerShopName(playerid, const shopname[]);
native PlayerText:CreatePlayerTextDraw(playerid, Float:x, Float:y, const text[]);
native PlayerText:BAD_CreatePlayerTextDraw(playerid, Float:x, Float:y, text[]);
native PlayerTextDrawSetString(playerid, PlayerText:text, const string[]);
native SetPVarInt(playerid, const varname[], int_value);
native GetPVarInt(playerid, const varname[]);
native SetPVarString(playerid, const varname[], const string_value[]);
native GetPVarString(playerid, const varname[], string_return[], len);
native SetPVarFloat(playerid, const varname[], Float:float_value);
native Float:GetPVarFloat(playerid, const varname[]);
native DeletePVar(playerid, const varname[]);
native GetPVarType(playerid, const varname[]);
native SetPlayerChatBubble(playerid, const text[], color, Float:drawdistance, expiretime);
native ApplyAnimation(playerid, const animlib[], const animname[], Float:fDelta, loop, lockx, locky, freeze, time, forcesync = 0);
native StartRecordingPlayerData(playerid, recordtype, const recordname[]);
native SetTimer(const funcname[], interval, repeating);
native SetTimerEx(const funcname[], interval, repeating, const format[], {Float,_}:...);
native SHA256_PassHash(const password[], const salt[], ret_hash[], ret_hash_len);
native SetSVarInt(const varname[], int_value);
native GetSVarInt(const varname[]);
native SetSVarString(const varname[], const string_value[]);
native GetSVarString(const varname[], string_return[], len);
native SetSVarFloat(const varname[], Float:float_value);
native Float:GetSVarFloat(const varname[]);
native DeleteSVar(const varname[]);
native GetSVarType(const varname[]);
native ConnectNPC(const name[], const script[]);
native SendRconCommand(const command[]);
native GetPlayerVersion(playerid, version[], len);
native BlockIpAddress(const ip_address[], timems);
native UnBlockIpAddress(const ip_address[]);
native Text:TextDrawCreate(Float:x, Float:y, const text[]);
native Text:BAD_TextDrawCreate(Float:x, Float:y, text[]);
native TextDrawSetString(Text:text, const string[]);
native Text3D:Create3DTextLabel(const text[], color, Float:X, Float:Y, Float:Z, Float:DrawDistance, virtualworld, testLOS = 0);
native Update3DTextLabelText(Text3D:id, color, const text[]);
native PlayerText3D:CreatePlayer3DTextLabel(playerid, const text[], color, Float:X, Float:Y, Float:Z, Float:DrawDistance, attachedplayer = INVALID_PLAYER_ID, attachedvehicle = INVALID_VEHICLE_ID, testLOS = 0);
native UpdatePlayer3DTextLabelText(playerid, PlayerText3D:id, color, const text[]);
native ShowPlayerDialog(playerid, dialogid, style, const caption[], const info[], const button1[], const button2[]);
native DB:db_open(const name[]);
native DBResult:db_query(DB:db, const query[]);
native SetVehicleNumberPlate(vehicleid, const numberplate[]);

I just ripped that from here:

https://github.com/Open-GTO/sa-mp-fixes/blob/a2d209fe0882d18def20c7c7563135e386b056e5/fixes.inc#L4373-L4711

So it isn't sorted by library I'm afraid.

Southclaws commented 6 years ago

I've always been on the fence about changes to this repo. It might be worth opening a new branch for modified versions of the libraries (or open a branch for the originals?) and just synchronise updates.

However, it would be really nice to fix/add some things that have been missing for years. Such as IsValidVehicle and the PlayerTextDraw tag on INVALID_PLAYER_TEXTDRAW.