Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue142 proposal #180

Merged
merged 2 commits into from
Oct 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion addons/main/script_macros_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,9 @@ Macro: GVAR()
Sickboy
------------------------------------------- */
#define GVAR(var1) DOUBLES(ADDON,var1)
#define EGVAR(var1,var2) DOUBLES(DOUBLES(PREFIX,var1),var2)
#define EGVAR(var1,var2) TRIPLES(PREFIX,var1,var2)
#define QGVAR(var1) QUOTE(GVAR(var1))
#define QEGVAR(var1,var2) QUOTE(EGVAR(var1,var2))

/* -------------------------------------------
Macro: GVARMAIN()
Expand All @@ -694,6 +695,7 @@ Macro: GVARMAIN()
Sickboy
------------------------------------------- */
#define GVARMAIN(var1) GVARMAINS(PREFIX,var1)
#define QGVARMAIN(var1) QUOTE(GVARMAIN(var1))
// TODO: What's this?
#define SETTINGS DOUBLES(PREFIX,settings)
#define CREATELOGIC CREATELOGICS(PREFIX,COMPONENT)
Expand Down
100 changes: 35 additions & 65 deletions addons/main/script_macros_mission.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,66 @@

/*
Header: script_macros_mission.hpp

Description:
Modifies script_common_macros.hpp for compatiblity with missions.
Some addon specific functionality might be lost.

Authors:
Muzzleflash

Changes from script_macros_mission.hpp:
Follows Standard:
Object variables: PREFIX_COMPONENT
Main-object variables: PREFIX_main
Paths: PREFIX\COMPONENT\SCRIPTNAME.sqf
Or if CUSTOM_FOLDER is defined:
CUSTOM_FOLDER\SCRIPTNAME.sqf
CUSTOM_FOLDER\SCRIPTNAME.sqf
eg. six\sys_menu\fDate.sqf

Usage:
Define PREFIX and COMPONENT, then include this file:
#include "\x\cba\addons\main\script_macros_mission.hpp"

*/

// TODO: Alternate COMPILE_FILE macros that add e.g "mission\"
/*
CUSTOM_FOLDER

Custom folder to search for files in. Will not change variable names.
Default is PREFIX\COMPONENT

Example:
(begin example)
#define CUSTOM_FOLDER MyPackage\ScriptA
(end)

(begin example)
#define CUSTOM_FOLDER COMPONENT\functions
(end)


*/

#ifdef CUSTOM_FOLDER
#define PATHTO_SYS(var1,var2,var3) ##CUSTOM_FOLDER\##var3.sqf
#define PATHTOF_SYS(var1,var2,var3) ##CUSTOM_FOLDER\##var3
#define PATHTOF2_SYS(var1,var2,var3) ##CUSTOM_FOLDER\##var3
#else
#define PATHTO_SYS(var1,var2,var3) ##var1\##var2\##var3.sqf
#define PATHTOF_SYS(var1,var2,var3) ##var1\##var2\##var3
#define PATHTOF_SYS2(var1,var2,var3) ##var1\##var2\##var3
#endif

/************************** REMOVED ***********************/

/************************** REMOVAL OF MACROS ***********************/

#undef MAINPREFIX
#undef SUBPREFIX
#undef VERSION
#undef VERSION_AR
#undef VERSION_CONFIG

#undef MODULAR
#undef COMPONENT_T
#undef COMPONENT_M
#undef COMPONENT_S
#undef COMPONENT_C
#undef COMPONENT_F

// Missions should support paths without leading \
#undef PATHTO_SYS
#define PATHTO_SYS(var1,var2,var3) MAINPREFIX\##var1\SUBPREFIX\##var2\##var3.sqf

#undef PATHTOF2_SYS

#undef PATHTO_R
#undef PATHTO_T
#undef PATHTO_M
#undef PATHTO_S
#undef PATHTO_C
#undef PATHTO_F

#undef QPATHTO_R
#undef QPATHTO_T
#undef QPATHTO_M
#undef QPATHTO_S
#undef QPATHTO_C
#undef QPATHTO_F

#undef VERSIONING_SYS
#undef VERSIONING

Expand All @@ -74,35 +75,4 @@
#undef XEH_PRE_SINIT
#undef XEH_POST_INIT
#undef XEH_POST_CINIT
#undef XEH_POST_SINIT

/************************** ADDED *************************/

/*
CUSTOM_FOLDER

Custom folder to search for files in. Will not change variable names.
Default is PREFIX\COMPONENT

Example:
#define CUSTOM_FOLDER MyPackage\ScriptA
*/

/************************ MODIFIED ************************/
//This saves redefinition
#define COMPONENT_F COMPONENT
/* of these macros
PATHTO
COMPILE_FILE
PREP
PREPMAIN
*/

#ifdef CUSTOM_FOLDER
#define PATHTO_SYS(var1,var2,var3) ##CUSTOM_FOLDER\##var3.sqf
#define PATHTOF_SYS(var1,var2,var3) ##CUSTOM_FOLDER\##var3
#else
#define PATHTO_SYS(var1,var2,var3) ##var1\##var2\##var3.sqf
#define PATHTOF_SYS(var1,var2,var3) ##var1\##var2\##var3
#endif

#undef XEH_POST_SINIT