Raised This Month: $51 Target: $400
 12% 

[*.inc] Unable to pass a constant arrays to some of the functions


  
 
 
Thread Tools Display Modes
Author Message
VEN
Veteran Member
Join Date: Jan 2005
Old 12-31-2006 , 06:45   [*.inc] Unable to pass a constant arrays to some of the functions
#1

Because not all arrays that actually are constant is marked with the const attribute.

Here is the fixed function prototypes.
Note: functions prototypes not from all includes was fixed, only the most common ones.
Code:
// amxmisc.inc stock register_menu(const title[],keys,const function[],outside=0) // amxmodx.inc forward server_changelevel(const map[]); native register_event(const event[],const function[],const flags[],const cond[]="", ... ); native show_menu(index,keys,const menu[], time = -1, const title[] = ""); native engclient_cmd(index,const command[],const arg1[]="",const arg2[]=""); native set_task(Float:time,const function[],id = 0,const parameter[]="",len = 0,const flags[]="", repeat = 0); native register_clcmd(const client_cmd[],const function[],flags=-1, const info[]=""); native register_concmd(const cmd[],const function[],flags=-1, const info[]=""); native register_srvcmd(const server_cmd[],const function[],flags=-1, const info[]=""); native emit_sound(index, channel, const sample[], Float:vol, Float:att,flags, pitch); native pause(const flag[], const param1[]="",const param2[]=""); native unpause(const flag[], const param1[]="",const param2[]=""); native force_unmodified(force_type, const mins[3] , const maxs[3], const filename[]); native set_string(param, const dest[], maxlen); native set_array(param, const source[], size); native set_array_f(param, const Float:source[], size); native menu_create(const title[], const handler[], ml=0); native menu_makecallback(const function[]); native menu_item_setname(menu, item, const name[]); native menu_item_setcmd(menu, item, const cmd[]); // cstrike.inc native cs_set_user_defuse(index, defusekit = 1, r = 0, g = 160, b = 0, const icon[] = "defuser", flash = 0); // engine.inc native register_impulse(impulse, const function[]); native register_touch(const Touched[], const Toucher[], const function[]); native register_think(const Classname[], const function[]); native precache_event(type, const Name[], {Float,Sql,Result,_}:...); native entity_set_size(index, const Float:mins[3], const Float:maxs[3]); native entity_set_vector(iIndex, iKey, const Float:vNewVector[3]); native create_entity(const szClassname[]); native find_ent_by_class(iIndex, const szClass[]); native find_ent_by_owner(iIndex, const szClass[], iOwner, iJghgType=0); native find_ent_by_target(iIndex, const szClass[]); native find_ent_by_tname(iIndex, const szClass[]); native find_ent_by_model(iIndex, const szClass[], const szModel[]); native find_ent_in_sphere(start_from_ent, const Float:origin[3], Float:radius); native entity_set_origin(iIndex, const Float:fNewOrigin[3]); native radius_damage(const Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier); native point_contents(const Float:fCheckAt[3]); native trace_line(iIgnoreEnt, const Float:fStart[3], const Float:fEnd[3], Float:vReturn[3]); native trace_hull(const Float:origin[3],hull,ignoredent=0,ignoremonsters=0); native trace_normal(iIgnoreEnt, const Float:fStart[3], const Float:fEnd[3], Float:vReturn[3]); native get_grenade_id(id, const model[], len, grenadeid = 0); native playback_event(flags,invoker,eventindex,Float:delay,const Float:origin[3],const Float:angles[3],Float:fparam1,Float:fparam2,iparam1,iparam2,bparam1,bparam2); forward pfn_playbackevent(flags, entid, eventid, Float:delay, const Float:Origin[3], const Float:Angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2); native find_sphere_class(aroundent, const _lookforclassname[], Float:radius, entlist[], maxents, const Float:origin[3] = {0.0, 0.0, 0.0}); native is_in_viewcone(entity, const Float:origin[3]); native trace_forward(const Float:start[3], const Float:angle[3], Float:give, ignoreEnt, &Float:hitX, &Float:hitY, &Float:shortestDistance, &Float:shortestDistLow, &Float:shortestDistHigh); // engine_stocks.inc stock fakedamage(idvictim,const szClassname[],Float:takedmgdamage,damagetype) stock find_ent(iStart, const szClassname[]) stock remove_entity_name(const eName[]) stock set_user_velocity(entity, const Float:vec[3]) stock RadiusDamage(const Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier) stock PointContents(const Float:fCheckAt[3]) stock set_size(index, const Float:mins[3], const Float:maxs[3]) // fakemeta.inc native register_forward(_forwardType,const _function[],_post=0); // fun.inc native set_user_origin(index, const origin[3]); // message_stocks.inc stock make_deathmsg(killer,victim,headshot,const weapon[]) // string.inc stock bool:is_str_num(const sString[]) stock split(const szInput[], szLeft[], pL_Max, szRight[], pR_Max, szDelim[]) stock remove_filepath(const szFilePath[], szFile[], pMax) stock replace_all(string[], len, const what[], const with[]) // vector.inc native get_distance(const origin1[3],const origin2[3]); native Float:get_distance_f(const Float:Origin1[3], const Float:Origin2[3]); native velocity_by_aim(iIndex, iVelocity, Float:vRetValue[3]); native vector_to_angle(const Float:fVector[3], Float:vReturn[3]); native angle_vector(const Float:vector[3], FRU, Float:ret[3]); native Float:vector_length(const Float:vVector[3]); native Float:vector_distance(const Float:vVector[3], const Float:vVector2[3]);
VEN is offline
BAILOPAN
Join Date: Jan 2004
Old 12-31-2006 , 12:40   Re: [*.inc] Unable to pass a constant arrays to some of the functions
#2

EDIT: Before doing anything like this, I'd need to make sure there are no usages were backwards compatibility would break. But I think for most of these it would be okay.
__________________
egg

Last edited by BAILOPAN; 12-31-2006 at 12:43.
BAILOPAN is offline
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 12-31-2006 , 13:09   Re: [*.inc] Unable to pass a constant arrays to some of the functions
#3

Most everything in messages.inc should be declared const as well
__________________
fyren sucks
sawce is offline
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 01-22-2007 , 01:56   Re: [*.inc] Unable to pass a constant arrays to some of the functions
#4

Committed a fix as revision 3242.

I went through every include file (ugh) and checked everything. It *should* all be good; leaving open in-case I missed something.

However, I left out the forwards being declared const. That would probably mess with some scripts.
__________________
fyren sucks

Last edited by sawce the snail; 01-22-2007 at 02:03.
sawce is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:56.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode