AtStWalker 0 Posted August 19, 2005 An include is a variable value that the engine can include in an CPP file before it sends it to the requestor. If you're creating a CPP file, you can insert an include statement in the CPP file that looks like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#include <Folder\name_of_inclusion.h> Using the include value u can replace common parts on your cpp with an external "*.h" file Basic "include" example: Quote[/b] ]BEFORE [without inclusion (A config.cpp) ]: - <span style='color:blue'>config.cpp</span>: class CfgPatches { class NewClass { units[] = {"NewClass_1","NewClass_2"}; weapons[] = {""}; requiredVersion=1.85; }; }; class CfgVehicles { class All {}; class AllVehicles: All {}; class Land: AllVehicles {}; class Man: Land {}; class Soldier: Man {}; class SoldierWB: Soldier {}; class NewClass_1: SoldierWB { displayName="Soldier 1"; model="\Folder\file_1.p3d"; weapons[]={"M16","Throw","Put"}; magazines[]={"M16","M16"}; }; class NewClass_2: SoldierWB { displayName="Soldier 2"; model="\Folder\file_2.p3d"; weapons[]={"M16","Throw","Put"}; magazines[]={"M16","M16"}; }; }; Quote[/b] ]AFTER [using include construct (A config.cpp + An ammo.h) ]: - <span style='color:blue'>config.cpp</span>: class CfgPatches { class NewClass { units[] = {"NewClass_1","NewClass_2"}; weapons[] = {""}; requiredVersion=1.85; }; }; class CfgVehicles { class All {}; class AllVehicles: All {}; class Land: AllVehicles {}; class Man: Land {}; class Soldier: Man {}; class SoldierWB: Soldier {}; class NewClass_1: SoldierWB { displayName="Soldier 1"; model="\Folder\file_1.p3d"; #include <Folder\ammo.h> }; class NewClass_2: SoldierWB { displayName="Soldier 2"; model="\Folder\file_2.p3d"; #include <Folder\ammo.h> }; }; - <span style='color:blue'>ammo.h</span>: weapons[]={"M16","Throw","Put"}; magazines[]={"M16","M16"}; At Share this post Link to post Share on other sites
.kju 3245 Posted August 19, 2005 i was aware of this already, yet thanks a lot for posting for everyone else and the search Share this post Link to post Share on other sites
vektorboson 8 Posted August 19, 2005 You can use the #include-command in the following files: - SQF-files which are loaded through preprocessFile - config.cpp (addon config) and also MOD-config (resource.cpp as well) - description.ext - mission.sqm (unbinarized): yes, here too. Using #include in the mission.sqm can help you create MP-missions, as you don't have to load up the mission editor, change and save as MP mission (and giving it a new name), but you can just change the included mission.sqm with a text-editor and you only have to stop the mission and choose the mission once again. Conclusion: Wherever BIS-config-style is used, you can use the Preprocessor (#include and #define). Btw.: The included file may have any file extension (it need not to be .h) Share this post Link to post Share on other sites
AtStWalker 0 Posted August 20, 2005 Quote[/b] ]You can use the #include-command in the following files: - SQF-files.. - description.ext - mission.sqm (unbinarized).. Ahh ok tnx a lot i'm sorry i don't know it cause i'm only an addon maker Quote[/b] ]Btw.: The included file may have any file extension (it need not to be .h) kk i've used the .h extension cause it's a C++ extension (like the *.cpp) ^^ tnx a lot Share this post Link to post Share on other sites
General Barron 0 Posted August 22, 2005 You can use the #include-command in the following files:- SQF-files which are loaded through preprocessFile - mission.sqm (unbinarized) WOW! Didn't know you could use it in those places. Might find a handy use for that info in the future Share this post Link to post Share on other sites
vektorboson 8 Posted August 22, 2005 Hehe, the include-directive is your friend, when it comes to mission and addon editing. You can change for example an addons config, without Re-PBO-ing the config. It is really lovely; I ask myself why no-one tried (or no one mentioned this) that the preprocessor-directives in the mission.sqm work, too. Share this post Link to post Share on other sites