From d01b7572a616c23d253f25fa922ffce7c067bcf1 Mon Sep 17 00:00:00 2001 From: abma Date: Mon, 17 Feb 2014 02:49:59 +0100 Subject: [PATCH 1/7] fix "unused var" --- CEconomy.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CEconomy.cpp b/CEconomy.cpp index 8c56b21..e6f0653 100644 --- a/CEconomy.cpp +++ b/CEconomy.cpp @@ -1067,7 +1067,6 @@ void CEconomy::tryBuildingDefense(CGroup* group) { //bool allow; int size; - float k; unitCategory incCats, excCats; buildType bt; CCoverageCell::NType layer; @@ -1096,9 +1095,9 @@ void CEconomy::tryBuildingDefense(CGroup* group) { } size = ai->coverage->getLayerSize(layer); - k = size / (ai->unittable->staticUnits.size() - size + 1.0f); +/* const float k = size / (ai->unittable->staticUnits.size() - size + 1.0f); -/* switch (ai->difficulty) { + switch (ai->difficulty) { case DIFFICULTY_EASY: allow = k < 0.11f; break; From 53375ed9cf670e7a00ba3fda86a39bc28936414c Mon Sep 17 00:00:00 2001 From: abma Date: Tue, 12 Aug 2014 02:51:47 +0200 Subject: [PATCH 2/7] link to CUtils (don't compile them) --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 690f611..50e88b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,8 @@ ### Generic native Skirmish AI config # set(mySourceDirRel "") # Common values are "" or "src" -set(additionalSources ${CUtils_SRC}) +set(additionalSources "") set(additionalCompileFlags "") -set(additionalLibraries ${LegacyCpp_AIWRAPPER_TARGET} ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY}) +set(additionalLibraries ${LegacyCpp_AIWRAPPER_TARGET} CUtils ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY}) ConfigureNativeSkirmishAI(mySourceDirRel additionalSources additionalCompileFlags additionalLibraries) From 33596c7809af5e223592117facccc595070f917e Mon Sep 17 00:00:00 2001 From: abma Date: Sat, 16 Aug 2014 15:24:30 +0200 Subject: [PATCH 3/7] E323AI: fix unused var warning --- CEconomy.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CEconomy.cpp b/CEconomy.cpp index e6f0653..0902567 100644 --- a/CEconomy.cpp +++ b/CEconomy.cpp @@ -1065,8 +1065,6 @@ void CEconomy::tryBuildingDefense(CGroup* group) { if (mstall || estall) return; - //bool allow; - int size; unitCategory incCats, excCats; buildType bt; CCoverageCell::NType layer; @@ -1094,8 +1092,10 @@ void CEconomy::tryBuildingDefense(CGroup* group) { excCats = ANTIAIR|TORPEDO; } - size = ai->coverage->getLayerSize(layer); -/* const float k = size / (ai->unittable->staticUnits.size() - size + 1.0f); +/* + int size = ai->coverage->getLayerSize(layer); + const float k = size / (ai->unittable->staticUnits.size() - size + 1.0f); + bool allow; switch (ai->difficulty) { case DIFFICULTY_EASY: @@ -1107,7 +1107,8 @@ void CEconomy::tryBuildingDefense(CGroup* group) { case DIFFICULTY_HARD: allow = k < 0.51f; break; - }*/ + } +*/ buildOrAssist(*group, bt, incCats, excCats); } From edc03b91e4401fcb5898b85018867520f03dee19 Mon Sep 17 00:00:00 2001 From: abma Date: Mon, 18 Aug 2014 08:32:33 +0200 Subject: [PATCH 4/7] unused var --- CEconomy.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CEconomy.cpp b/CEconomy.cpp index 0902567..edb8d50 100644 --- a/CEconomy.cpp +++ b/CEconomy.cpp @@ -1067,18 +1067,18 @@ void CEconomy::tryBuildingDefense(CGroup* group) { unitCategory incCats, excCats; buildType bt; - CCoverageCell::NType layer; +// CCoverageCell::NType layer; if (ai->intel->getEnemyCount(AIR) > 0 && rng.RandFloat() > 0.66f) { bt = BUILD_AA_DEFENSE; - layer = CCoverageCell::DEFENSE_ANTIAIR; +// layer = CCoverageCell::DEFENSE_ANTIAIR; // TODO: replace STATIC with DEFENSE after all config files updated incCats = STATIC|ANTIAIR; excCats = TORPEDO; } else if (ai->gamemap->IsWaterMap() && rng.RandFloat() > 0.5f) { bt = BUILD_UW_DEFENSE; - layer = CCoverageCell::DEFENSE_UNDERWATER; +// layer = CCoverageCell::DEFENSE_UNDERWATER; // TODO: replace STATIC with DEFENSE after all config files updated incCats = STATIC|TORPEDO; // NOTE: we do not support coastal torpedo launchers @@ -1087,7 +1087,7 @@ void CEconomy::tryBuildingDefense(CGroup* group) { else { bt = BUILD_AG_DEFENSE; - layer = CCoverageCell::DEFENSE_GROUND; +// layer = CCoverageCell::DEFENSE_GROUND; incCats = ATTACKER|DEFENSE; excCats = ANTIAIR|TORPEDO; } From 06b6bc33a9bcd58434d3a3c09dc2f2e771b384d4 Mon Sep 17 00:00:00 2001 From: abma Date: Thu, 7 May 2015 02:38:05 +0200 Subject: [PATCH 5/7] remove unused backwards compat code --- CScopedTimer.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/CScopedTimer.h b/CScopedTimer.h index 102899a..935922b 100644 --- a/CScopedTimer.h +++ b/CScopedTimer.h @@ -12,12 +12,6 @@ #include "headers/HAIInterface.h" #include "headers/HEngine.h" -#if (BOOST_VERSION >= 105000) // boost 1.50 renamed TIME_UTC to TIME_UTC_ - #define boost_TIME_UTC_override boost::TIME_UTC_ -#else - #define boost_TIME_UTC_override boost::TIME_UTC -#endif - #define PROFILE(x) CScopedTimer t(std::string(#x), ai->cb); // Time interval in logic frames (1 min) @@ -42,7 +36,7 @@ class CScopedTimer { static unsigned int GetEngineRuntimeMSec() { boost::xtime t; - boost::xtime_get(&t, boost_TIME_UTC_override); + boost::xtime_get(&t, boost::TIME_UTC_); const unsigned int milliSeconds = t.sec * 1000 + (t.nsec / 1000000); return milliSeconds; } From 3f435deab00195dce13fe249629e719bfb128ac5 Mon Sep 17 00:00:00 2001 From: abma Date: Thu, 7 May 2015 02:38:50 +0200 Subject: [PATCH 6/7] remove __DATE__ macro (reproducible builds) --- headers/Defines.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/headers/Defines.h b/headers/Defines.h index c2aeba8..437c08c 100644 --- a/headers/Defines.h +++ b/headers/Defines.h @@ -16,7 +16,7 @@ /* AI meta data */ #define AI_VERSION_NR aiexport_getVersion() #define AI_NAME std::string("E323AI") -#define AI_VERSION AI_NAME + " " + AI_VERSION_NR + " - High Templar (" + __DATE__ + ")" +#define AI_VERSION AI_NAME + " " + AI_VERSION_NR + " - High Templar" #define AI_CREDITS "Error323 & Simon Logic" #define AI_NOTES "This A.I. mainly focusses on the XTA and BA mods" From d0e4236cfdb35cca857e987eebc2779c5c1692c2 Mon Sep 17 00:00:00 2001 From: abma Date: Thu, 7 May 2015 03:06:23 +0200 Subject: [PATCH 7/7] Revert "remove unused backwards compat code" This reverts commit 06b6bc33a9bcd58434d3a3c09dc2f2e771b384d4. oops, it is still used! --- CScopedTimer.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CScopedTimer.h b/CScopedTimer.h index 935922b..102899a 100644 --- a/CScopedTimer.h +++ b/CScopedTimer.h @@ -12,6 +12,12 @@ #include "headers/HAIInterface.h" #include "headers/HEngine.h" +#if (BOOST_VERSION >= 105000) // boost 1.50 renamed TIME_UTC to TIME_UTC_ + #define boost_TIME_UTC_override boost::TIME_UTC_ +#else + #define boost_TIME_UTC_override boost::TIME_UTC +#endif + #define PROFILE(x) CScopedTimer t(std::string(#x), ai->cb); // Time interval in logic frames (1 min) @@ -36,7 +42,7 @@ class CScopedTimer { static unsigned int GetEngineRuntimeMSec() { boost::xtime t; - boost::xtime_get(&t, boost::TIME_UTC_); + boost::xtime_get(&t, boost_TIME_UTC_override); const unsigned int milliSeconds = t.sec * 1000 + (t.nsec / 1000000); return milliSeconds; }