From 1af315ebf20c51d7eca5832d94c52c1467e83c0d Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 1 Nov 2014 12:57:01 +0100 Subject: [PATCH] move magic out of kernel, into src. clean up/remove a ton of includes, especially of types.h (include in header if you need it, not in every .c file). --- src/CMakeLists.txt | 2 ++ src/alchemy.c | 1 - src/attributes/alliance.c | 1 - src/battle.c | 1 - src/battle.h | 3 +++ src/battle.test.c | 1 - src/bind_config.c | 1 - src/bind_eressea.c | 1 - src/bind_faction.c | 1 - src/bind_gmtool.c | 1 - src/bind_monsters.c | 2 -- src/bind_process.c | 11 +++++------ src/bind_settings.c | 1 - src/bind_ship.c | 1 - src/bind_storage.c | 1 - src/bind_unit.c | 2 -- src/bindings.c | 1 - src/creation.c | 1 - src/direction.test.c | 1 - src/economy.c | 2 -- src/economy.test.c | 1 - src/give.c | 1 - src/items.c | 2 +- src/items/artrewards.c | 1 - src/items/xerewards.c | 3 ++- src/json.c | 1 - src/json.test.c | 1 - src/kernel/CMakeLists.txt | 2 -- src/kernel/build.c | 1 - src/kernel/building.test.c | 1 - src/kernel/equipment.test.c | 4 ++-- src/kernel/faction.test.c | 1 - src/kernel/item.test.c | 1 - src/kernel/pool.test.c | 1 - src/kernel/ship.test.c | 1 - src/kernel/spell.test.c | 1 - src/kernel/spellbook.test.c | 2 -- src/kernel/unit.c | 1 - src/keyword.test.c | 1 - src/laws.c | 1 - src/laws.test.c | 1 - src/{kernel => }/magic.c | 1 - src/{kernel => }/magic.h | 3 +++ src/{kernel => }/magic.test.c | 4 ++-- src/main.c | 1 - src/market.test.c | 1 - src/modules/arena.c | 1 - src/modules/score.c | 1 - src/move.c | 1 - src/move.test.c | 1 - src/names.c | 1 - src/randenc.c | 1 - src/reports.h | 1 + src/reports.test.c | 1 - src/skill.test.c | 1 - src/spells.c | 2 -- src/spells/alp.c | 1 - src/spells/borders.c | 1 - src/spells/combatspells.c | 2 -- src/spells/regioncurse.c | 2 +- src/spy.c | 1 - src/study.c | 1 - src/tests.c | 1 - src/triggers/clonedied.c | 3 ++- src/triggers/shock.c | 3 ++- src/upkeep.c | 1 - 66 files changed, 26 insertions(+), 76 deletions(-) rename src/{kernel => }/magic.c (99%) rename src/{kernel => }/magic.h (99%) rename src/{kernel => }/magic.test.c (99%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a4da76513..635427916 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -83,6 +83,7 @@ set (ERESSEA_SRC give.c items.c laws.c + magic.c market.c monster.c randenc.c @@ -166,6 +167,7 @@ set(TESTS_SRC json.test.c keyword.test.c laws.test.c + magic.test.c market.test.c move.test.c skill.test.c diff --git a/src/alchemy.c b/src/alchemy.c index c9516740a..0b0a506e7 100644 --- a/src/alchemy.c +++ b/src/alchemy.c @@ -26,7 +26,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include #include #include diff --git a/src/attributes/alliance.c b/src/attributes/alliance.c index c774ef26b..b0f2c6301 100644 --- a/src/attributes/alliance.c +++ b/src/attributes/alliance.c @@ -17,7 +17,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **/ #include -#include #include "alliance.h" #include diff --git a/src/battle.c b/src/battle.c index 4d85acabd..7b2bc236b 100644 --- a/src/battle.c +++ b/src/battle.c @@ -32,7 +32,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include #include #include diff --git a/src/battle.h b/src/battle.h index 95d869ff3..89e0873b2 100644 --- a/src/battle.h +++ b/src/battle.h @@ -18,6 +18,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef H_KRNL_BATTLE #define H_KRNL_BATTLE + +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/src/battle.test.c b/src/battle.test.c index 47e0d69d8..5f0e75fbd 100644 --- a/src/battle.test.c +++ b/src/battle.test.c @@ -1,4 +1,3 @@ -#include #include #include "battle.h" diff --git a/src/bind_config.c b/src/bind_config.c index e87f65fb5..35f04eaa6 100644 --- a/src/bind_config.c +++ b/src/bind_config.c @@ -1,7 +1,6 @@ #include "bind_config.h" #include -#include #include #include #include diff --git a/src/bind_eressea.c b/src/bind_eressea.c index 664808b17..a345f6c19 100755 --- a/src/bind_eressea.c +++ b/src/bind_eressea.c @@ -5,7 +5,6 @@ #include "json.h" #include -#include #include #include diff --git a/src/bind_faction.c b/src/bind_faction.c index fafd6bc21..163685a36 100644 --- a/src/bind_faction.c +++ b/src/bind_faction.c @@ -11,7 +11,6 @@ without prior permission by the authors of Eressea. */ #include -#include #include "bind_faction.h" #include "bind_unit.h" #include "bindings.h" diff --git a/src/bind_gmtool.c b/src/bind_gmtool.c index d1111f16a..76d85281f 100644 --- a/src/bind_gmtool.c +++ b/src/bind_gmtool.c @@ -1,6 +1,5 @@ #include #include -#include #include "bind_gmtool.h" #include "gmtool.h" diff --git a/src/bind_monsters.c b/src/bind_monsters.c index 22ae645c0..dc7bc012b 100644 --- a/src/bind_monsters.c +++ b/src/bind_monsters.c @@ -1,10 +1,8 @@ #include -#include #include "spells/shipcurse.h" #include #include -#include #include #include #include diff --git a/src/bind_process.c b/src/bind_process.c index 3bcfd835b..2a036e49e 100755 --- a/src/bind_process.c +++ b/src/bind_process.c @@ -1,21 +1,20 @@ #include "bind_process.h" #include -#include #include #include -#include #include #include #include #include #include "battle.h" -#include "move.h" #include "economy.h" -#include "laws.h" -#include "market.h" -#include "study.h" #include "keyword.h" +#include "laws.h" +#include "magic.h" +#include "market.h" +#include "move.h" +#include "study.h" #define PROC_LAND_REGION 0x0001 #define PROC_LONG_ORDER 0x0002 diff --git a/src/bind_settings.c b/src/bind_settings.c index a864a242f..1224939a9 100755 --- a/src/bind_settings.c +++ b/src/bind_settings.c @@ -1,7 +1,6 @@ #include "bind_settings.h" #include -#include #include const char * settings_get(const char *key) diff --git a/src/bind_ship.c b/src/bind_ship.c index a089ab084..affc024ee 100644 --- a/src/bind_ship.c +++ b/src/bind_ship.c @@ -11,7 +11,6 @@ without prior permission by the authors of Eressea. */ #include -#include #include "bind_ship.h" #include "bind_unit.h" diff --git a/src/bind_storage.c b/src/bind_storage.c index 05f735929..8aa363d43 100644 --- a/src/bind_storage.c +++ b/src/bind_storage.c @@ -12,7 +12,6 @@ without prior permission by the authors of Eressea. #include #include -#include #include "bind_storage.h" #include diff --git a/src/bind_unit.c b/src/bind_unit.c index a7dc1cab5..58ca6cae2 100755 --- a/src/bind_unit.c +++ b/src/bind_unit.c @@ -11,7 +11,6 @@ without prior permission by the authors of Eressea. */ #include -#include #include "bind_unit.h" #ifdef BSON_ATTRIB @@ -31,7 +30,6 @@ without prior permission by the authors of Eressea. #include #include #include -#include #include #include #include diff --git a/src/bindings.c b/src/bindings.c index 1446dac15..cb7da3899 100755 --- a/src/bindings.c +++ b/src/bindings.c @@ -11,7 +11,6 @@ without prior permission by the authors of Eressea. */ #include -#include #include "bindings.h" #include "bind_unit.h" #include "bind_storage.h" diff --git a/src/creation.c b/src/creation.c index aa555d708..f8e0ae502 100644 --- a/src/creation.c +++ b/src/creation.c @@ -26,7 +26,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include #include #include diff --git a/src/direction.test.c b/src/direction.test.c index e47ab5034..66b854f5a 100644 --- a/src/direction.test.c +++ b/src/direction.test.c @@ -1,5 +1,4 @@ #include -#include #include "direction.h" #include "tests.h" diff --git a/src/economy.c b/src/economy.c index bf7e4f288..c7f7d7dce 100644 --- a/src/economy.c +++ b/src/economy.c @@ -19,7 +19,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include -#include #include "economy.h" #include "alchemy.h" @@ -38,7 +37,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include #include #include diff --git a/src/economy.test.c b/src/economy.test.c index 395f97a84..0374d4f45 100644 --- a/src/economy.test.c +++ b/src/economy.test.c @@ -1,6 +1,5 @@ #include #include -#include #include "economy.h" #include diff --git a/src/give.c b/src/give.c index a3dd08f98..2b3d0ab91 100644 --- a/src/give.c +++ b/src/give.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include diff --git a/src/items.c b/src/items.c index 4c67894ab..49d7a2652 100644 --- a/src/items.c +++ b/src/items.c @@ -4,12 +4,12 @@ #include "study.h" #include "move.h" +#include "magic.h" #include #include #include #include -#include #include #include #include diff --git a/src/items/artrewards.c b/src/items/artrewards.c index 9226bb301..d25cba68d 100644 --- a/src/items/artrewards.c +++ b/src/items/artrewards.c @@ -29,7 +29,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include /* util includes */ diff --git a/src/items/xerewards.c b/src/items/xerewards.c index 8b7978073..a0ade546a 100644 --- a/src/items/xerewards.c +++ b/src/items/xerewards.c @@ -20,6 +20,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include "xerewards.h" +#include "magic.h" + /* kernel includes */ #include #include @@ -27,7 +29,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include /* util includes */ diff --git a/src/json.c b/src/json.c index 103e530af..ec0c4febf 100644 --- a/src/json.c +++ b/src/json.c @@ -3,7 +3,6 @@ #include "json.h" -#include #include #include #include diff --git a/src/json.test.c b/src/json.test.c index 1c6d72d70..79ee2d2c9 100644 --- a/src/json.test.c +++ b/src/json.test.c @@ -3,7 +3,6 @@ #include #include -#include #include #include diff --git a/src/kernel/CMakeLists.txt b/src/kernel/CMakeLists.txt index a1ea20a64..fe95c5965 100644 --- a/src/kernel/CMakeLists.txt +++ b/src/kernel/CMakeLists.txt @@ -11,7 +11,6 @@ ship.test.c spell.test.c ally.test.c building.test.c -magic.test.c equipment.test.c curse.test.c item.test.c @@ -37,7 +36,6 @@ equipment.c faction.c group.c item.c -magic.c messages.c order.c pathfinder.c diff --git a/src/kernel/build.c b/src/kernel/build.c index 1ba9331aa..73199d94a 100644 --- a/src/kernel/build.c +++ b/src/kernel/build.c @@ -34,7 +34,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include #include #include diff --git a/src/kernel/building.test.c b/src/kernel/building.test.c index 61ca0fa1c..cd29601eb 100644 --- a/src/kernel/building.test.c +++ b/src/kernel/building.test.c @@ -1,7 +1,6 @@ #include #include -#include #include #include #include diff --git a/src/kernel/equipment.test.c b/src/kernel/equipment.test.c index 66872af0e..54bdc113f 100644 --- a/src/kernel/equipment.test.c +++ b/src/kernel/equipment.test.c @@ -1,10 +1,10 @@ #include -#include +#include "magic.h" + #include #include #include -#include #include #include diff --git a/src/kernel/faction.test.c b/src/kernel/faction.test.c index b59a46f63..34adf3ea0 100644 --- a/src/kernel/faction.test.c +++ b/src/kernel/faction.test.c @@ -2,7 +2,6 @@ #include #include -#include #include #include #include diff --git a/src/kernel/item.test.c b/src/kernel/item.test.c index 8d4285a54..a99749ec7 100644 --- a/src/kernel/item.test.c +++ b/src/kernel/item.test.c @@ -1,6 +1,5 @@ #include -#include #include #include #include diff --git a/src/kernel/pool.test.c b/src/kernel/pool.test.c index e6594bfac..9135c0bf8 100644 --- a/src/kernel/pool.test.c +++ b/src/kernel/pool.test.c @@ -1,5 +1,4 @@ #include -#include #include "ally.h" #include "pool.h" diff --git a/src/kernel/ship.test.c b/src/kernel/ship.test.c index 3b8108fca..86d0b8597 100644 --- a/src/kernel/ship.test.c +++ b/src/kernel/ship.test.c @@ -1,7 +1,6 @@ #include #include -#include #include #include #include diff --git a/src/kernel/spell.test.c b/src/kernel/spell.test.c index a75a5f377..7a10edd21 100644 --- a/src/kernel/spell.test.c +++ b/src/kernel/spell.test.c @@ -1,7 +1,6 @@ #include #include -#include #include #include diff --git a/src/kernel/spellbook.test.c b/src/kernel/spellbook.test.c index 4e4bfe779..f11f77c75 100644 --- a/src/kernel/spellbook.test.c +++ b/src/kernel/spellbook.test.c @@ -1,7 +1,5 @@ #include -#include -#include #include #include #include diff --git a/src/kernel/unit.c b/src/kernel/unit.c index 100c4dd1b..a99023919 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -18,7 +18,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include -#include #include "unit.h" #include "building.h" diff --git a/src/keyword.test.c b/src/keyword.test.c index 3f6828c76..66f5c84c6 100644 --- a/src/keyword.test.c +++ b/src/keyword.test.c @@ -1,5 +1,4 @@ #include -#include "kernel/types.h" #include "kernel/config.h" #include "kernel/order.h" #include "keyword.h" diff --git a/src/laws.c b/src/laws.c index 8128a5eb9..a64cda300 100755 --- a/src/laws.c +++ b/src/laws.c @@ -45,7 +45,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include #include #include diff --git a/src/laws.test.c b/src/laws.test.c index 6549d1bf6..65b360f6f 100644 --- a/src/laws.test.c +++ b/src/laws.test.c @@ -1,5 +1,4 @@ #include -#include #include "laws.h" #include diff --git a/src/kernel/magic.c b/src/magic.c similarity index 99% rename from src/kernel/magic.c rename to src/magic.c index 04e3adc51..5a4cc6404 100644 --- a/src/kernel/magic.c +++ b/src/magic.c @@ -19,7 +19,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include -#include #include "magic.h" #include "skill.h" diff --git a/src/kernel/magic.h b/src/magic.h similarity index 99% rename from src/kernel/magic.h rename to src/magic.h index 00a752cf3..03aee8fcb 100644 --- a/src/kernel/magic.h +++ b/src/magic.h @@ -18,6 +18,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef H_KRNL_MAGIC #define H_KRNL_MAGIC + +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/src/kernel/magic.test.c b/src/magic.test.c similarity index 99% rename from src/kernel/magic.test.c rename to src/magic.test.c index 3f134016f..300f8cd88 100644 --- a/src/kernel/magic.test.c +++ b/src/magic.test.c @@ -1,9 +1,9 @@ #include -#include +#include "magic.h" + #include #include -#include #include #include #include diff --git a/src/main.c b/src/main.c index 32a68d071..10cb2c002 100644 --- a/src/main.c +++ b/src/main.c @@ -20,7 +20,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include -#include #include #include #include "eressea.h" diff --git a/src/market.test.c b/src/market.test.c index 3670dd4f3..bb2c682ba 100644 --- a/src/market.test.c +++ b/src/market.test.c @@ -1,5 +1,4 @@ #include -#include #include "market.h" #include "tests.h" diff --git a/src/modules/arena.c b/src/modules/arena.c index 7ec4a91bd..ff752a5a4 100644 --- a/src/modules/arena.c +++ b/src/modules/arena.c @@ -32,7 +32,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include #include #include diff --git a/src/modules/score.c b/src/modules/score.c index a6b49dc58..5bad3ab68 100644 --- a/src/modules/score.c +++ b/src/modules/score.c @@ -26,7 +26,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include #include #include diff --git a/src/move.c b/src/move.c index 93c595a34..4a9bd7ba7 100644 --- a/src/move.c +++ b/src/move.c @@ -32,7 +32,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include #include #include diff --git a/src/move.test.c b/src/move.test.c index 83c7c7066..cc2571f7b 100644 --- a/src/move.test.c +++ b/src/move.test.c @@ -1,4 +1,3 @@ -#include #include #include #include "move.h" diff --git a/src/names.c b/src/names.c index 264beee3c..1fb61930f 100644 --- a/src/names.c +++ b/src/names.c @@ -24,7 +24,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include #include #include diff --git a/src/randenc.c b/src/randenc.c index d52ba1fa8..e4bd79c46 100644 --- a/src/randenc.c +++ b/src/randenc.c @@ -31,7 +31,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include #include #include diff --git a/src/reports.h b/src/reports.h index ea488f80d..cb4ab54f3 100644 --- a/src/reports.h +++ b/src/reports.h @@ -21,6 +21,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/src/reports.test.c b/src/reports.test.c index a757183e7..5f9ce5ae0 100644 --- a/src/reports.test.c +++ b/src/reports.test.c @@ -1,5 +1,4 @@ #include -#include #include "reports.h" #include diff --git a/src/skill.test.c b/src/skill.test.c index 48b293e04..08235cf89 100644 --- a/src/skill.test.c +++ b/src/skill.test.c @@ -1,5 +1,4 @@ #include -#include "kernel/types.h" #include "skill.h" #include "util/language.h" #include "tests.h" diff --git a/src/spells.c b/src/spells.c index 07b4ab0c3..daf114640 100644 --- a/src/spells.c +++ b/src/spells.c @@ -13,7 +13,6 @@ */ #include -#include #include #include "spy.h" @@ -38,7 +37,6 @@ #include #include #include -#include #include #include #include diff --git a/src/spells/alp.c b/src/spells/alp.c index 0f2901d79..82cf8c02f 100644 --- a/src/spells/alp.c +++ b/src/spells/alp.c @@ -17,7 +17,6 @@ #include #include -#include #include #include #include diff --git a/src/spells/borders.c b/src/spells/borders.c index b1288b60a..ec64d8692 100644 --- a/src/spells/borders.c +++ b/src/spells/borders.c @@ -1,5 +1,4 @@ #include -#include #include "borders.h" diff --git a/src/spells/combatspells.c b/src/spells/combatspells.c index 16bc4b71a..cb17fac85 100644 --- a/src/spells/combatspells.c +++ b/src/spells/combatspells.c @@ -11,7 +11,6 @@ */ #include #include -#include #include "combatspells.h" /* kernel includes */ @@ -20,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/src/spells/regioncurse.c b/src/spells/regioncurse.c index 5a2d9a5a6..71138ac2b 100644 --- a/src/spells/regioncurse.c +++ b/src/spells/regioncurse.c @@ -14,10 +14,10 @@ #include #include #include "regioncurse.h" +#include "magic.h" /* kernel includes */ #include -#include #include #include #include diff --git a/src/spy.c b/src/spy.c index cdf393f81..00616a47e 100644 --- a/src/spy.c +++ b/src/spy.c @@ -26,7 +26,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /* kernel includes */ #include #include -#include #include #include #include diff --git a/src/study.c b/src/study.c index f0686c766..6bc889a59 100644 --- a/src/study.c +++ b/src/study.c @@ -29,7 +29,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include #include #include diff --git a/src/tests.c b/src/tests.c index ebd8c7bf4..db9bcbc69 100644 --- a/src/tests.c +++ b/src/tests.c @@ -1,5 +1,4 @@ #include -#include #include "tests.h" #include "keyword.h" diff --git a/src/triggers/clonedied.c b/src/triggers/clonedied.c index e8b28f054..898597cbf 100644 --- a/src/triggers/clonedied.c +++ b/src/triggers/clonedied.c @@ -20,9 +20,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include "clonedied.h" +#include "magic.h" + /* kernel includes */ #include -#include #include /* util includes */ diff --git a/src/triggers/shock.c b/src/triggers/shock.c index 874c6d22b..09c3d488c 100644 --- a/src/triggers/shock.c +++ b/src/triggers/shock.c @@ -20,10 +20,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include "shock.h" +#include "magic.h" + /* kernel includes */ #include #include -#include #include #include #include diff --git a/src/upkeep.c b/src/upkeep.c index d105baed0..c807ec1d1 100644 --- a/src/upkeep.c +++ b/src/upkeep.c @@ -1,7 +1,6 @@ #include #include "upkeep.h" -#include #include #include #include