Permalink
Browse files

Merge branch 'develop'

  • Loading branch information...
rt
rt committed Sep 24, 2017
2 parents 334b5f8 + 0067dfb commit 6181e6ebbe5c3c720a31d09b92c89d761f7dcc86
Showing 1,903 changed files with 220,252 additions and 170,043 deletions.
View
@@ -0,0 +1,9 @@
+# Declare files that will always have LF line endings on checkout.
+*.cpp text eol=lf
+*.h text eol=lf
+*.c text eol=lf
+*.hpp text eol=lf
+*.cmake text eol=lf
+*.sh text eol=lf
+*.py text eol=lf
+
View
@@ -62,6 +62,7 @@ progress.make
/rts/build/vstudio10/Release with error catching
/rts/build/vstudio10/Release+MT with error catching
/rts/build/vstudio10/Syncdebug
+/_ReSharper.Caches
# Windows libraries used by spring when compiling with MinGW
# recommended: place the dir somewhere else, and specify with
@@ -141,3 +142,17 @@ progress.make
*.vcxproj.filters
*.vcxproj.user
*.pyc
+Debug/
+Release/
+RelWithDebInfo/
+x64/
+*.sln
+*.db
+Spring.VC.VC.opendb
+
+# downloaded files
+/pool
+/maps
+/rapid
+/packages
+
View
@@ -9,7 +9,7 @@
url = git://github.com/spring/Python.git
[submodule "AI/Skirmish/Shard"]
path = AI/Skirmish/Shard
- url = git://github.com/Tarendai/Shard.git
+ url = git://github.com/spring/Shard.git
[submodule "AI/Skirmish/KAIK"]
path = AI/Skirmish/KAIK
url = git://github.com/spring/KAIK.git
View
@@ -4,22 +4,35 @@ os:
sudo: required
dist: trusty
-
+cache: ccache
+
+addons:
+ coverity_scan:
+ project:
+ name: "spring/spring"
+ notification_email: ashdnazg.springrts@gmail.com
+ build_command: make engine-headless
+ branch_pattern: coverity_scan
language: cpp
compiler:
- gcc
- clang
env:
global:
- SPRING_DATADIR=~/build/spring/spring
+ # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
+ # via the "travis encrypt" command using the project repo's public key
+ # also note that forks don't get access to secure keys
+ # you have to test using a branch in the main repo
+ - secure: "QSZUdSH72Y+X73FBy6cDdhlMH3ppMewbU/LquXe/sIUdJE0LmcCFHnPayI91TTRgS8r6YXKh3DIhE9XTs1OUxmV+RUL84z85byAtotb+ukHSzlSLSGGZfrqey+/vrCXbYykfaxhazlVDfk5vx63lRYiD5lp5KLL24+PIdK6Qd5E="
matrix:
- - TARGET="AAI CppTestAI E323AI HughAI KAIK NullAI NullJavaAI NullOOJavaAI RAI Shard"
+ - TARGET="AAI CppTestAI E323AI HughAI KAIK NullAI NullJavaAI NullOOJavaAI RAI demotool"
- TARGET="engine-headless tests check"
-
matrix:
fast_finish: true
before_install:
+ - test "${TRAVIS_BRANCH}" != "coverity_scan" -o "${TRAVIS_JOB_NUMBER##*.}" = "1" || exit 0
- tools/scripts/travis_before_install.sh
install:
@@ -29,6 +42,7 @@ before_script:
- tools/scripts/travis_before_script.sh
script:
+ - test "${TRAVIS_BRANCH}" != "coverity_scan" || exit 0
- make -k $TARGET
notifications:
@@ -46,6 +46,7 @@ macro (ConfigureNativeSkirmishAI mySourceDirRel_var additionalSources_var add
# Compile the library
add_library(${myTarget} MODULE ${mySources} ${additionalSources} ${myVersionDepFile})
+ set_target_properties(${myTarget} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data)
FixLibName(${myTarget})
Add_Dependencies(${myTarget} generateVersionFiles)
@@ -110,6 +111,7 @@ if (BUILD_${myName}_AIINTERFACE)
"${mySourceDir}/SSkirmishAISpecifier.cpp"
)
add_library(${myTarget} MODULE ${mySources} ${ai_common_SRC} ${myVersionDepFile})
+ set_target_properties(${myTarget} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data)
target_link_libraries(${myTarget} CUtils)
FixLibName(${myTarget})
@@ -9,8 +9,7 @@
#include "ExternalAI/Interface/SAIInterfaceLibrary.h"
#include "ExternalAI/Interface/SSkirmishAILibrary.h"
#include "ExternalAI/Interface/SAIInterfaceCallback.h"
-
-#include "System/Util.h"
+#include "System/StringUtil.h"
CInterface::CInterface(int interfaceId, const SAIInterfaceCallback* callback):
interfaceId(interfaceId),
@@ -20,7 +20,7 @@
#include "SSkirmishAISpecifier.h"
-#include "System/maindefines.h"
+#include "System/MainDefines.h"
#include "System/SafeCStrings.h"
#include <string.h>
@@ -19,18 +19,6 @@
# "{abs-path-to-spring-writable-data-dir}/AI/Interfaces/Java/0.1"
#
-# There are two ways of specifying basic JVM options in this file:
-# 1) jvm.option.x
-# 2) jvm.option.debug.x
-# The first kind is always used, while the second is only used
-# if either one of the following is true:
-# * jvm.useDebugOptions is set to true
-# * jvm.useDebugOptions is set to auto, and a debug build
-# of the Java AI Interface native library is in use
-# possible values: auto, true, false
-# default: auto
-;jvm.useDebugOptions=true
-
# NOTE: only really usefull for debugging
# false: crash and report error when a JVM option was specified,
# that is unknonwn to the used JVM
@@ -68,8 +56,8 @@
;jvm.option.x=-Djava.library.path=...
# footprint (memory) related
-jvm.option.x=-Xms16M
-jvm.option.x=-Xmx64M
+jvm.option.x=-Xms64M
+jvm.option.x=-Xmx512M
jvm.option.x=-Xss512K
jvm.option.x=-Xoss400K
@@ -78,23 +66,21 @@ jvm.option.x=-Xoss400K
;jvm.option.x=-XX:+AlwaysRestoreFPU
;jvm.option.x=-Djava.util.logging.config.file=./logging.properties
-
+# example settings for debugging
# logging related (only recommended when debugging)
-jvm.option.debug.x=-Xcheck:jni
-jvm.option.debug.x=-verbose:jni
-jvm.option.debug.x=-XX:+UnlockDiagnosticVMOptions
-jvm.option.debug.x=-XX:+LogVMOutput
-jvm.option.debug.x=-XX:LogFile=${home-dir}/log/jvm-log.xml
-
-
-# debugging related
-jvm.option.debug.x=-Xdebug
-jvm.option.debug.x=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7777
+;jvm.option.x=-Xcheck:jni
+;jvm.option.x=-verbose:jni
+;jvm.option.x=-XX:+UnlockDiagnosticVMOptions
+;jvm.option.x=-XX:+LogVMOutput
+;jvm.option.x=-XX:LogFile=${home-dir}/log/jvm-log.xml
+
+;jvm.option.x=-Xdebug
+;jvm.option.x=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7777
# disable JIT (required for debugging under the classical VM)
-;jvm.option.debug.x=-Djava.compiler=NONE
+;jvm.option.x=-Djava.compiler=NONE
# disables old JDB
-jvm.option.debug.x=-Xnoagent
+;jvm.option.x=-Xnoagent
-;jvm.option.debug.x=-XX:ErrorFile=./hs_err_pid<pid>.log
-;jvm.option.debug.x=-XX:+CheckJNICalls
+;jvm.option.x=-XX:ErrorFile=./hs_err_pid<pid>.log
+;jvm.option.x=-XX:+CheckJNICalls
@@ -544,39 +544,6 @@ static bool java_createJavaVMInitArgs(struct JavaVMInitArgs* vm_args, const stru
simpleLog_logL(LOG_LEVEL_INFO, "JVM: JNI version: %#x", jniVersion);
vm_args->version = jniVersion;
- // ### check if debug related JVM options should be used ###
- // if false, the JVM creation will fail if an
- // unknown or invalid option was specified
- bool useDebugOptions = true;
- const char* useDebugOptionsStr = "auto";
- if (jvmProps != NULL) {
- const char* useDebugOptionsFromCfg =
- util_map_getValueByKey(
- jvmProps->size, jvmProps->keys, jvmProps->values,
- "jvm.useDebugOptions");
- if (useDebugOptionsFromCfg != NULL) {
- useDebugOptionsStr = useDebugOptionsFromCfg;
- }
- }
- {
- if (strcmp(useDebugOptionsStr, "auto") == 0
- || strcmp(useDebugOptionsStr, "Auto") == 0
- || strcmp(useDebugOptionsStr, "AUTO") == 0
- || strcmp(useDebugOptionsStr, "a") == 0
- || strcmp(useDebugOptionsStr, "A") == 0)
- {
- // auto
-#if defined DEBUG
- useDebugOptions = true;
-#else // defined DEBUG
- useDebugOptions = false;
-#endif // defined DEBUG
- } else {
- // true or false
- useDebugOptions = util_strToBool(useDebugOptionsStr);
- }
- }
-
// ### check if unrecognized JVM options should be ignored ###
// if false, the JVM creation will fail if an
// unknown or invalid option was specified
@@ -673,8 +640,7 @@ static bool java_createJavaVMInitArgs(struct JavaVMInitArgs* vm_args, const stru
// ### add string options from the JVM config file with property name "jvm.option.x" ###
int i;
for (i=0; i < jvmProps->size; ++i) {
- if (strcmp(jvmProps->keys[i], "jvm.option.x") == 0 ||
- (useDebugOptions && (strcmp(jvmProps->keys[i], "jvm.option.debug.x") == 0))) {
+ if (strcmp(jvmProps->keys[i], "jvm.option.x") == 0) {
const char* const val = jvmProps->values[i];
const size_t val_size = strlen(val);
// ignore "-Djava.class.path=..."
@@ -689,8 +655,8 @@ static bool java_createJavaVMInitArgs(struct JavaVMInitArgs* vm_args, const stru
// ### ... or set default ones, if the JVM config file was not found ###
simpleLog_logL(LOG_LEVEL_WARNING, "JVM: properties file ("JVM_PROPERTIES_FILE") not found; using default options.");
- strOptions[op++] = "-Xms4M";
- strOptions[op++] = "-Xmx64M";
+ strOptions[op++] = "-Xms64M";
+ strOptions[op++] = "-Xmx512M";
strOptions[op++] = "-Xss512K";
strOptions[op++] = "-Xoss400K";
@@ -17,7 +17,7 @@
#define CURRENT_DATA_MODEL (CHAR_BIT * sizeof(void*))
#include "CUtils/SimpleLog.h"
-#include "System/maindefines.h"
+#include "System/MainDefines.h"
#include "System/SafeCStrings.h"
// implemented in the OS specific files
@@ -4,7 +4,7 @@
#include "JvmLocater_common.h"
-#include "System/maindefines.h"
+#include "System/MainDefines.h"
#include "System/SafeCStrings.h"
#include <unistd.h>
@@ -4,7 +4,7 @@
#include "JvmLocater_common.h"
-#include "System/maindefines.h"
+#include "System/MainDefines.h"
#include "System/SafeCStrings.h"
#include <windows.h>
View
@@ -27,7 +27,7 @@
#include "AAISector.h"
-#include "System/Util.h"
+#include "System/SafeUtil.h"
#include "LegacyCpp/IGlobalAICallback.h"
#include "LegacyCpp/UnitDef.h"
@@ -115,11 +115,11 @@ AAI::~AAI()
}
build_tasks.clear();
- // save mod learning data
+ // save game learning data
bt->SaveBuildTable(brain->GetGamePeriod(), map->map_type);
- SafeDelete(am);
- SafeDelete(af);
+ spring::SafeDelete(am);
+ spring::SafeDelete(af);
// delete unit groups
for(int i = 0; i <= MOBILE_CONSTRUCTOR; i++)
@@ -133,12 +133,12 @@ AAI::~AAI()
}
- SafeDelete(brain);
- SafeDelete(execute);
- SafeDelete(ut);
- SafeDelete(map);
- SafeDelete(bt);
- SafeDelete(profiler);
+ spring::SafeDelete(brain);
+ spring::SafeDelete(execute);
+ spring::SafeDelete(ut);
+ spring::SafeDelete(map);
+ spring::SafeDelete(bt);
+ spring::SafeDelete(profiler);
initialized = false;
fclose(file);
@@ -163,35 +163,25 @@ void AAI::InitAI(IGlobalAICallback* callback, int team)
// open log file
// this size equals the one used in "AIAICallback::GetValue(AIVAL_LOCATE_FILE_..."
char filename[2048];
- char buffer[500];
- char team_number[3];
-
- SNPRINTF(team_number, 3, "%d", team);
-
- STRCPY(buffer, "");
- STRCAT(buffer, AILOG_PATH);
- STRCAT(buffer, "AAI_log_team_");
- STRCAT(buffer, team_number);
- STRCAT(buffer, ".txt");
- ReplaceExtension (buffer, filename, sizeof(filename), ".txt");
+ SNPRINTF(filename, 2048, "%sAAI_log_team_%d.txt", AILOG_PATH, team);
cb->GetValue(AIVAL_LOCATE_FILE_W, filename);
file = fopen(filename,"w");
- Log("AAI %s running mod %s\n \n", AAI_VERSION, cb->GetModHumanName());
+ Log("AAI %s running game %s\n \n", AAI_VERSION, cb->GetModHumanName());
// load config file first
cfg->LoadConfig(this);
if (!cfg->initialized)
{
std::string errorMsg =
- std::string("Error: Could not load mod and/or general config file."
+ std::string("Error: Could not load game and/or general config file."
" For further information see the config file under: ") +
filename;
LogConsole("%s", errorMsg.c_str());
- throw 1;
+ return;
}
// create buildtable
@@ -418,7 +408,7 @@ void AAI::UnitFinished(int unit)
ut->units[(*task)->builder_id].cons->ConstructionFinished();
build_tasks.erase(task);
- SafeDelete(build_task);
+ spring::SafeDelete(build_task);
break;
}
}
@@ -811,7 +801,7 @@ void AAI::Update()
{
if (!(tick % 450))
{
- LogConsole("Failed to initialize AAI! Please view ai log for further information and check if AAI supports this mod");
+ LogConsole("Failed to initialize AAI! Please view ai log for further information and check if AAI supports this game");
}
return;
Oops, something went wrong.

0 comments on commit 6181e6e

Please sign in to comment.