ACE3 icon indicating copy to clipboard operation
ACE3 copied to clipboard

Cleanup unused and undefinend functions

Open BaerMitUmlaut opened this issue 10 years ago • 11 comments

I wrote a little script that crawls all SQF, HPP and CPP files for unused and undefined functions, similar to search_undefinedFunctions.py but without the use of SQF. Public functions are already filtered as well. This is its current output:

Undefined functions:

  • [ ] ace_common_fnc_localanim
  • [ ] ace_missileguidance_fnc_checkseekerlos
  • [x] ace_refuel_fnc_canattach

Unused functions:

  • [ ] ace_captives_fnc_canfriskperson
  • [ ] ace_captives_fnc_dofriskperson
  • [ ] ace_captives_fnc_handleonunconscious
  • [ ] ace_cargo_fnc_canload
  • [x] ace_common_fnc_addactionmenueventhandler
  • [x] ace_common_fnc_addcuratorunloadeventhandler
  • [ ] ace_common_fnc_addsetting
  • [ ] ace_common_fnc_debugmodule
  • [ ] ace_common_fnc_dumpperformancecounters
  • [x] ace_common_fnc_execpersistentfnc
  • [x] ace_common_fnc_exportconfig
  • [ ] ace_common_fnc_getdefinedvariable
  • [ ] ace_common_fnc_getnumbermagazinesin
  • [x] ace_common_fnc_getselectionswithouthitpoints
  • [x] ace_common_fnc_getstaminabarcontrol
  • [ ] ace_common_fnc_modulelsdvehicles
  • [x] ace_common_fnc_owned
  • [x] ace_common_fnc_removeactionmenueventhandler
  • [x] ace_common_fnc_removecaninteractwithcondition
  • [ ] ace_common_fnc_removesyncedeventhandler
  • [ ] ace_common_fnc_requestsyncedevent
  • [ ] ace_common_fnc_showuser
  • [ ] ace_common_fnc_throttledpublicvariable
  • [ ] ace_common_fnc_translatetomodelspace
  • [ ] ace_common_fnc_translatetoweaponspace
  • [ ] ace_common_fnc_waveheightat
  • [ ] ace_fcs_fnc_getangle
  • [ ] ace_fcs_fnc_updaterangehud
  • [ ] ace_frag_fnc_addblacklist
  • [ ] ace_frag_fnc_removepfhround
  • [ ] ace_frag_fnc_removetrack
  • [ ] ace_frag_fnc_stoptracing
  • [x] ace_interact_menu_fnc_removeactionfromclass
  • [x] ace_interact_menu_fnc_removeactionfromobject
  • [ ] ace_interaction_fnc_moduleinteraction
  • [x] ace_interaction_fnc_removetag
  • [ ] ace_laser_fnc_checklos
  • [ ] ace_laser_fnc_drawvisiblelasertargets
  • [ ] ace_laser_fnc_findstrongestray
  • [ ] ace_laser_selfdesignate_fnc_getposasl
  • [ ] ace_maptools_fnc_handlemousezchanged
  • [ ] ace_medical_fnc_addunloadpatientactions
  • [ ] ace_medical_fnc_copydeadbody
  • [ ] ace_medical_fnc_handlecollisiondamage
  • [ ] ace_medical_fnc_handledamage_airway
  • [ ] ace_medical_fnc_handledamage_fractures
  • [ ] ace_medical_fnc_handledamage_internalinjuries
  • [ ] ace_missileguidance_fnc_attackprofile_air
  • [ ] ace_missileguidance_fnc_dohandoff
  • [ ] ace_missileguidance_fnc_rotatevectline
  • [ ] ace_missileguidance_fnc_rotatevectlinegetmap
  • [ ] ace_mk6mortar_fnc_dev_buildtable
  • [x] ace_refuel_fnc_makejerrycan
  • [x] ace_refuel_fnc_reset
  • [x] ace_respawn_fnc_removebody
Undefined functions:
ace_common_fnc_localanim
ace_missileguidance_fnc_checkseekerlos
ace_refuel_fnc_canattach

Unused functions:
ace_captives_fnc_canfriskperson
ace_captives_fnc_dofriskperson
ace_captives_fnc_handleonunconscious
ace_cargo_fnc_canload
ace_common_fnc_addactionmenueventhandler
ace_common_fnc_addcuratorunloadeventhandler
ace_common_fnc_addsetting
ace_common_fnc_debugmodule
ace_common_fnc_dumpperformancecounters
ace_common_fnc_execpersistentfnc
ace_common_fnc_exportconfig
ace_common_fnc_getdefinedvariable
ace_common_fnc_getnumbermagazinesin
ace_common_fnc_getselectionswithouthitpoints
ace_common_fnc_getstaminabarcontrol
ace_common_fnc_modulelsdvehicles
ace_common_fnc_owned
ace_common_fnc_removeactionmenueventhandler
ace_common_fnc_removecaninteractwithcondition
ace_common_fnc_removesyncedeventhandler
ace_common_fnc_requestsyncedevent
ace_common_fnc_showuser
ace_common_fnc_throttledpublicvariable
ace_common_fnc_translatetomodelspace
ace_common_fnc_translatetoweaponspace
ace_common_fnc_waveheightat
ace_fcs_fnc_getangle
ace_fcs_fnc_updaterangehud
ace_frag_fnc_addblacklist
ace_frag_fnc_removepfhround
ace_frag_fnc_removetrack
ace_frag_fnc_stoptracing
ace_interact_menu_fnc_removeactionfromclass
ace_interact_menu_fnc_removeactionfromobject
ace_interaction_fnc_moduleinteraction
ace_interaction_fnc_removetag
ace_laser_fnc_checklos
ace_laser_fnc_drawvisiblelasertargets
ace_laser_fnc_findstrongestray
ace_laser_selfdesignate_fnc_getposasl
ace_maptools_fnc_handlemousezchanged
ace_medical_fnc_addunloadpatientactions
ace_medical_fnc_copydeadbody
ace_medical_fnc_handlecollisiondamage
ace_medical_fnc_handledamage_airway
ace_medical_fnc_handledamage_fractures
ace_medical_fnc_handledamage_internalinjuries
ace_missileguidance_fnc_attackprofile_air
ace_missileguidance_fnc_dohandoff
ace_missileguidance_fnc_rotatevectline
ace_missileguidance_fnc_rotatevectlinegetmap
ace_mk6mortar_fnc_dev_buildtable
ace_refuel_fnc_makejerrycan
ace_refuel_fnc_reset
ace_respawn_fnc_removebody

A bunch of these can be removed, others should probably be changed to public. I can add the script to the tools if so desired, could be useful.

BaerMitUmlaut avatar Feb 24 '16 03:02 BaerMitUmlaut

I like that this ticket is 3k 404 :kappa:

can be removed immediately, remnant from agm: ace_interaction_fnc_removetag

can be removed immediately, replaced with BI body manager: ace_respawn_fnc_removebody

can be removed immediately, replaced with allinone configs (much more powerful): ace_common_fnc_exportconfig


already deprecated, will be removed with execremotefnc: ace_common_fnc_execpersistentfnc

~~Deprectae, replaced with getAllHitPointsSelection:~~ NVM, this is still usefull and already rewritten ace_common_fnc_getselectionswithouthitpoints


Debug / still needed / API: ace_common_fnc_getstaminabarcontrol ace_common_fnc_owned ace_common_fnc_removecaninteractwithcondition

Cool ideas - never used: ace_common_fnc_addactionmenueventhandler ace_common_fnc_removeactionmenueventhandler

commy2 avatar Feb 24 '16 08:02 commy2

I've updated the OP to a task list.

bux avatar Feb 24 '16 08:02 bux

addCuratorUnloadEventhandler never being used also causes FUNC(fixCrateContent) to never be used. I'll check if BI fixed the bug.

commy2 avatar Feb 24 '16 08:02 commy2

Apparently I fixed this over a year ago by setting the type to 4096 instead of 4. Now the BI mine detector is the only buged item in zeus. Good job me. https://github.com/acemod/ACE3/blob/master/addons/common/CfgWeapons.hpp#L5

commy2 avatar Feb 24 '16 09:02 commy2

ace_interact_menu_fnc_removeactionfromclass ace_interact_menu_fnc_removeactionfromobject are API

commy2 avatar Feb 24 '16 09:02 commy2

Done with everything I know.

commy2 avatar Feb 24 '16 09:02 commy2

ace_common_fnc_dumpperformancecounters is very usefull debug tool.

SzwedzikPL avatar Feb 24 '16 09:02 SzwedzikPL

ace_refuel_fnc_makejerrycan and ace_refuel_fnc_reset are there for a purpose/API. DO NOT DELETE!

ace_refuel_fnc_canattach is not defined - you can remove the entire part where it is called || {!([_target, _unit, _itemClassname] call FUNC(canAttach))}.

GitHawk avatar Feb 24 '16 22:02 GitHawk

ace_refuel_fnc_makejerrycan and ace_refuel_fnc_reset

If they are API they need to be marked as public: Yes

nicolasbadano avatar Feb 25 '16 02:02 nicolasbadano

@BaerMitUmlaut ace_refuel has been cleaned in #3411

GitHawk avatar Feb 26 '16 08:02 GitHawk

Closing due to age, inactivity or already solved. May be re-opened if the issue is still present, even better just open a new up-to-date Issue.

Mike-MF avatar Sep 11 '23 00:09 Mike-MF