From 601432daa784ef80a298a6346b0ee98065ef4934 Mon Sep 17 00:00:00 2001 From: jonpas Date: Tue, 7 Feb 2017 04:09:50 +0100 Subject: [PATCH] Update Makefile, Place includes in include folder --- .editorconfig | 3 ++ Makefile | 21 +++++++------- .../cba/addons/main/script_macros_common.hpp | 29 ++++++++++++++++--- .../x}/cba/addons/xeh/script_xeh.hpp | 12 ++++++-- tools/cba/addons/main/$PBOPREFIX$ | 1 - tools/cba/addons/xeh/$PBOPREFIX$ | 1 - 6 files changed, 49 insertions(+), 18 deletions(-) rename {tools => include/x}/cba/addons/main/script_macros_common.hpp (98%) rename {tools => include/x}/cba/addons/xeh/script_xeh.hpp (91%) delete mode 100644 tools/cba/addons/main/$PBOPREFIX$ delete mode 100644 tools/cba/addons/xeh/$PBOPREFIX$ diff --git a/.editorconfig b/.editorconfig index af1c2ff314..e4ab4a9fd3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,3 +10,6 @@ trim_trailing_whitespace = true [*.md] trim_trailing_whitespace = false + +[Makefile] +indent_style = tab diff --git a/Makefile b/Makefile index 4d6811a8dc..804a4a5744 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,14 @@ -MAJOR = $(shell grep "^\#define[[:space:]]*MAJOR" addons/main/script_mod.hpp | egrep -m 1 -o '[[:digit:]]+') -MINOR = $(shell grep "^\#define[[:space:]]*MINOR" addons/main/script_mod.hpp | egrep -m 1 -o '[[:digit:]]+') -PATCH = $(shell grep "^\#define[[:space:]]*PATCHLVL" addons/main/script_mod.hpp | egrep -m 1 -o '[[:digit:]]+') -BUILD = $(shell grep "^\#define[[:space:]]*BUILD" addons/main/script_mod.hpp | egrep -m 1 -o '[[:digit:]]+') -VERSION = $(MAJOR).$(MINOR).$(PATCH) -VERSION_FULL = $(VERSION).$(BUILD) PREFIX = ace BIN = @ace ZIP = ace3 -CBA = tools/cba -FLAGS = -i $(CBA) -w unquoted-string -w redefinition-wo-undef +FLAGS = -i include -w unquoted-string -w redefinition-wo-undef + +MAJOR = $(shell grep "^\#define[[:space:]]*MAJOR" addons/main/script_version.hpp | egrep -m 1 -o '[[:digit:]]+') +MINOR = $(shell grep "^\#define[[:space:]]*MINOR" addons/main/script_version.hpp | egrep -m 1 -o '[[:digit:]]+') +PATCH = $(shell grep "^\#define[[:space:]]*PATCHLVL" addons/main/script_version.hpp | egrep -m 1 -o '[[:digit:]]+') +BUILD = $(shell grep "^\#define[[:space:]]*BUILD" addons/main/script_version.hpp | egrep -m 1 -o '[[:digit:]]+') +VERSION = $(MAJOR).$(MINOR).$(PATCH) +VERSION_FULL = $(VERSION).$(BUILD) $(BIN)/addons/$(PREFIX)_%.pbo: addons/% @mkdir -p $(BIN)/addons @@ -28,7 +28,7 @@ all: $(patsubst addons/%, $(BIN)/addons/$(PREFIX)_%.pbo, $(wildcard addons/*)) \ $(patsubst optionals/%, $(BIN)/optionals/$(PREFIX)_%.pbo, $(wildcard optionals/*)) filepatching: - "$(MAKE)" $(MAKEFLAGS) FLAGS="-i $(CBA) -w unquoted-string -p" + "$(MAKE)" $(MAKEFLAGS) FLAGS="-w unquoted-string -p" $(BIN)/keys/%.biprivatekey: @mkdir -p $(BIN)/keys @@ -60,7 +60,8 @@ release: @"$(MAKE)" clean @"$(MAKE)" $(MAKEFLAGS) signatures @echo " ZIP ace3_$(VERSION).zip" - @cp *.dll LICENSE README.md AUTHORS.txt logo_ace3_ca.paa mod.cpp meta.cpp $(BIN) + @cp *.dll AUTHORS.txt LICENSE logo_ace3_ca.paa meta.cpp mod.cpp README.md docs/README_DE.md docs/README_PL.md $(BIN) + @cp -r optionals/userconfig $(BIN)/optionals @zip -r $(ZIP)_$(VERSION).zip $(BIN) &> /dev/null .PHONY: release diff --git a/tools/cba/addons/main/script_macros_common.hpp b/include/x/cba/addons/main/script_macros_common.hpp similarity index 98% rename from tools/cba/addons/main/script_macros_common.hpp rename to include/x/cba/addons/main/script_macros_common.hpp index a847909490..ef17ca1d41 100644 --- a/tools/cba/addons/main/script_macros_common.hpp +++ b/include/x/cba/addons/main/script_macros_common.hpp @@ -354,6 +354,27 @@ Author: ------------------------------------------- */ #define MESSAGE_WITH_TITLE(TITLE,MESSAGE) LOG_SYS_FILELINENUMBERS(TITLE,MESSAGE) +/* ------------------------------------------- +Macro: RETDEF() + If a variable is undefined, return the default value. Otherwise, return the + variable itself. + +Parameters: + VARIABLE - the variable to check + DEFAULT_VALUE - the default value to use if variable is undefined + +Example: + (begin example) + // _var is undefined + hintSilent format ["_var=%1", RETDEF(_var,5)]; // "_var=5" + _var = 7; + hintSilent format ["_var=%1", RETDEF(_var,5)]; // "_var=7" + (end example) +Author: + 654wak654 +------------------------------------------- */ +#define RETDEF(VARIABLE,DEFAULT_VALUE) (if (isNil {VARIABLE}) then [{DEFAULT_VALUE}, {VARIABLE}]) + /* ------------------------------------------- Macro: RETNIL() If a variable is undefined, return the value nil. Otherwise, return the @@ -365,13 +386,13 @@ Parameters: Example: (begin example) // _var is undefined - hintSilent format ["_var=%1", RETNIL(_var) ]; // "_var=any" + hintSilent format ["_var=%1", RETNIL(_var)]; // "_var=any" (end example) Author: Alef (see CBA issue #8514) ------------------------------------------- */ -#define RETNIL(VARIABLE) if (isNil{VARIABLE}) then {nil} else {VARIABLE} +#define RETNIL(VARIABLE) RETDEF(VARIABLE,nil) /* ------------------------------------------- Macros: TRACE_n() @@ -1039,7 +1060,7 @@ Parameters: Author: Spooner ------------------------------------------- */ -#define IS_META_SYS(VAR,TYPE) (if (isNil {VAR}) then { false } else { (VAR) isEqualType TYPE }) +#define IS_META_SYS(VAR,TYPE) (if (isNil {VAR}) then {false} else {(VAR) isEqualType TYPE}) #define IS_ARRAY(VAR) IS_META_SYS(VAR,[]) #define IS_BOOL(VAR) IS_META_SYS(VAR,false) #define IS_CODE(VAR) IS_META_SYS(VAR,{}) @@ -1057,7 +1078,7 @@ Author: #define IS_BOOLEAN(VAR) IS_BOOL(VAR) #define IS_FUNCTION(VAR) IS_CODE(VAR) -#define IS_INTEGER(VAR) if ( IS_SCALAR(VAR) ) then { (floor(VAR) == (VAR)) } else { false } +#define IS_INTEGER(VAR) (if (IS_SCALAR(VAR)) then {floor (VAR) == (VAR)} else {false}) #define IS_NUMBER(VAR) IS_SCALAR(VAR) #define FLOAT_TO_STRING(num) (str parseNumber (str (_this%_this) + str floor abs _this) + "." + (str (abs _this-floor abs _this) select [2]) + "0") diff --git a/tools/cba/addons/xeh/script_xeh.hpp b/include/x/cba/addons/xeh/script_xeh.hpp similarity index 91% rename from tools/cba/addons/xeh/script_xeh.hpp rename to include/x/cba/addons/xeh/script_xeh.hpp index ef62f1df53..7a1b59d266 100644 --- a/tools/cba/addons/xeh/script_xeh.hpp +++ b/include/x/cba/addons/xeh/script_xeh.hpp @@ -50,7 +50,11 @@ weaponAssembled = "{_this call _x} forEach ((_this select 0) getVariable ""cba_x weaponDisassembled = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_weaponDisassembled"")"; \ weaponDeployed = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_weaponDeployed"")"; \ weaponRested = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_weaponRested"")"; \ -reloaded = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_reloaded"")"; +reloaded = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_reloaded"")"; \ +firedMan = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_firedMan"")"; \ +turnIn = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_turnIn"")"; \ +turnOut = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_turnOut"")"; \ +deleted = "{_this call _x} forEach ((_this select 0) getVariable ""cba_xeh_deleted"")"; /* @@ -99,4 +103,8 @@ weaponAssembled = ""; \ weaponDisassembled = ""; \ weaponDeployed = ""; \ weaponRested = ""; \ -reloaded = ""; +reloaded = ""; \ +firedMan = ""; \ +turnIn = ""; \ +turnOut = ""; \ +deleted = ""; diff --git a/tools/cba/addons/main/$PBOPREFIX$ b/tools/cba/addons/main/$PBOPREFIX$ deleted file mode 100644 index 2ac6048452..0000000000 --- a/tools/cba/addons/main/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -x\cba\addons\main diff --git a/tools/cba/addons/xeh/$PBOPREFIX$ b/tools/cba/addons/xeh/$PBOPREFIX$ deleted file mode 100644 index 3f514c94c0..0000000000 --- a/tools/cba/addons/xeh/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -x\cba\addons\xeh