[Orxonox-commit 1322] r6040 - in sandbox_light: . bin cmake data doc/api src src/external/ogremath src/external/tolua src/libraries src/libraries/core src/libraries/util src/orxonox
rgrieder at orxonox.net
rgrieder at orxonox.net
Thu Nov 5 22:15:05 CET 2009
Author: rgrieder
Date: 2009-11-05 22:15:05 +0100 (Thu, 05 Nov 2009)
New Revision: 6040
Added:
sandbox_light/src/libraries/core/CommandLineParser.cc
sandbox_light/src/libraries/core/CommandLineParser.h
sandbox_light/src/libraries/core/PathConfig.cc
sandbox_light/src/libraries/core/PathConfig.h
sandbox_light/src/libraries/util/Clock.cc
sandbox_light/src/libraries/util/Clock.h
Removed:
sandbox_light/src/libraries/core/Clock.cc
sandbox_light/src/libraries/core/Clock.h
sandbox_light/src/libraries/core/CommandLine.cc
sandbox_light/src/libraries/core/CommandLine.h
Modified:
sandbox_light/
sandbox_light/bin/vld.ini.in
sandbox_light/cmake/CompilerConfigMSVC.cmake
sandbox_light/cmake/LibraryConfig.cmake
sandbox_light/cmake/PackageConfig.cmake
sandbox_light/cmake/ParseMacroArguments.cmake
sandbox_light/cmake/PrecompiledHeaderFiles.cmake
sandbox_light/cmake/SourceFileUtilities.cmake
sandbox_light/cmake/TargetUtilities.cmake
sandbox_light/data/CMakeLists.txt
sandbox_light/doc/api/doxy.config.in
sandbox_light/src/Orxonox.cc
sandbox_light/src/OrxonoxConfig.cmake
sandbox_light/src/external/ogremath/CMakeLists.txt
sandbox_light/src/external/tolua/CMakeLists.txt
sandbox_light/src/libraries/CMakeLists.txt
sandbox_light/src/libraries/core/CMakeLists.txt
sandbox_light/src/libraries/core/Core.cc
sandbox_light/src/libraries/core/Core.h
sandbox_light/src/libraries/core/CorePrereqs.h
sandbox_light/src/libraries/core/LuaState.cc
sandbox_light/src/libraries/util/CMakeLists.txt
sandbox_light/src/libraries/util/UtilPrereqs.h
sandbox_light/src/orxonox/Main.cc
sandbox_light/src/orxonox/OrxonoxPrereqs.h
Log:
Also synchronised sandbox_light with current trunk.
Property changes on: sandbox_light
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/resource2:3372-5694
code/branches/buildsystem:1874-2276,2278-2400
code/branches/buildsystem2:2506-2658
code/branches/buildsystem3:2662-2708
code/branches/ceguilua:1802-1808
code/branches/core3:1572-1739
code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
code/branches/gametypes:2826-3031
code/branches/gcc43:1580
code/branches/gui:1635-1723,2795-2894
code/branches/input:1629-1636
code/branches/lodfinal:2372-2411
code/branches/map:2801-3086,3089
code/branches/miniprojects:2754-2824
code/branches/netp2:2835-2988
code/branches/netp3:2988-3082
code/branches/netp6:3214-3302
code/branches/network:2356
code/branches/network64:2210-2355
code/branches/objecthierarchy:1911-2085,2100,2110-2169
code/branches/objecthierarchy2:2171-2479
code/branches/overlay:2117-2385
code/branches/particles:2829-3085
code/branches/pch:3113-3194
code/branches/physics:1912-2055,2107-2439
code/branches/physics_merge:2436-2457
code/branches/pickups:1926-2086,2127,2827-2915
code/branches/pickups2:2107-2497,2915-3071
code/branches/presentation:2369-2652,2654-2660
code/branches/questsystem:1894-2088
code/branches/questsystem2:2107-2259
code/branches/questsystem5:2776-2905
code/branches/resource:3327-3366
code/branches/script_trigger:1295-1953,1955
code/branches/sound:2829-3010
code/branches/weapon:1925-2094
code/branches/weapon2:2107-2488
code/branches/weapons:2897-3051
code/branches/weaponsystem:2742-2890
+ /code/branches/core5:5768-5928
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/resource2:3372-5694
/code/trunk:5794-6035
/sandbox:6038-6039
code/branches/buildsystem:1874-2276,2278-2400
code/branches/buildsystem2:2506-2658
code/branches/buildsystem3:2662-2708
code/branches/ceguilua:1802-1808
code/branches/core3:1572-1739
code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
code/branches/gametypes:2826-3031
code/branches/gcc43:1580
code/branches/gui:1635-1723,2795-2894
code/branches/input:1629-1636
code/branches/lodfinal:2372-2411
code/branches/map:2801-3086,3089
code/branches/miniprojects:2754-2824
code/branches/netp2:2835-2988
code/branches/netp3:2988-3082
code/branches/netp6:3214-3302
code/branches/network:2356
code/branches/network64:2210-2355
code/branches/objecthierarchy:1911-2085,2100,2110-2169
code/branches/objecthierarchy2:2171-2479
code/branches/overlay:2117-2385
code/branches/particles:2829-3085
code/branches/pch:3113-3194
code/branches/physics:1912-2055,2107-2439
code/branches/physics_merge:2436-2457
code/branches/pickups:1926-2086,2127,2827-2915
code/branches/pickups2:2107-2497,2915-3071
code/branches/presentation:2369-2652,2654-2660
code/branches/questsystem:1894-2088
code/branches/questsystem2:2107-2259
code/branches/questsystem5:2776-2905
code/branches/resource:3327-3366
code/branches/script_trigger:1295-1953,1955
code/branches/sound:2829-3010
code/branches/weapon:1925-2094
code/branches/weapon2:2107-2488
code/branches/weapons:2897-3051
code/branches/weaponsystem:2742-2890
Modified: sandbox_light/bin/vld.ini.in
===================================================================
--- sandbox_light/bin/vld.ini.in 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/bin/vld.ini.in 2009-11-05 21:15:05 UTC (rev 6040)
@@ -55,7 +55,7 @@
; Valid Values: Any list containing module names (i.e. names of EXEs or DLLs).
; Default: None.
;
-ForceIncludeModules =
+ForceIncludeModules = boost_date_time-vc80-mt-gd-1_39.dll, boost_filesystem-vc80-mt-gd-1_39.dll, boost_system-vc80-mt-gd-1_39.dll, boost_thread-vc80-mt-gd-1_39.dll, enet_d.dll, lua_d.dll, ogg_d.dll, vorbis_d.dll, vorbifile_d.dll
; Maximum number of data bytes to display for each leaked block. If zero, then
; the data dump is completely suppressed and only call stacks are shown.
@@ -65,7 +65,7 @@
; Value Values: 0 - 4294967295
; Default: 4294967295
;
-MaxDataDump =
+MaxDataDump = 0
; Maximum number of call stack frames to trace back during leak detection.
; Limiting this to a low number can reduce the CPU utilization overhead imposed
Modified: sandbox_light/cmake/CompilerConfigMSVC.cmake
===================================================================
--- sandbox_light/cmake/CompilerConfigMSVC.cmake 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/cmake/CompilerConfigMSVC.cmake 2009-11-05 21:15:05 UTC (rev 6040)
@@ -69,10 +69,10 @@
ADD_COMPILER_FLAGS("-D_CRT_SECURE_NO_WARNINGS" CACHE)
# Overwrite CMake default flags here.
-SET_COMPILER_FLAGS("-MDd -Od -Zi -D_DEBUG -Gm -RTC1" Debug CACHE)
-SET_COMPILER_FLAGS("-MD -O2 -DNDEBUG -MP2" Release CACHE)
-SET_COMPILER_FLAGS("-MD -O2 -Zi -DNDEBUG -MP2" RelWithDebInfo CACHE)
-SET_COMPILER_FLAGS("-MD -O1 -DNDEBUG -MP2" MinSizeRel CACHE)
+SET_COMPILER_FLAGS("-MDd -Od -Zi -D_DEBUG -MP2 -RTC1" Debug CACHE)
+SET_COMPILER_FLAGS("-MD -O2 -DNDEBUG -MP2" Release CACHE)
+SET_COMPILER_FLAGS("-MD -O2 -Zi -DNDEBUG -MP2" RelWithDebInfo CACHE)
+SET_COMPILER_FLAGS("-MD -O1 -DNDEBUG -MP2" MinSizeRel CACHE)
# Use Link time code generation for Release config if ORXONOX_RELEASE is defined
IF(ORXONOX_RELEASE)
Modified: sandbox_light/cmake/LibraryConfig.cmake
===================================================================
--- sandbox_light/cmake/LibraryConfig.cmake 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/cmake/LibraryConfig.cmake 2009-11-05 21:15:05 UTC (rev 6040)
@@ -87,7 +87,7 @@
##### Boost #####
# Expand the next statement if newer boost versions than 1.36.1 are released
-SET(Boost_ADDITIONAL_VERSIONS 1.37 1.37.0 1.38 1.38.0 1.39 1.39.0)
+SET(Boost_ADDITIONAL_VERSIONS 1.37 1.37.0 1.38 1.38.0 1.39 1.39.0 1.40 1.40.0)
FIND_PACKAGE(Boost 1.35 REQUIRED thread filesystem system date_time)
# No auto linking, so this option is useless anyway
MARK_AS_ADVANCED(Boost_LIB_DIAGNOSTIC_DEFINITIONS)
Modified: sandbox_light/cmake/PackageConfig.cmake
===================================================================
--- sandbox_light/cmake/PackageConfig.cmake 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/cmake/PackageConfig.cmake 2009-11-05 21:15:05 UTC (rev 6040)
@@ -25,9 +25,13 @@
#
# Check package version info
-# MAJOR: Interface breaking change somewhere (library version changed, etc.)
-# MINOR: Bug fix or small conformant changes
-SET(DEPENDENCY_VERSION_REQUIRED 3)
+# MAJOR: Breaking change
+# MINOR: No breaking changes by the dependency package
+# For example any code running on 3.0 should still run on 3.1
+# But you can specify that the code only runs on 3.1 and higher
+# or 4.0 and higher (so both 3.1 and 4.0 will work).
+SET(ALLOWED_MINIMUM_VERSIONS 3.1 4.0)
+
IF(NOT EXISTS ${DEPENDENCY_PACKAGE_DIR}/version.txt)
SET(DEPENDENCY_VERSION 1.0)
ELSE()
@@ -43,11 +47,22 @@
ENDIF()
INCLUDE(CompareVersionStrings)
-COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${DEPENDENCY_VERSION_REQUIRED} _result TRUE)
-IF(NOT _result EQUAL 0)
+SET(_version_match FALSE)
+FOREACH(_version ${ALLOWED_MINIMUM_VERSIONS})
+ # Get major version
+ STRING(REGEX REPLACE "^([0-9]+)\\..*$" "\\1" _major_version "${_version}")
+ COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_major_version} _result TRUE)
+ IF(_result EQUAL 0)
+ COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_version} _result FALSE)
+ IF(NOT _result LESS 0)
+ SET(_version_match TRUE)
+ ENDIF()
+ ENDIF()
+ENDFOREACH(_version)
+IF(NOT _version_match)
MESSAGE(FATAL_ERROR "Your dependency package version is ${DEPENDENCY_VERSION}\n"
- "Required version: ${DEPENDENCY_VERSION_REQUIRED}\n"
- "You can get a new version from www.orxonox.net")
+ "Possible required versions: ${ALLOWED_MINIMUM_VERSIONS}\n"
+ "You can get a new version from www.orxonox.net")
ENDIF()
IF(NOT _INTERNAL_PACKAGE_MESSAGE)
Modified: sandbox_light/cmake/ParseMacroArguments.cmake
===================================================================
--- sandbox_light/cmake/ParseMacroArguments.cmake 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/cmake/ParseMacroArguments.cmake 2009-11-05 21:15:05 UTC (rev 6040)
@@ -39,6 +39,11 @@
# Using LIST(FIND ...) speeds up the process
SET(_keywords ${_switches} ${_list_names})
+ # Reset all arguments
+ FOREACH(_arg ${_switches} ${_list_names})
+ SET(_arg_${_arg})
+ ENDFOREACH(_arg)
+
# Parse all the arguments and set the corresponding variable
# If the option is just a switch, set the variable to its name for later use
FOREACH(_arg ${ARGN})
Modified: sandbox_light/cmake/PrecompiledHeaderFiles.cmake
===================================================================
--- sandbox_light/cmake/PrecompiledHeaderFiles.cmake 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/cmake/PrecompiledHeaderFiles.cmake 2009-11-05 21:15:05 UTC (rev 6040)
@@ -109,7 +109,7 @@
# This is just the best possible opportunity to address this dependency issue
GET_GCC_COMPILER_FLAGS(${_target_name} _pch_gcc_flags)
# Make sure we recompile the pch file even if only the flags change
- IF(NOT "${_pch_gcc_flags}" STREQUAL "${_INTERNAL_${_target_name}_PCH_GCC_FLAGS}")
+ IF(NOT "${_pch_gcc_flags}" STREQUAL "${_INTERNAL_${_target_name}_PCH_GCC_FLAGS}" OR NOT EXISTS "${_pch_dep_helper_file}")
SET(_INTERNAL_${_target_name}_PCH_GCC_FLAGS "${_pch_gcc_flags}" CACHE INTERNAL "")
FILE(WRITE ${_pch_dep_helper_file} "/* ${_pch_gcc_flags} */")
ENDIF()
Modified: sandbox_light/cmake/SourceFileUtilities.cmake
===================================================================
--- sandbox_light/cmake/SourceFileUtilities.cmake 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/cmake/SourceFileUtilities.cmake 2009-11-05 21:15:05 UTC (rev 6040)
@@ -23,18 +23,68 @@
# Several functions that help organising the source tree.
# [ADD/SET]_SOURCE_FILES - Writes source files to the cache by force and
# adds the current directory.
- # GET_ALL_HEADER_FILES - Finds all header files recursively.
+ # Also compiles multiple source files into a single
+ # one by including them
+ # Use COMPILATION_[BEGIN|END] in
+ # [ADD|SET]_SOURCE_FILES and specify the name of
+ # the new source file after COMPILATION_BEGIN
+ # GET_ALL_HEADER_FILES - Finds all header files recursively.
# GENERATE_SOURCE_GROUPS - Set Visual Studio source groups.
#
-# Adds source files with the full path to a list
-FUNCTION(ADD_SOURCE_FILES _varname)
- # Prefix the full path
+FUNCTION(PREPARE_SOURCE_FILES)
SET(_fullpath_sources)
FOREACH(_file ${ARGN})
- GET_SOURCE_FILE_PROPERTY(_filepath ${_file} LOCATION)
- LIST(APPEND _fullpath_sources ${_filepath})
+ IF(_file STREQUAL "COMPILATION_BEGIN")
+ SET(_compile TRUE)
+ # Next file is the name of the compilation
+ SET(_get_name TRUE)
+ ELSEIF(_get_name)
+ SET(_get_name FALSE)
+ SET(_compilation_name ${_file})
+ ELSEIF(_file STREQUAL "COMPILATION_END")
+ IF(NOT _compilation_name)
+ MESSAGE(FATAL_ERROR "No name provided for source file compilation")
+ ENDIF()
+ IF(NOT DISABLE_COMPILATIONS)
+ SET(_compilation_file ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name})
+ SET(_include_string)
+ FOREACH(_file2 ${_compilation})
+ SET(_include_string "${_include_string}#include \"${_file2}\"\n")
+ ENDFOREACH(_file2)
+ IF(EXISTS )
+ FILE(READ ${_compilation_file} _include_string_file)
+ ENDIF()
+ IF(NOT _include_string STREQUAL "${_include_string_file}")
+ FILE(WRITE ${_compilation_file} "${_include_string}")
+ ENDIF()
+ LIST(APPEND _fullpath_sources ${_compilation_file})
+ # MSVC hack that excludes the compilations from the intellisense database
+ # (There is a bug with the "-" instead of "/". Only works for "Zm#" argument)
+ IF(MSVC)
+ SET_SOURCE_FILES_PROPERTIES(${_compilation_file} PROPERTIES COMPILE_FLAGS "-Zm1000")
+ ENDIF()
+ ENDIF()
+ SET(_compilation_name)
+ SET(_compilation)
+ SET(_compile FALSE)
+ ELSE()
+ # Prefix the full path
+ GET_SOURCE_FILE_PROPERTY(_filepath ${_file} LOCATION)
+ LIST(APPEND _fullpath_sources ${_filepath})
+ IF(_compile AND NOT DISABLE_COMPILATIONS)
+ LIST(APPEND _compilation ${_filepath})
+ LIST(APPEND _fullpath_sources "H")
+ ENDIF()
+ ENDIF()
ENDFOREACH(_file)
+ SET(_fullpath_sources ${_fullpath_sources} PARENT_SCOPE)
+ENDFUNCTION(PREPARE_SOURCE_FILES)
+
+
+# Adds source files with the full path to a list
+FUNCTION(ADD_SOURCE_FILES _varname)
+ PREPARE_SOURCE_FILES(${ARGN})
# Write into the cache to avoid variable scoping in subdirs
SET(${_varname} ${${_varname}} ${_fullpath_sources} CACHE INTERNAL "Do not edit")
ENDFUNCTION(ADD_SOURCE_FILES)
@@ -42,12 +92,7 @@
# Sets source files with the full path
FUNCTION(SET_SOURCE_FILES _varname)
- # Prefix the full path
- SET(_fullpath_sources)
- FOREACH(_file ${ARGN})
- GET_SOURCE_FILE_PROPERTY(_filepath ${_file} LOCATION)
- LIST(APPEND _fullpath_sources ${_filepath})
- ENDFOREACH(_file)
+ PREPARE_SOURCE_FILES(${ARGN})
# Write into the cache to avoid variable scoping in subdirs
SET(${_varname} ${_fullpath_sources} CACHE INTERNAL "Do not edit")
ENDFUNCTION(SET_SOURCE_FILES)
@@ -65,9 +110,14 @@
FOREACH(_file ${ARGN})
GET_SOURCE_FILE_PROPERTY(_full_filepath ${_file} LOCATION)
FILE(RELATIVE_PATH _relative_path ${CMAKE_CURRENT_SOURCE_DIR} ${_full_filepath})
- GET_FILENAME_COMPONENT(_relative_path ${_relative_path} PATH)
- STRING(REPLACE "/" "\\\\" _group_path "${_relative_path}")
- SOURCE_GROUP("Source\\${_group_path}" FILES ${_file})
+ IF(NOT _relative_path MATCHES "^\\.\\.")
+ GET_FILENAME_COMPONENT(_relative_path ${_relative_path} PATH)
+ STRING(REPLACE "/" "\\\\" _group_path "${_relative_path}")
+ SOURCE_GROUP("Source\\${_group_path}" FILES ${_file})
+ ELSE()
+ # Has to be a compilation
+ SOURCE_GROUP("Compilations" FILES ${_file})
+ ENDIF()
ENDFOREACH(_file)
ENDFUNCTION(GENERATE_SOURCE_GROUPS)
Modified: sandbox_light/cmake/TargetUtilities.cmake
===================================================================
--- sandbox_light/cmake/TargetUtilities.cmake 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/cmake/TargetUtilities.cmake 2009-11-05 21:15:05 UTC (rev 6040)
@@ -66,16 +66,16 @@
INCLUDE(PrecompiledHeaderFiles)
ENDIF()
-FUNCTION(ORXONOX_ADD_LIBRARY _target_name)
+MACRO(ORXONOX_ADD_LIBRARY _target_name)
TU_ADD_TARGET(${_target_name} LIBRARY "STATIC;SHARED" ${ARGN})
-ENDFUNCTION(ORXONOX_ADD_LIBRARY)
+ENDMACRO(ORXONOX_ADD_LIBRARY)
-FUNCTION(ORXONOX_ADD_EXECUTABLE _target_name)
+MACRO(ORXONOX_ADD_EXECUTABLE _target_name)
TU_ADD_TARGET(${_target_name} EXECUTABLE "WIN32" ${ARGN})
-ENDFUNCTION(ORXONOX_ADD_EXECUTABLE)
+ENDMACRO(ORXONOX_ADD_EXECUTABLE)
-FUNCTION(TU_ADD_TARGET _target_name _target_type _additional_switches)
+MACRO(TU_ADD_TARGET _target_name _target_type _additional_switches)
CAPITALISE_NAME(${_target_name} _target_name_capitalised)
# Specify all possible options (either switch or with add. arguments)
@@ -87,13 +87,24 @@
PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN})
- # GET_HEADER_FILES
+ # Workaround: Source file properties get lost when leaving a subdirectory
+ # Therefore an "H" after a file means we have to set it as HEADER_FILE_ONLY
+ FOREACH(_file ${_arg_SOURCE_FILES})
+ IF(_file STREQUAL "H")
+ SET_SOURCE_FILES_PROPERTIES(${_last_file} PROPERTIES HEADER_FILE_ONLY TRUE)
+ ELSE()
+ SET(_last_file ${_file})
+ LIST(APPEND _${_target_name}_source_files ${_file})
+ ENDIF()
+ ENDFOREACH(_file)
+
+ # Assemble all header files of the library
IF(_arg_FIND_HEADER_FILES)
- GET_ALL_HEADER_FILES(_${target_name}_header_files)
+ GET_ALL_HEADER_FILES(_${_target_name}_header_files)
ENDIF()
# Remove potential duplicates
- SET(_${_target_name}_files ${_${target_name}_header_files} ${_arg_SOURCE_FILES})
+ SET(_${_target_name}_files ${_${_target_name}_header_files} ${_${_target_name}_source_files})
LIST(REMOVE_DUPLICATES _${_target_name}_files)
# Generate the source groups
@@ -140,6 +151,12 @@
SET(_arg_STATIC STATIC)
ENDIF()
+ # No warnings needed from third party libraries
+ IF(_arg_ORXONOX_EXTERNAL)
+ REMOVE_COMPILER_FLAGS("-W3 -W4" MSVC)
+ ADD_COMPILER_FLAGS("-w")
+ ENDIF()
+
# Set default linking if required
IF(NOT _arg_SHARED AND NOT _arg_STATIC)
IF("${ORXONOX_DEFAULT_LINK}" STREQUAL "STATIC")
@@ -156,6 +173,15 @@
SET(_arg_STATIC)
ENDIF()
+ # Don't compile header files
+ FOREACH(_file ${_${_target_name}_files})
+ IF(NOT _file MATCHES "\\.(c|cc|cpp)")
+ SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES HEADER_FILE_ONLY TRUE)
+ ENDIF()
+ ENDFOREACH(_file)
+
+
+
# Add the library/executable
IF("${_target_type}" STREQUAL "LIBRARY")
ADD_LIBRARY(${_target_name} ${_arg_STATIC} ${_arg_SHARED}
@@ -165,6 +191,22 @@
${_${_target_name}_files})
ENDIF()
+
+
+ # Change library prefix to "lib"
+ IF(MSVC AND ${_target_type} STREQUAL "LIBRARY")
+ SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
+ PREFIX "lib"
+ )
+ ENDIF()
+
+ # MSVC hack to exclude external library sources from the intellisense database
+ # (IntelliSense stops working when adding "-Zm1000" as compile flag. "/Zm1000"
+ # would not work because of the slash)
+ IF(_arg_ORXONOX_EXTERNAL AND MSVC)
+ SET_TARGET_PROPERTIES(${_target_name} PROPERTIES COMPILE_FLAGS "-Zm1000")
+ ENDIF()
+
# MODULE B
IF (_arg_MODULE)
SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
@@ -213,7 +255,7 @@
ENDIF()
ENDIF()
-ENDFUNCTION(TU_ADD_TARGET)
+ENDMACRO(TU_ADD_TARGET)
# Creates a helper file with name <name_of_the_library>${ORXONOX_MODULE_EXTENSION}
Modified: sandbox_light/data/CMakeLists.txt
===================================================================
--- sandbox_light/data/CMakeLists.txt 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/data/CMakeLists.txt 2009-11-05 21:15:05 UTC (rev 6040)
@@ -23,7 +23,7 @@
# Connfigures the data installation.
#
-# For dev runs we've got two data directory. The one from the other repository root folder
+# For dev runs we've got two data directories. The one from the other repository root folder
# is called EXTERNAL_DATA
SET(DATA_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
SET(DATA_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
Modified: sandbox_light/doc/api/doxy.config.in
===================================================================
--- sandbox_light/doc/api/doxy.config.in 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/doc/api/doxy.config.in 2009-11-05 21:15:05 UTC (rev 6040)
@@ -139,7 +139,7 @@
# comments will behave just like the Qt-style comments (thus requiring an
# explicit @brief command for a brief description.
-JAVADOC_AUTOBRIEF = NO
+JAVADOC_AUTOBRIEF = YES
# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
# treat a multi-line C++ special comment block (i.e. a block of //! or ///
Modified: sandbox_light/src/Orxonox.cc
===================================================================
--- sandbox_light/src/Orxonox.cc 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/Orxonox.cc 2009-11-05 21:15:05 UTC (rev 6040)
@@ -62,9 +62,9 @@
std::string strCmdLine;
for (int i = 1; i < argc; ++i)
strCmdLine += argv[i] + std::string(" ");
+#endif
return orxonox::main(strCmdLine);
-#endif
}
catch (...)
{
Modified: sandbox_light/src/OrxonoxConfig.cmake
===================================================================
--- sandbox_light/src/OrxonoxConfig.cmake 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/OrxonoxConfig.cmake 2009-11-05 21:15:05 UTC (rev 6040)
@@ -38,6 +38,9 @@
OPTION(PCH_ENABLE "Global PCH switch" TRUE)
ENDIF()
+# Global switch to disable multiple file compilations
+OPTION(DISABLE_COMPILATIONS "Global multi-file compilation switch" FALSE)
+
# Use WinMain() or main()?
IF(WIN32)
OPTION(ORXONOX_USE_WINMAIN "Use WinMain (doesn't show console) or main" FALSE)
Modified: sandbox_light/src/external/ogremath/CMakeLists.txt
===================================================================
--- sandbox_light/src/external/ogremath/CMakeLists.txt 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/external/ogremath/CMakeLists.txt 2009-11-05 21:15:05 UTC (rev 6040)
@@ -17,7 +17,8 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
-SET(OGREMATH_SRC_FILES
+SET_SOURCE_FILES(OGREMATH_SRC_FILES
+COMPILATION_BEGIN OgreCompilation.cc
OgreColourValue.cpp
OgreMath.cpp
OgreMatrix3.cpp
@@ -26,14 +27,15 @@
OgreVector2.cpp
OgreVector3.cpp
OgreVector4.cpp
+COMPILATION_END
)
IF(WIN32)
- LIST(APPEND OGREMATH_SRC_FILES WIN32/OgreTimer.cpp)
+ ADD_SOURCE_FILES(OGREMATH_SRC_FILES WIN32/OgreTimer.cpp)
ELSEIF(APPLE)
- LIST(APPEND OGREMATH_SRC_FILES OSX/OgreTimer.cpp)
+ ADD_SOURCE_FILES(OGREMATH_SRC_FILES OSX/OgreTimer.cpp)
ELSEIF(UNIX)
- LIST(APPEND OGREMATH_SRC_FILES GLX/OgreTimer.cpp)
+ ADD_SOURCE_FILES(OGREMATH_SRC_FILES GLX/OgreTimer.cpp)
ENDIF()
ORXONOX_ADD_LIBRARY(ogremath_orxonox
Modified: sandbox_light/src/external/tolua/CMakeLists.txt
===================================================================
--- sandbox_light/src/external/tolua/CMakeLists.txt 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/external/tolua/CMakeLists.txt 2009-11-05 21:15:05 UTC (rev 6040)
@@ -19,22 +19,18 @@
################### Tolua++ library ###################
-SET(TOLUA++_FILES
+SET_SOURCE_FILES(TOLUA++_FILES
tolua_event.h
tolua++.h
-
+COMPILATION_BEGIN ToluaCompilation.c
tolua_event.c
tolua_is.c
tolua_map.c
tolua_push.c
tolua_to.c
+COMPILATION_END
)
-GENERATE_SOURCE_GROUPS(${TOLUA++_FILES})
-# No warnings needed from third party libraries
-REMOVE_COMPILER_FLAGS("-W3 -W4" MSVC)
-ADD_COMPILER_FLAGS("-w")
-
ORXONOX_ADD_LIBRARY(tolua++_orxonox
ORXONOX_EXTERNAL
DEFINE_SYMBOL
Modified: sandbox_light/src/libraries/CMakeLists.txt
===================================================================
--- sandbox_light/src/libraries/CMakeLists.txt 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/libraries/CMakeLists.txt 2009-11-05 21:15:05 UTC (rev 6040)
@@ -24,5 +24,5 @@
################ Sub Directories ################
+ADD_SUBDIRECTORY(util)
ADD_SUBDIRECTORY(core)
-ADD_SUBDIRECTORY(util)
Modified: sandbox_light/src/libraries/core/CMakeLists.txt
===================================================================
--- sandbox_light/src/libraries/core/CMakeLists.txt 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/libraries/core/CMakeLists.txt 2009-11-05 21:15:05 UTC (rev 6040)
@@ -18,10 +18,10 @@
#
SET_SOURCE_FILES(CORE_SRC_FILES
- Clock.cc
- CommandLine.cc
+ CommandLineParser.cc
Core.cc
LuaState.cc
+ PathConfig.cc
)
ORXONOX_ADD_LIBRARY(core
Deleted: sandbox_light/src/libraries/core/Clock.cc
===================================================================
--- sandbox_light/src/libraries/core/Clock.cc 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/libraries/core/Clock.cc 2009-11-05 21:15:05 UTC (rev 6040)
@@ -1,78 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief
-*/
-
-#include "Clock.h"
-#include <ogremath/OgreTimer.h>
-
-namespace orxonox
-{
- Clock::Clock()
- : timer_(new Ogre::Timer())
- , storedTime_(0)
- , tickTime_(0)
- , tickDt_(0)
- , tickDtFloat_(0.0f)
- , lastTimersTime_(0)
- {
- }
-
- Clock::~Clock()
- {
- delete timer_;
- }
-
- void Clock::capture()
- {
- unsigned long timersTime = timer_->getMicroseconds();
- tickTime_ = storedTime_ + timersTime;
- tickDt_ = timersTime - lastTimersTime_;
- tickDtFloat_ = static_cast<float>(tickDt_) / 1000000.0f;
-
- if (timersTime > 0xFFFFFFFF/4)
- {
- // Ogre timer will overflow at 2^32 microseconds if unsigned long is 32 bit
- storedTime_ += timersTime;
- lastTimersTime_ = 0;
- timer_->reset();
- }
- else
- {
- lastTimersTime_ = timersTime;
- }
- }
-
- unsigned long long Clock::getRealMicroseconds() const
- {
- return this->timer_->getMicroseconds() + this->storedTime_;
- }
-}
Deleted: sandbox_light/src/libraries/core/Clock.h
===================================================================
--- sandbox_light/src/libraries/core/Clock.h 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/libraries/core/Clock.h 2009-11-05 21:15:05 UTC (rev 6040)
@@ -1,68 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _Clock_H__
-#define _Clock_H__
-
-#include "CorePrereqs.h"
-
-namespace Ogre { class Timer; }
-
-namespace orxonox
-{
- class _CoreExport Clock
- {
- public:
- Clock();
- ~Clock();
-
- void capture();
-
- unsigned long long getMicroseconds() const { return tickTime_; }
- unsigned long long getMilliseconds() const { return tickTime_ / 1000; }
- unsigned long getSeconds() const { return static_cast<long> (tickTime_ / 1000000); }
- float getSecondsPrecise() const { return static_cast<float>(tickTime_ / 1000000.0f); }
-
- float getDeltaTime() const { return tickDtFloat_; }
- long getDeltaTimeMicroseconds() const { return tickDt_; }
-
- unsigned long long getRealMicroseconds() const;
-
- private:
- Clock(const Clock& instance);
-
- Ogre::Timer* timer_;
- unsigned long long storedTime_;
- unsigned long long tickTime_;
- long tickDt_;
- float tickDtFloat_;
- unsigned long lastTimersTime_;
- };
-}
-
-#endif /* _Clock_H__ */
Deleted: sandbox_light/src/libraries/core/CommandLine.cc
===================================================================
--- sandbox_light/src/libraries/core/CommandLine.cc 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/libraries/core/CommandLine.cc 2009-11-05 21:15:05 UTC (rev 6040)
@@ -1,376 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#include "CommandLine.h"
-
-#include <algorithm>
-#include <sstream>
-
-#include "util/Convert.h"
-#include "util/Debug.h"
-#include "util/Exception.h"
-#include "util/StringUtils.h"
-#include "util/SubString.h"
-#include "Core.h"
-
-namespace orxonox
-{
- SetCommandLineOnlyArgument(optionsFile, "start.ini").shortcut("o");
-
- /**
- @brief
- Parses a value string for a command line argument.
- It simply uses convertValue(Output, Input) to do that.
- Bools are treated specially. That is necessary
- so that you can have simple command line switches.
- */
- void CommandLineArgument::parse(const std::string& value, bool bParsingFile)
- {
- if (bParsingFile && this->bCommandLineOnly_)
- ThrowException(Argument, "Command line argument '" + getName() + "' is not allowed in files.");
- if (value_.getType() == MT_Type::Bool)
- {
- // simulate command line switch
- bool temp;
- if (convertValue(&temp, value))
- {
- this->bHasDefaultValue_ = false;
- this->value_ = temp;
- }
- else if (value == "")
- {
- this->bHasDefaultValue_ = false;
- this->value_ = true;
- }
- else
- ThrowException(Argument, "Could not read command line argument '" + getName() + "'.");
- }
- else
- {
- if (!value_.setValue(value))
- {
- value_.setValue(defaultValue_);
- ThrowException(Argument, "Could not read command line argument '" + getName() + "'.");
- }
- else
- this->bHasDefaultValue_ = false;
- }
- }
-
-
- /**
- @brief
- Destructor destroys all CommandLineArguments with it.
- */
- CommandLine::~CommandLine()
- {
- CommandLine::destroyAllArguments();
- }
-
- /**
- @brief
- Returns a unique instance (Meyers Singleton).
- */
- CommandLine& CommandLine::_getInstance()
- {
- static CommandLine instance;
- return instance;
- }
-
- /**
- @brief
- Destroys all command line arguments. This should be called at the end
- of main. Do not use before that.
- */
- void CommandLine::destroyAllArguments()
- {
- for (std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.begin();
- it != _getInstance().cmdLineArgs_.end(); ++it)
- delete it->second;
- _getInstance().cmdLineArgs_.clear();
- }
-
- /**
- @brief
- Reads the command line parses the values of each argument.
- It is then stored in the corresponding CommandLineArgument.
- @note
- The reason that you have to provide the string to be parsed as
- space separted list is because of argc and argv. If you only have
- a whole string, simply use getAllStrings() of SubString.
- @param arguments
- Vector of space separated strings.
- */
- void CommandLine::_parse(const std::vector<std::string>& arguments, bool bParsingFile)
- {
- try
- {
- // why this? See bFirstTimeParse_ declaration.
- if (bFirstTimeParse_)
- {
- // first shove all the shortcuts in a map
- for (std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.begin();
- it != cmdLineArgs_.end(); ++it)
- {
- OrxAssert(cmdLineArgsShortcut_.find(it->second->getShortcut()) == cmdLineArgsShortcut_.end(),
- "Cannot have two command line shortcut with the same name.");
- if (it->second->getShortcut() != "")
- cmdLineArgsShortcut_[it->second->getShortcut()] = it->second;
- }
- bFirstTimeParse_ = false;
- }
-
- std::string name;
- std::string shortcut;
- std::string value;
- for (unsigned int i = 0; i < arguments.size(); ++i)
- {
- if (arguments[i].size() != 0)
- {
- // sure not ""
- if (arguments[i][0] == '-')
- {
- // start with "-"
- if (arguments[i].size() == 1)
- {
- // argument[i] is "-", probably a minus sign
- value += "- ";
- }
- else if (arguments[i][1] <= 57 && arguments[i][1] >= 48)
- {
- // negative number as a value
- value += arguments[i] + " ";
- }
- else
- {
- // can be shortcut or full name argument
-
- // save old data first
- value = removeTrailingWhitespaces(value);
- if (name != "")
- {
- checkFullArgument(name, value, bParsingFile);
- name = "";
- assert(shortcut == "");
- }
- else if (shortcut != "")
- {
- checkShortcut(shortcut, value, bParsingFile);
- shortcut = "";
- assert(name == "");
- }
-
- if (arguments[i][1] == '-')
- {
- // full name argument with "--name"
- name = arguments[i].substr(2);
- }
- else
- {
- // shortcut with "-s"
- shortcut = arguments[i].substr(1);
- }
-
- // reset value string
- value = "";
- }
- }
- else
- {
- // value string
-
- if (name == "" && shortcut == "")
- {
- ThrowException(Argument, "Expected \"-\" or \"-\" in command line arguments.\n");
- }
-
- // Concatenate strings as long as there's no new argument by "-" or "--"
- value += arguments[i] + ' ';
- }
- }
- }
-
- // parse last argument
- value = removeTrailingWhitespaces(value);
- if (name != "")
- {
- checkFullArgument(name, value, bParsingFile);
- assert(shortcut == "");
- }
- else if (shortcut != "")
- {
- checkShortcut(shortcut, value, bParsingFile);
- assert(name == "");
- }
- }
- catch (const ArgumentException& ex)
- {
- COUT(0) << "Could not parse command line (including additional files): " << ex.what() << std::endl;
- COUT(0) << CommandLine::getUsageInformation() << std::endl;
- throw GeneralException("");
- }
- }
-
- /**
- @brief
- Parses an argument based on its full name.
- @param name
- Full name of the argument
- @param value
- String containing the value
- */
- void CommandLine::checkFullArgument(const std::string& name, const std::string& value, bool bParsingFile)
- {
- std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.find(name);
- if (it == cmdLineArgs_.end())
- ThrowException(Argument, "Command line argument '" + name + "' does not exist.");
-
- it->second->parse(value, bParsingFile);
- }
-
- /**
- @brief
- Parses an argument based on its shortcut.
- @param shortcut
- Shotcut to the argument
- @param value
- String containing the value
- */
- void CommandLine::checkShortcut(const std::string& shortcut, const std::string& value, bool bParsingFile)
- {
- std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgsShortcut_.find(shortcut);
- if (it == cmdLineArgsShortcut_.end())
- ThrowException(Argument, "Command line shortcut '" + shortcut + "' does not exist.");
-
- it->second->parse(value, bParsingFile);
- }
-
- std::string CommandLine::getUsageInformation()
- {
- CommandLine& inst = _getInstance();
- std::ostringstream infoStr;
-
- // determine maximum name size
- size_t maxNameSize = 0;
- for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
- it != inst.cmdLineArgs_.end(); ++it)
- {
- maxNameSize = std::max(it->second->getName().size(), maxNameSize);
- }
-
- infoStr << "Usage: orxonox [options]" << std::endl;
- infoStr << "Available options:" << std::endl;
-
- for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
- it != inst.cmdLineArgs_.end(); ++it)
- {
- if (it->second->getShortcut() != "")
- infoStr << " [-" << it->second->getShortcut() << "] ";
- else
- infoStr << " ";
- infoStr << "--" << it->second->getName() << " ";
- if (it->second->getValue().getType() != MT_Type::Bool)
- infoStr << "ARG ";
- else
- infoStr << " ";
- // fill with the necessary amount of blanks
- infoStr << std::string(maxNameSize - it->second->getName().size(), ' ');
- infoStr << ": " << it->second->getInformation();
- infoStr << std::endl;
- }
- return infoStr.str();
- }
-
- /**
- @brief
- Retrieves a CommandLineArgument.
- The method throws an exception if 'name' was not found or the value could not be converted.
- @note
- You shold of course not call this method before the command line has been parsed.
- */
- const CommandLineArgument* CommandLine::getArgument(const std::string& name)
- {
- std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.find(name);
- if (it == _getInstance().cmdLineArgs_.end())
- {
- ThrowException(Argument, "Could find command line argument '" + name + "'.");
- }
- else
- {
- return it->second;
- }
- }
-
- /**
- @brief
- Parses only the command line for CommandLineArguments.
- */
- void CommandLine::_parseCommandLine(const std::string& cmdLine)
- {
- std::vector<std::string> args;
- SubString tokens(cmdLine, " ", " ", false, '\\', true, '"', true, '(', ')', false);
- for (unsigned i = 0; i < tokens.size(); ++i)
- args.push_back(tokens[i]);
- this->_parse(args, false);
- }
-
- /**
- @brief
- Parses start.ini (or the file specified with --optionsFile) for CommandLineArguments.
- */
- void CommandLine::_parseFile()
- {
- std::string filename = CommandLine::getValue("optionsFile").getString();
-
- // look for additional arguments in given file or start.ini as default
- // They will not overwrite the arguments given directly
- std::ifstream file;
- file.open((Core::getConfigPathString() + filename).c_str());
- std::vector<std::string> args;
- if (file)
- {
- while (!file.eof())
- {
- std::string line;
- std::getline(file, line);
- line = removeTrailingWhitespaces(line);
- //if (!(line[0] == '#' || line[0] == '%'))
- //{
- SubString tokens(line, " ", " ", false, '\\', true, '"', true, '(', ')', false, '#');
- for (unsigned i = 0; i < tokens.size(); ++i)
- if (tokens[i][0] != '#')
- args.push_back(tokens[i]);
- //args.insert(args.end(), tokens.getAllStrings().begin(), tokens.getAllStrings().end());
- //}
- }
- file.close();
- }
-
- _parse(args, true);
- }
-}
Deleted: sandbox_light/src/libraries/core/CommandLine.h
===================================================================
--- sandbox_light/src/libraries/core/CommandLine.h 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/libraries/core/CommandLine.h 2009-11-05 21:15:05 UTC (rev 6040)
@@ -1,223 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _CommandLine_H__
-#define _CommandLine_H__
-
-#include "CorePrereqs.h"
-
-#include <map>
-#include "util/OrxAssert.h"
-#include "util/MultiType.h"
-
-#define SetCommandLineArgument(name, defaultValue) \
- orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
- = orxonox::CommandLine::addArgument(#name, defaultValue, false)
-#define SetCommandLineOnlyArgument(name, defaultValue) \
- orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
- = orxonox::CommandLine::addArgument(#name, defaultValue, true)
-#define SetCommandLineSwitch(name) \
- orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
- = orxonox::CommandLine::addArgument(#name, false, false)
-#define SetCommandLineOnlySwitch(name) \
- orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
- = orxonox::CommandLine::addArgument(#name, false, true)
-
-
-namespace orxonox
-{
- /**
- @brief
- Container class for a command line argument of any type supported by MultiType.
-
- Whenever you want to have an option specified by a command line switch,
- you need to first define it with SetCommandLineArgument(name, defaultValue).
- It is then added to a map and possibly changed when the command line is being parsed.
- If the option was not given, you can detect this by asking hasDefaultValue().
-
- There is a possibility to define a short cut so you can write "-p 20" instead of "--port 20".
- Note the difference between "-" and "--"!
- Also, there is no restriction to the number of strings you add after --name.
- So "--startVector (2, 4, 5)" is perfectly legal.
-
- Retrieving an argument is possible with the getCommandLineArgument function of the
- CommandLine class. It is a Singleton, but the public interface is static.
- */
- class _CoreExport CommandLineArgument
- {
- friend class CommandLine;
-
- public:
- //! Tells whether the value has been changed by the command line.
- bool hasDefaultValue() const { return bHasDefaultValue_; }
- //! Returns the name of the argument.
- const std::string& getName() const { return name_; }
-
- //! Returns the shortcut (example: "-p 22" for "--port 22") of the argument.
- //! Evaluates to "" if there is none.
- const std::string& getShortcut() const { return shortcut_; }
- //! Sets the shortcut for the argument
- CommandLineArgument& shortcut(const std::string& shortcut)
- { this->shortcut_ = shortcut; return *this; }
-
- //! Returns the usage information
- const std::string& getInformation() const { return this->usageInformation_; }
- //! Sets the option information when displaying orxonox usage.
- CommandLineArgument& information(const std::string& usage)
- { this->usageInformation_ = usage; return *this; }
-
- //! Returns the actual value of the argument. Can be equal to default value.
- MultiType getValue() const { return value_; }
- //! Returns the given default value as type T.
- MultiType getDefaultValue() const { return defaultValue_; }
-
- private:
- //! Constructor initialises both value_ and defaultValue_ with defaultValue.
- CommandLineArgument(const std::string& name, const MultiType& defaultValue, bool bCommandLineOnly)
- : bHasDefaultValue_(true)
- , name_(name)
- , value_(defaultValue)
- , defaultValue_(defaultValue)
- , bCommandLineOnly_(bCommandLineOnly)
- { }
-
- //! Undefined copy constructor
- CommandLineArgument(const CommandLineArgument& instance);
- ~CommandLineArgument() { }
-
- //! Parses the value string of a command line argument.
- void parse(const std::string& value, bool bParsingFile);
-
- //! Tells whether the value has been changed by the command line.
- bool bHasDefaultValue_;
-
- private:
- std::string name_; //!< Name of the argument
- std::string shortcut_; //!< Shortcut of the argument. @see getShortcut().
- std::string usageInformation_; //!< Tells about the usage of this parameter
-
- MultiType value_; //!< The actual value
- MultiType defaultValue_; //!< Default value. Should not be changed.
- bool bCommandLineOnly_; //!< Whether you cannot specify the value in a text file
- };
-
-
- /**
- @brief
- Global interface to command line options.
- Allows to add and retrieve command line arguments. Also does the parsing.
- @note
- Internally it is a Singleton, but the public interface is static.
- @see
- CommandLineArgument
- */
- class _CoreExport CommandLine
- {
- public:
-
- //! Parse redirection to internal member method.
- static void parseCommandLine(const std::string& cmdLine) { _getInstance()._parseCommandLine(cmdLine); }
- static void parseFile() { _getInstance()._parseFile(); }
-
- static std::string getUsageInformation();
-
- static const CommandLineArgument* getArgument(const std::string& name);
- //! Writes the argument value in the given parameter.
- template <class T>
- static void getValue(const std::string& name, T* value)
- { *value = (T)(getArgument(name)->getValue()); }
- static MultiType getValue(const std::string& name)
- { return getArgument(name)->getValue(); }
- template <class T>
- static CommandLineArgument& addArgument(const std::string& name, T defaultValue, bool bCommandLineOnly);
-
- static bool existsArgument(const std::string& name)
- {
- std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.find(name);
- return !(it == _getInstance().cmdLineArgs_.end());
- }
-
- static void destroyAllArguments();
-
- private:
- //! Constructor initialises bFirstTimeParse_ with true.
- CommandLine() : bFirstTimeParse_(true) { }
- //! Undefined copy constructor
- CommandLine(const CommandLine& instance);
- ~CommandLine();
-
- static CommandLine& _getInstance();
-
- void _parseCommandLine(const std::string& cmdLine);
- void _parseFile();
- void _parse(const std::vector<std::string>& arguments, bool bParsingFile);
- void checkFullArgument(const std::string& name, const std::string& value, bool bParsingFile);
- void checkShortcut(const std::string& shortcut, const std::string& value, bool bParsingFile);
-
- /**
- Tells whether we parsed for the first time. The CommmandLineArguments are added before main().
- So when we call parse() the first time, we need to create a map with all shortcuts since these
- get added after addCommandLineArgument().
- */
- bool bFirstTimeParse_;
-
- //! Holds all pointers to the arguments and serves as a search map by name.
- std::map<std::string, CommandLineArgument*> cmdLineArgs_;
- //! Search map by shortcut for the arguments.
- std::map<std::string, CommandLineArgument*> cmdLineArgsShortcut_;
- };
-
- template <>
- inline void CommandLine::getValue<std::string>(const std::string& name, std::string* value)
- {
- *value = getArgument(name)->getValue().getString();
- }
-
- /**
- @brief
- Adds a new CommandLineArgument to the internal map.
- Note that only such arguments are actually valid.
- @param name
- Name of the argument. Shortcut can be added later.
- @param defaultValue
- Default value that is used when argument was not given.
- */
- template <class T>
- CommandLineArgument& CommandLine::addArgument(const std::string& name, T defaultValue, bool bCommandLineOnly)
- {
- OrxAssert(!_getInstance().existsArgument(name),
- "Cannot add a command line argument with name '" + name + "' twice.");
- OrxAssert(MultiType(defaultValue).getType() != MT_Type::Bool || MultiType(defaultValue).getBool() != true,
- "Boolean command line arguments with positive default values are not supported." << std::endl
- << "Please use SetCommandLineSwitch and adjust your argument: " << name);
-
- return *(_getInstance().cmdLineArgs_[name] = new CommandLineArgument(name, defaultValue, bCommandLineOnly));
- }
-}
-
-#endif /* _CommandLine_H__ */
Copied: sandbox_light/src/libraries/core/CommandLineParser.cc (from rev 6039, sandbox/src/libraries/core/CommandLineParser.cc)
===================================================================
--- sandbox_light/src/libraries/core/CommandLineParser.cc (rev 0)
+++ sandbox_light/src/libraries/core/CommandLineParser.cc 2009-11-05 21:15:05 UTC (rev 6040)
@@ -0,0 +1,377 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "CommandLineParser.h"
+
+#include <algorithm>
+#include <sstream>
+
+#include "util/Convert.h"
+#include "util/Debug.h"
+#include "util/Exception.h"
+#include "util/StringUtils.h"
+#include "util/SubString.h"
+#include "PathConfig.h"
+
+namespace orxonox
+{
+ SetCommandLineOnlyArgument(optionsFile, "start.ini").shortcut("o");
+
+ /**
+ @brief
+ Parses a value string for a command line argument.
+ It simply uses convertValue(Output, Input) to do that.
+ Bools are treated specially. That is necessary
+ so that you can have simple command line switches.
+ */
+ void CommandLineArgument::parse(const std::string& value, bool bParsingFile)
+ {
+ if (bParsingFile && this->bCommandLineOnly_)
+ ThrowException(Argument, "Command line argument '" + getName() + "' is not allowed in files.");
+ if (value_.getType() == MT_Type::Bool)
+ {
+ // simulate command line switch
+ bool temp;
+ if (convertValue(&temp, value))
+ {
+ this->bHasDefaultValue_ = false;
+ this->value_ = temp;
+ }
+ else if (value == "")
+ {
+ this->bHasDefaultValue_ = false;
+ this->value_ = true;
+ }
+ else
+ ThrowException(Argument, "Could not read command line argument '" + getName() + "'.");
+ }
+ else
+ {
+ if (!value_.setValue(value))
+ {
+ value_.setValue(defaultValue_);
+ ThrowException(Argument, "Could not read command line argument '" + getName() + "'.");
+ }
+ else
+ this->bHasDefaultValue_ = false;
+ }
+ }
+
+
+ /**
+ @brief
+ Destructor destroys all CommandLineArguments with it.
+ */
+ CommandLineParser::~CommandLineParser()
+ {
+ CommandLineParser::destroyAllArguments();
+ }
+
+ /**
+ @brief
+ Returns a unique instance (Meyers Singleton).
+ */
+ CommandLineParser& CommandLineParser::_getInstance()
+ {
+ static CommandLineParser instance;
+ return instance;
+ }
+
+ /**
+ @brief
+ Destroys all command line arguments. This should be called at the end
+ of main. Do not use before that.
+ */
+ void CommandLineParser::destroyAllArguments()
+ {
+ for (std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.begin();
+ it != _getInstance().cmdLineArgs_.end(); ++it)
+ delete it->second;
+ _getInstance().cmdLineArgs_.clear();
+ }
+
+ /**
+ @brief
+ Reads the command line parses the values of each argument.
+ It is then stored in the corresponding CommandLineArgument.
+ @note
+ The reason that you have to provide the string to be parsed as
+ space separted list is because of argc and argv. If you only have
+ a whole string, simply use getAllStrings() of SubString.
+ @param arguments
+ Vector of space separated strings.
+ */
+ void CommandLineParser::_parse(const std::vector<std::string>& arguments, bool bParsingFile)
+ {
+ try
+ {
+ // why this? See bFirstTimeParse_ declaration.
+ if (bFirstTimeParse_)
+ {
+ // first shove all the shortcuts in a map
+ for (std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.begin();
+ it != cmdLineArgs_.end(); ++it)
+ {
+ OrxAssert(cmdLineArgsShortcut_.find(it->second->getShortcut()) == cmdLineArgsShortcut_.end(),
+ "Cannot have two command line shortcut with the same name.");
+ if (it->second->getShortcut() != "")
+ cmdLineArgsShortcut_[it->second->getShortcut()] = it->second;
+ }
+ bFirstTimeParse_ = false;
+ }
+
+ std::string name;
+ std::string shortcut;
+ std::string value;
+ for (unsigned int i = 0; i < arguments.size(); ++i)
+ {
+ if (arguments[i].size() != 0)
+ {
+ // sure not ""
+ if (arguments[i][0] == '-')
+ {
+ // start with "-"
+ if (arguments[i].size() == 1)
+ {
+ // argument[i] is "-", probably a minus sign
+ value += "- ";
+ }
+ else if (arguments[i][1] <= 57 && arguments[i][1] >= 48)
+ {
+ // negative number as a value
+ value += arguments[i] + " ";
+ }
+ else
+ {
+ // can be shortcut or full name argument
+
+ // save old data first
+ value = removeTrailingWhitespaces(value);
+ if (name != "")
+ {
+ checkFullArgument(name, value, bParsingFile);
+ name = "";
+ assert(shortcut == "");
+ }
+ else if (shortcut != "")
+ {
+ checkShortcut(shortcut, value, bParsingFile);
+ shortcut = "";
+ assert(name == "");
+ }
+
+ if (arguments[i][1] == '-')
+ {
+ // full name argument with "--name"
+ name = arguments[i].substr(2);
+ }
+ else
+ {
+ // shortcut with "-s"
+ shortcut = arguments[i].substr(1);
+ }
+
+ // reset value string
+ value = "";
+ }
+ }
+ else
+ {
+ // value string
+
+ if (name == "" && shortcut == "")
+ {
+ ThrowException(Argument, "Expected \"-\" or \"-\" in command line arguments.\n");
+ }
+
+ // Concatenate strings as long as there's no new argument by "-" or "--"
+ value += arguments[i] + ' ';
+ }
+ }
+ }
+
+ // parse last argument
+ value = removeTrailingWhitespaces(value);
+ if (name != "")
+ {
+ checkFullArgument(name, value, bParsingFile);
+ assert(shortcut == "");
+ }
+ else if (shortcut != "")
+ {
+ checkShortcut(shortcut, value, bParsingFile);
+ assert(name == "");
+ }
+ }
+ catch (const ArgumentException& ex)
+ {
+ COUT(0) << "Could not parse command line (including additional files): " << ex.what() << std::endl;
+ COUT(0) << CommandLineParser::getUsageInformation() << std::endl;
+ throw GeneralException("");
+ }
+ }
+
+ /**
+ @brief
+ Parses an argument based on its full name.
+ @param name
+ Full name of the argument
+ @param value
+ String containing the value
+ */
+ void CommandLineParser::checkFullArgument(const std::string& name, const std::string& value, bool bParsingFile)
+ {
+ std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.find(name);
+ if (it == cmdLineArgs_.end())
+ ThrowException(Argument, "Command line argument '" + name + "' does not exist.");
+
+ it->second->parse(value, bParsingFile);
+ }
+
+ /**
+ @brief
+ Parses an argument based on its shortcut.
+ @param shortcut
+ Shotcut to the argument
+ @param value
+ String containing the value
+ */
+ void CommandLineParser::checkShortcut(const std::string& shortcut, const std::string& value, bool bParsingFile)
+ {
+ std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgsShortcut_.find(shortcut);
+ if (it == cmdLineArgsShortcut_.end())
+ ThrowException(Argument, "Command line shortcut '" + shortcut + "' does not exist.");
+
+ it->second->parse(value, bParsingFile);
+ }
+
+ std::string CommandLineParser::getUsageInformation()
+ {
+ CommandLineParser& inst = _getInstance();
+ std::ostringstream infoStr;
+
+ // determine maximum name size
+ size_t maxNameSize = 0;
+ for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
+ it != inst.cmdLineArgs_.end(); ++it)
+ {
+ maxNameSize = std::max(it->second->getName().size(), maxNameSize);
+ }
+
+ infoStr << std::endl;
+ infoStr << "Usage: orxonox [options]" << std::endl;
+ infoStr << "Available options:" << std::endl;
+
+ for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
+ it != inst.cmdLineArgs_.end(); ++it)
+ {
+ if (it->second->getShortcut() != "")
+ infoStr << " [-" << it->second->getShortcut() << "] ";
+ else
+ infoStr << " ";
+ infoStr << "--" << it->second->getName() << " ";
+ if (it->second->getValue().getType() != MT_Type::Bool)
+ infoStr << "ARG ";
+ else
+ infoStr << " ";
+ // fill with the necessary amount of blanks
+ infoStr << std::string(maxNameSize - it->second->getName().size(), ' ');
+ infoStr << ": " << it->second->getInformation();
+ infoStr << std::endl;
+ }
+ return infoStr.str();
+ }
+
+ /**
+ @brief
+ Retrieves a CommandLineArgument.
+ The method throws an exception if 'name' was not found or the value could not be converted.
+ @note
+ You shold of course not call this method before the command line has been parsed.
+ */
+ const CommandLineArgument* CommandLineParser::getArgument(const std::string& name)
+ {
+ std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.find(name);
+ if (it == _getInstance().cmdLineArgs_.end())
+ {
+ ThrowException(Argument, "Could find command line argument '" + name + "'.");
+ }
+ else
+ {
+ return it->second;
+ }
+ }
+
+ /**
+ @brief
+ Parses only the command line for CommandLineArguments.
+ */
+ void CommandLineParser::_parseCommandLine(const std::string& cmdLine)
+ {
+ std::vector<std::string> args;
+ SubString tokens(cmdLine, " ", " ", false, '\\', true, '"', true, '(', ')', false);
+ for (unsigned i = 0; i < tokens.size(); ++i)
+ args.push_back(tokens[i]);
+ this->_parse(args, false);
+ }
+
+ /**
+ @brief
+ Parses start.ini (or the file specified with --optionsFile) for CommandLineArguments.
+ */
+ void CommandLineParser::_parseFile()
+ {
+ std::string filename = CommandLineParser::getValue("optionsFile").getString();
+
+ // look for additional arguments in given file or start.ini as default
+ // They will not overwrite the arguments given directly
+ std::ifstream file;
+ file.open((PathConfig::getConfigPathString() + filename).c_str());
+ std::vector<std::string> args;
+ if (file)
+ {
+ while (!file.eof())
+ {
+ std::string line;
+ std::getline(file, line);
+ line = removeTrailingWhitespaces(line);
+ //if (!(line[0] == '#' || line[0] == '%'))
+ //{
+ SubString tokens(line, " ", " ", false, '\\', true, '"', true, '(', ')', false, '#');
+ for (unsigned i = 0; i < tokens.size(); ++i)
+ if (tokens[i][0] != '#')
+ args.push_back(tokens[i]);
+ //args.insert(args.end(), tokens.getAllStrings().begin(), tokens.getAllStrings().end());
+ //}
+ }
+ file.close();
+ }
+
+ _parse(args, true);
+ }
+}
Copied: sandbox_light/src/libraries/core/CommandLineParser.h (from rev 6039, sandbox/src/libraries/core/CommandLineParser.h)
===================================================================
--- sandbox_light/src/libraries/core/CommandLineParser.h (rev 0)
+++ sandbox_light/src/libraries/core/CommandLineParser.h 2009-11-05 21:15:05 UTC (rev 6040)
@@ -0,0 +1,223 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _CommandLine_H__
+#define _CommandLine_H__
+
+#include "CorePrereqs.h"
+
+#include <map>
+#include "util/OrxAssert.h"
+#include "util/MultiType.h"
+
+#define SetCommandLineArgument(name, defaultValue) \
+ orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
+ = orxonox::CommandLineParser::addArgument(#name, defaultValue, false)
+#define SetCommandLineOnlyArgument(name, defaultValue) \
+ orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
+ = orxonox::CommandLineParser::addArgument(#name, defaultValue, true)
+#define SetCommandLineSwitch(name) \
+ orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
+ = orxonox::CommandLineParser::addArgument(#name, false, false)
+#define SetCommandLineOnlySwitch(name) \
+ orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
+ = orxonox::CommandLineParser::addArgument(#name, false, true)
+
+
+namespace orxonox
+{
+ /**
+ @brief
+ Container class for a command line argument of any type supported by MultiType.
+
+ Whenever you want to have an option specified by a command line switch,
+ you need to first define it with SetCommandLineArgument(name, defaultValue).
+ It is then added to a map and possibly changed when the command line is being parsed.
+ If the option was not given, you can detect this by asking hasDefaultValue().
+
+ There is a possibility to define a short cut so you can write "-p 20" instead of "--port 20".
+ Note the difference between "-" and "--"!
+ Also, there is no restriction to the number of strings you add after --name.
+ So "--startVector (2, 4, 5)" is perfectly legal.
+
+ Retrieving an argument is possible with the getCommandLineArgument function of the
+ CommandLineParser class. It is a Singleton, but the public interface is static.
+ */
+ class _CoreExport CommandLineArgument
+ {
+ friend class CommandLineParser;
+
+ public:
+ //! Tells whether the value has been changed by the command line.
+ bool hasDefaultValue() const { return bHasDefaultValue_; }
+ //! Returns the name of the argument.
+ const std::string& getName() const { return name_; }
+
+ //! Returns the shortcut (example: "-p 22" for "--port 22") of the argument.
+ //! Evaluates to "" if there is none.
+ const std::string& getShortcut() const { return shortcut_; }
+ //! Sets the shortcut for the argument
+ CommandLineArgument& shortcut(const std::string& shortcut)
+ { this->shortcut_ = shortcut; return *this; }
+
+ //! Returns the usage information
+ const std::string& getInformation() const { return this->usageInformation_; }
+ //! Sets the option information when displaying orxonox usage.
+ CommandLineArgument& information(const std::string& usage)
+ { this->usageInformation_ = usage; return *this; }
+
+ //! Returns the actual value of the argument. Can be equal to default value.
+ MultiType getValue() const { return value_; }
+ //! Returns the given default value as type T.
+ MultiType getDefaultValue() const { return defaultValue_; }
+
+ private:
+ //! Constructor initialises both value_ and defaultValue_ with defaultValue.
+ CommandLineArgument(const std::string& name, const MultiType& defaultValue, bool bCommandLineOnly)
+ : bHasDefaultValue_(true)
+ , name_(name)
+ , value_(defaultValue)
+ , defaultValue_(defaultValue)
+ , bCommandLineOnly_(bCommandLineOnly)
+ { }
+
+ //! Undefined copy constructor
+ CommandLineArgument(const CommandLineArgument& instance);
+ ~CommandLineArgument() { }
+
+ //! Parses the value string of a command line argument.
+ void parse(const std::string& value, bool bParsingFile);
+
+ //! Tells whether the value has been changed by the command line.
+ bool bHasDefaultValue_;
+
+ private:
+ std::string name_; //!< Name of the argument
+ std::string shortcut_; //!< Shortcut of the argument. @see getShortcut().
+ std::string usageInformation_; //!< Tells about the usage of this parameter
+
+ MultiType value_; //!< The actual value
+ MultiType defaultValue_; //!< Default value. Should not be changed.
+ bool bCommandLineOnly_; //!< Whether you cannot specify the value in a text file
+ };
+
+
+ /**
+ @brief
+ Global interface to command line options.
+ Allows to add and retrieve command line arguments. Also does the parsing.
+ @note
+ Internally it is a Singleton, but the public interface is static.
+ @see
+ CommandLineArgument
+ */
+ class _CoreExport CommandLineParser
+ {
+ public:
+
+ //! Parse redirection to internal member method.
+ static void parseCommandLine(const std::string& cmdLine) { _getInstance()._parseCommandLine(cmdLine); }
+ static void parseFile() { _getInstance()._parseFile(); }
+
+ static std::string getUsageInformation();
+
+ static const CommandLineArgument* getArgument(const std::string& name);
+ //! Writes the argument value in the given parameter.
+ template <class T>
+ static void getValue(const std::string& name, T* value)
+ { *value = (T)(getArgument(name)->getValue()); }
+ static MultiType getValue(const std::string& name)
+ { return getArgument(name)->getValue(); }
+ template <class T>
+ static CommandLineArgument& addArgument(const std::string& name, T defaultValue, bool bCommandLineOnly);
+
+ static bool existsArgument(const std::string& name)
+ {
+ std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.find(name);
+ return !(it == _getInstance().cmdLineArgs_.end());
+ }
+
+ static void destroyAllArguments();
+
+ private:
+ //! Constructor initialises bFirstTimeParse_ with true.
+ CommandLineParser() : bFirstTimeParse_(true) { }
+ //! Undefined copy constructor
+ CommandLineParser(const CommandLineParser& instance);
+ ~CommandLineParser();
+
+ static CommandLineParser& _getInstance();
+
+ void _parseCommandLine(const std::string& cmdLine);
+ void _parseFile();
+ void _parse(const std::vector<std::string>& arguments, bool bParsingFile);
+ void checkFullArgument(const std::string& name, const std::string& value, bool bParsingFile);
+ void checkShortcut(const std::string& shortcut, const std::string& value, bool bParsingFile);
+
+ /**
+ Tells whether we parsed for the first time. The CommmandLineArguments are added before main().
+ So when we call parse() the first time, we need to create a map with all shortcuts since these
+ get added after addCommandLineArgument().
+ */
+ bool bFirstTimeParse_;
+
+ //! Holds all pointers to the arguments and serves as a search map by name.
+ std::map<std::string, CommandLineArgument*> cmdLineArgs_;
+ //! Search map by shortcut for the arguments.
+ std::map<std::string, CommandLineArgument*> cmdLineArgsShortcut_;
+ };
+
+ template <>
+ inline void CommandLineParser::getValue<std::string>(const std::string& name, std::string* value)
+ {
+ *value = getArgument(name)->getValue().getString();
+ }
+
+ /**
+ @brief
+ Adds a new CommandLineArgument to the internal map.
+ Note that only such arguments are actually valid.
+ @param name
+ Name of the argument. Shortcut can be added later.
+ @param defaultValue
+ Default value that is used when argument was not given.
+ */
+ template <class T>
+ CommandLineArgument& CommandLineParser::addArgument(const std::string& name, T defaultValue, bool bCommandLineOnly)
+ {
+ OrxAssert(!_getInstance().existsArgument(name),
+ "Cannot add a command line argument with name '" + name + "' twice.");
+ OrxAssert(MultiType(defaultValue).getType() != MT_Type::Bool || MultiType(defaultValue).getBool() != true,
+ "Boolean command line arguments with positive default values are not supported." << std::endl
+ << "Please use SetCommandLineSwitch and adjust your argument: " << name);
+
+ return *(_getInstance().cmdLineArgs_[name] = new CommandLineArgument(name, defaultValue, bCommandLineOnly));
+ }
+}
+
+#endif /* _CommandLine_H__ */
Modified: sandbox_light/src/libraries/core/Core.cc
===================================================================
--- sandbox_light/src/libraries/core/Core.cc 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/libraries/core/Core.cc 2009-11-05 21:15:05 UTC (rev 6040)
@@ -36,11 +36,8 @@
#include "Core.h"
#include <cassert>
-#include <fstream>
-#include <cstdlib>
-#include <cstdio>
-#include <boost/version.hpp>
-#include <boost/filesystem.hpp>
+#include <ctime>
+#include <vector>
#ifdef ORXONOX_PLATFORM_WINDOWS
# ifndef WIN32_LEAN_AND_MEAN
@@ -49,35 +46,21 @@
# include <windows.h>
# undef min
# undef max
-#elif defined(ORXONOX_PLATFORM_APPLE)
-# include <sys/param.h>
-# include <mach-o/dyld.h>
-#else /* Linux */
-# include <sys/types.h>
-# include <unistd.h>
#endif
-#include "SpecialConfig.h"
+#include "util/Clock.h"
#include "util/Debug.h"
#include "util/Exception.h"
#include "util/SignalHandler.h"
-#include "Clock.h"
-#include "CommandLine.h"
+#include "PathConfig.h"
+#include "CommandLineParser.h"
#include "LuaState.h"
-// Boost 1.36 has some issues with deprecated functions that have been omitted
-#if (BOOST_VERSION == 103600)
-# define BOOST_LEAF_FUNCTION filename
-#else
-# define BOOST_LEAF_FUNCTION leaf
-#endif
-
namespace orxonox
{
//! Static pointer to the singleton
Core* Core::singletonPtr_s = 0;
- SetCommandLineOnlyArgument(writingPathSuffix, "").information("Additional subfolder for config and log files");
SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file");
#ifdef ORXONOX_PLATFORM_WINDOWS
SetCommandLineArgument(limitToCPU, 0).information("Limits the program to one cpu/core (1, 2, 3, etc.). 0 turns it off (default)");
@@ -150,46 +133,38 @@
int softDebugLevelLogfile_; //!< The debug level for the logfile
int softDebugLevelShell_; //!< The debug level for the ingame shell
bool bInitializeRandomNumberGenerator_; //!< If true, srand(time(0)) is called
-
- //! Path to the parent directory of the ones above if program was installed with relativ pahts
- boost::filesystem::path rootPath_;
- boost::filesystem::path executablePath_; //!< Path to the executable
- boost::filesystem::path dataPath_; //!< Path to the data file folder
- boost::filesystem::path configPath_; //!< Path to the config file folder
- boost::filesystem::path logPath_; //!< Path to the log file folder
};
Core::Core(const std::string& cmdLine)
// Cleanup guard for identifier destruction (incl. XMLPort, configValues, consoleCommands)
: configuration_(new CoreConfiguration()) // Don't yet create config values!
- , bDevRun_(false)
{
// Set the hard coded fixed paths
- this->setFixedPaths();
+ this->pathConfig_.reset(new PathConfig());
// Parse command line arguments AFTER the modules have been loaded (static code!)
- CommandLine::parseCommandLine(cmdLine);
+ CommandLineParser::parseCommandLine(cmdLine);
// Set configurable paths like log, config and media
- this->setConfigurablePaths();
+ this->pathConfig_->setConfigurablePaths();
// create a signal handler (only active for linux)
// This call is placed as soon as possible, but after the directories are set
this->signalHandler_.reset(new SignalHandler());
- this->signalHandler_->doCatch(configuration_->executablePath_.string(), Core::getLogPathString() + "orxonox_crash.log");
+ this->signalHandler_->doCatch(PathConfig::getExecutablePathString(), PathConfig::getLogPathString() + "orxonox_crash.log");
// Set the correct log path. Before this call, /tmp (Unix) or %TEMP% was used
- OutputHandler::getOutStream().setLogPath(Core::getLogPathString());
+ OutputHandler::getOutStream().setLogPath(PathConfig::getLogPathString());
// Parse additional options file now that we know its path
- CommandLine::parseFile();
+ CommandLineParser::parseFile();
#ifdef ORXONOX_PLATFORM_WINDOWS
// limit the main thread to the first core so that QueryPerformanceCounter doesn't jump
// do this after ogre has initialised. Somehow Ogre changes the settings again (not through
// the timer though).
- int limitToCPU = CommandLine::getValue("limitToCPU");
+ int limitToCPU = CommandLineParser::getValue("limitToCPU");
if (limitToCPU > 0)
setThreadAffinity(static_cast<unsigned int>(limitToCPU));
#endif
@@ -249,42 +224,6 @@
OutputHandler::setSoftDebugLevel(device, level);
}
- /*static*/ const boost::filesystem::path& Core::getDataPath()
- {
- return getInstance().configuration_->dataPath_;
- }
- /*static*/ std::string Core::getDataPathString()
- {
- return getInstance().configuration_->dataPath_.string() + '/';
- }
-
- /*static*/ const boost::filesystem::path& Core::getConfigPath()
- {
- return getInstance().configuration_->configPath_;
- }
- /*static*/ std::string Core::getConfigPathString()
- {
- return getInstance().configuration_->configPath_.string() + '/';
- }
-
- /*static*/ const boost::filesystem::path& Core::getLogPath()
- {
- return getInstance().configuration_->logPath_;
- }
- /*static*/ std::string Core::getLogPathString()
- {
- return getInstance().configuration_->logPath_.string() + '/';
- }
-
- /*static*/ const boost::filesystem::path& Core::getRootPath()
- {
- return getInstance().configuration_->rootPath_;
- }
- /*static*/ std::string Core::getRootPathString()
- {
- return getInstance().configuration_->rootPath_.string() + '/';
- }
-
/**
@note
The code of this function has been copied and adjusted from OGRE, an open source graphics engine.
@@ -330,163 +269,4 @@
SetThreadAffinityMask(GetCurrentThread(), threadMask);
#endif
}
-
- /**
- @brief
- Retrievs the executable path and sets all hard coded fixed path (currently only the module path)
- Also checks for "orxonox_dev_build.keep_me" in the executable diretory.
- If found it means that this is not an installed run, hence we
- don't write the logs and config files to ~/.orxonox
- @throw
- GeneralException
- */
- void Core::setFixedPaths()
- {
- //////////////////////////
- // FIND EXECUTABLE PATH //
- //////////////////////////
-
-#ifdef ORXONOX_PLATFORM_WINDOWS
- // get executable module
- TCHAR buffer[1024];
- if (GetModuleFileName(NULL, buffer, 1024) == 0)
- ThrowException(General, "Could not retrieve executable path.");
-
-#elif defined(ORXONOX_PLATFORM_APPLE)
- char buffer[1024];
- unsigned long path_len = 1023;
- if (_NSGetExecutablePath(buffer, &path_len))
- ThrowException(General, "Could not retrieve executable path.");
-
-#else /* Linux */
- /* written by Nicolai Haehnle <prefect_ at gmx.net> */
-
- /* Get our PID and build the name of the link in /proc */
- char linkname[64]; /* /proc/<pid>/exe */
- if (snprintf(linkname, sizeof(linkname), "/proc/%i/exe", getpid()) < 0)
- {
- /* This should only happen on large word systems. I'm not sure
- what the proper response is here.
- Since it really is an assert-like condition, aborting the
- program seems to be in order. */
- assert(false);
- }
-
- /* Now read the symbolic link */
- char buffer[1024];
- int ret;
- ret = readlink(linkname, buffer, 1024);
- /* In case of an error, leave the handling up to the caller */
- if (ret == -1)
- ThrowException(General, "Could not retrieve executable path.");
-
- /* Ensure proper NUL termination */
- buffer[ret] = 0;
-#endif
-
- configuration_->executablePath_ = boost::filesystem::path(buffer);
-#ifndef ORXONOX_PLATFORM_APPLE
- configuration_->executablePath_ = configuration_->executablePath_.branch_path(); // remove executable name
-#endif
-
- /////////////////////
- // SET MODULE PATH //
- /////////////////////
-
- if (boost::filesystem::exists(configuration_->executablePath_ / "orxonox_dev_build.keep_me"))
- {
- COUT(1) << "Running from the build tree." << std::endl;
- Core::bDevRun_ = true;
- }
- else
- {
-
-#ifdef INSTALL_COPYABLE // --> relative paths
-
- // Also set the root path
- boost::filesystem::path relativeExecutablePath(specialConfig::defaultRuntimePath);
- configuration_->rootPath_ = configuration_->executablePath_;
- while (!boost::filesystem::equivalent(configuration_->rootPath_ / relativeExecutablePath, configuration_->executablePath_)
- && !configuration_->rootPath_.empty())
- configuration_->rootPath_ = configuration_->rootPath_.branch_path();
- if (configuration_->rootPath_.empty())
- ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?");
-
-#endif
- }
- }
-
- /**
- @brief
- Sets config, log and media path and creates folders if necessary.
- @throws
- GeneralException
- */
- void Core::setConfigurablePaths()
- {
- if (Core::isDevelopmentRun())
- {
- configuration_->dataPath_ = specialConfig::dataDevDirectory;
- configuration_->configPath_ = specialConfig::configDevDirectory;
- configuration_->logPath_ = specialConfig::logDevDirectory;
- }
- else
- {
-
-#ifdef INSTALL_COPYABLE // --> relative paths
-
- // Using paths relative to the install prefix, complete them
- configuration_->dataPath_ = configuration_->rootPath_ / specialConfig::defaultDataPath;
- configuration_->configPath_ = configuration_->rootPath_ / specialConfig::defaultConfigPath;
- configuration_->logPath_ = configuration_->rootPath_ / specialConfig::defaultLogPath;
-
-#else
-
- configuration_->dataPath_ = specialConfig::dataInstallDirectory;
-
- // Get user directory
-# ifdef ORXONOX_PLATFORM_UNIX /* Apple? */
- char* userDataPathPtr(getenv("HOME"));
-# else
- char* userDataPathPtr(getenv("APPDATA"));
-# endif
- if (userDataPathPtr == NULL)
- ThrowException(General, "Could not retrieve user data path.");
- boost::filesystem::path userDataPath(userDataPathPtr);
- userDataPath /= ".orxonox";
-
- configuration_->configPath_ = userDataPath / specialConfig::defaultConfigPath;
- configuration_->logPath_ = userDataPath / specialConfig::defaultLogPath;
-
-#endif
-
- }
-
- // Option to put all the config and log files in a separate folder
- if (!CommandLine::getArgument("writingPathSuffix")->hasDefaultValue())
- {
- std::string directory(CommandLine::getValue("writingPathSuffix").getString());
- configuration_->configPath_ = configuration_->configPath_ / directory;
- configuration_->logPath_ = configuration_->logPath_ / directory;
- }
-
- // Create directories to avoid problems when opening files in non existent folders.
- std::vector<std::pair<boost::filesystem::path, std::string> > directories;
- directories.push_back(std::make_pair(boost::filesystem::path(configuration_->configPath_), "config"));
- directories.push_back(std::make_pair(boost::filesystem::path(configuration_->logPath_), "log"));
-
- for (std::vector<std::pair<boost::filesystem::path, std::string> >::iterator it = directories.begin();
- it != directories.end(); ++it)
- {
- if (boost::filesystem::exists(it->first) && !boost::filesystem::is_directory(it->first))
- {
- ThrowException(General, std::string("The ") + it->second + " directory has been preoccupied by a file! \
- Please remove " + it->first.string());
- }
- if (boost::filesystem::create_directories(it->first)) // function may not return true at all (bug?)
- {
- COUT(4) << "Created " << it->second << " directory" << std::endl;
- }
- }
- }
}
Modified: sandbox_light/src/libraries/core/Core.h
===================================================================
--- sandbox_light/src/libraries/core/Core.h 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/libraries/core/Core.h 2009-11-05 21:15:05 UTC (rev 6040)
@@ -27,15 +27,6 @@
*
*/
-/**
- at file
- at brief
- Declaration of the Core class.
- at details
- The Core class is a singleton, only used to configure some variables
- in the core through the config-file.
-*/
-
#ifndef _Core_H__
#define _Core_H__
@@ -54,9 +45,6 @@
/**
@brief
The Core class is a singleton used to configure the program basics.
- @details
- The class provides information about the data, config and log path.
- It determines those by the use of platform specific functions.
@remark
You should only create this singleton once because it destroys the identifiers!
*/
@@ -81,38 +69,16 @@
static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);
static void setSoftDebugLevel(OutputHandler::OutputDevice device, int level);
- //! Returns the path to the data files as boost::filesystem::path
- static const boost::filesystem::path& getDataPath();
- //! Returns the path to the config files as boost::filesystem::path
- static const boost::filesystem::path& getConfigPath();
- //! Returns the path to the log files as boost::filesystem::path
- static const boost::filesystem::path& getLogPath();
- //! Returns the path to the root folder as boost::filesystem::path
- static const boost::filesystem::path& getRootPath();
- //! Returns the path to the data files as std::string
- static std::string getDataPathString();
- //! Returns the path to the config files as std::string
- static std::string getConfigPathString();
- //! Returns the path to the log files as std::string
- static std::string getLogPathString();
- //! Returns the path to the root folder as std::string
- static std::string getRootPathString();
-
- static bool isDevelopmentRun() { return getInstance().bDevRun_; }
-
private:
Core(const Core&); //!< Don't use (undefined symbol)
- void setFixedPaths();
- void setConfigurablePaths();
void setThreadAffinity(int limitToCPU);
// Mind the order for the destruction!
+ scoped_ptr<PathConfig> pathConfig_;
scoped_ptr<SignalHandler> signalHandler_;
scoped_ptr<CoreConfiguration> configuration_;
- bool bDevRun_; //!< True for runs in the build directory (not installed)
-
static Core* singletonPtr_s;
};
}
Modified: sandbox_light/src/libraries/core/CorePrereqs.h
===================================================================
--- sandbox_light/src/libraries/core/CorePrereqs.h 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/libraries/core/CorePrereqs.h 2009-11-05 21:15:05 UTC (rev 6040)
@@ -27,8 +27,9 @@
*/
/**
- @file
- @brief Contains all the necessary forward declarations for all classes and structs.
+ at file
+ at brief
+ Shared library macros, enums, constants and forward declarations for the core library
*/
#ifndef _CorePrereqs_H__
@@ -39,6 +40,7 @@
//-----------------------------------------------------------------------
// Shared library settings
//-----------------------------------------------------------------------
+
#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( CORE_STATIC_BUILD )
# ifdef CORE_SHARED_BUILD
# define _CoreExport __declspec(dllexport)
@@ -55,21 +57,31 @@
# define _CoreExport
#endif
+//-----------------------------------------------------------------------
+// Constants
+//-----------------------------------------------------------------------
+namespace orxonox
+{
+ static const uint32_t OBJECTID_UNKNOWN = static_cast<uint32_t>(-1);
+}
+
//-----------------------------------------------------------------------
-// Forward declarations
+// Enums
//-----------------------------------------------------------------------
+
namespace orxonox
{
namespace XMLPort
{
enum Mode
{
+ NOP,
LoadObject,
SaveObject,
ExpandObject
};
- }
+}
namespace KeybindMode
{
@@ -81,13 +93,18 @@
None
};
};
+}
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
typedef std::string LanguageEntryLabel;
class ArgumentCompleter;
class ArgumentCompletionListElement;
- class BaseFactory;
- class BaseMetaObjectListElement;
class BaseObject;
template <class T>
class ClassFactory;
@@ -97,10 +114,8 @@
class ClassTreeMaskIterator;
class ClassTreeMaskNode;
class ClassTreeMaskObjectIterator;
- class Clock;
class CommandEvaluation;
- class CommandExecutor;
- class CommandLine;
+ class CommandLineParser;
class CommandLineArgument;
class ConfigFile;
class ConfigFileEntry;
@@ -108,13 +123,14 @@
class ConfigFileEntryValue;
class ConfigFileManager;
class ConfigFileSection;
+ struct ConfigFileType;
class ConfigValueContainer;
class ConsoleCommand;
class Core;
class DynLib;
class DynLibManager;
struct Event;
- class EventContainer;
+ class EventState;
class Executor;
template <class T>
class ExecutorMember;
@@ -124,16 +140,17 @@
template <class T>
class FunctorMember;
class FunctorStatic;
+ class Game;
+ class GameState;
+ struct GameStateInfo;
+ struct GameStateTreeNode;
class GraphicsManager;
class GUIManager;
class Identifier;
class IRC;
template <class T>
class Iterator;
- class IteratorBase;
class Language;
- class LanguageEntry;
- class Loader;
class LuaState;
class MemoryArchive;
class MemoryArchiveFactory;
@@ -151,10 +168,13 @@
class ObjectListIterator;
class OgreWindowEventListener;
class OrxonoxClass;
+ class PathConfig;
struct ResourceInfo;
class Shell;
class ShellListener;
template <class T>
+ class SmartPtr;
+ template <class T>
class SubclassIdentifier;
class TclBind;
struct TclInterpreterBundle;
@@ -162,6 +182,10 @@
class TclThreadList;
class TclThreadManager;
class Template;
+ class Thread;
+ class ThreadPool;
+ template <class T>
+ class WeakPtr;
class WindowEventListener;
class XMLFile;
class XMLNameListener;
@@ -172,17 +196,10 @@
class XMLPortObjectContainer;
class XMLPortParamContainer;
- // game states
- class Game;
- class GameState;
- struct GameStateInfo;
- struct GameStateTreeNode;
-
- // input
+ // Input
class BaseCommand;
class BufferedParamCommand;
class Button;
- class CalibratorCallback;
class HalfAxis;
class InputBuffer;
class InputDevice;
@@ -191,18 +208,17 @@
class InputHandler;
class InputManager;
class InputState;
+ struct InputStatePriority;
+ class JoyStickQuantityListener;
class JoyStick;
- class Mouse;
+ class KeyBinder;
+ class KeyBinderManager;
class Keyboard;
- class KeyBinder;
class KeyDetector;
+ class KeyEvent;
+ class Mouse;
class ParamCommand;
class SimpleCommand;
-
-
- // multithreading
- class Thread;
- class ThreadPool;
}
// CppTcl
@@ -281,14 +297,7 @@
}
namespace orxonox
{
- using ticpp::Document;
using ticpp::Element;
- using ticpp::Declaration;
- using ticpp::StylesheetReference;
- using ticpp::Text;
- using ticpp::Comment;
- using ticpp::Attribute;
}
-
#endif /* _CorePrereqs_H__ */
Modified: sandbox_light/src/libraries/core/LuaState.cc
===================================================================
--- sandbox_light/src/libraries/core/LuaState.cc 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/libraries/core/LuaState.cc 2009-11-05 21:15:05 UTC (rev 6040)
@@ -37,7 +37,7 @@
}
#include "util/Debug.h"
-#include "Core.h"
+#include "PathConfig.h"
#include "ToluaBindCore.h"
namespace orxonox
@@ -105,7 +105,7 @@
shared_ptr<ResourceInfo> LuaState::getFileInfo(const std::string& filename)
{
- boost::filesystem::path filepath = Core::getDataPath() / "lua" / filename;
+ boost::filesystem::path filepath = PathConfig::getDataPath() / "lua" / filename;
if (boost::filesystem::exists(filepath))
{
shared_ptr<ResourceInfo> info(new ResourceInfo());
Copied: sandbox_light/src/libraries/core/PathConfig.cc (from rev 6039, sandbox/src/libraries/core/PathConfig.cc)
===================================================================
--- sandbox_light/src/libraries/core/PathConfig.cc (rev 0)
+++ sandbox_light/src/libraries/core/PathConfig.cc 2009-11-05 21:15:05 UTC (rev 6040)
@@ -0,0 +1,260 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "PathConfig.h"
+
+#include <cassert>
+#include <cstdlib>
+#include <cstdio>
+#include <vector>
+#include <boost/version.hpp>
+#include <boost/filesystem.hpp>
+
+#ifdef ORXONOX_PLATFORM_WINDOWS
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+# include <windows.h>
+# undef min
+# undef max
+#elif defined(ORXONOX_PLATFORM_APPLE)
+# include <sys/param.h>
+# include <mach-o/dyld.h>
+#else /* Linux */
+# include <sys/types.h>
+# include <unistd.h>
+#endif
+
+#include "SpecialConfig.h"
+#include "util/Debug.h"
+#include "util/Exception.h"
+#include "CommandLineParser.h"
+
+// Boost 1.36 has some issues with deprecated functions that have been omitted
+#if (BOOST_VERSION == 103600)
+# define BOOST_LEAF_FUNCTION filename
+#else
+# define BOOST_LEAF_FUNCTION leaf
+#endif
+
+namespace orxonox
+{
+ namespace bf = boost::filesystem;
+
+ //! Static pointer to the singleton
+ PathConfig* PathConfig::singletonPtr_s = 0;
+
+ SetCommandLineOnlyArgument(writingPathSuffix, "").information("Additional subfolder for config and log files");
+
+ PathConfig::PathConfig()
+ : rootPath_(*(new bf::path()))
+ , executablePath_(*(new bf::path()))
+ , dataPath_(*(new bf::path()))
+ , configPath_(*(new bf::path()))
+ , logPath_(*(new bf::path()))
+ , bDevRun_(false)
+ {
+ //////////////////////////
+ // FIND EXECUTABLE PATH //
+ //////////////////////////
+
+#ifdef ORXONOX_PLATFORM_WINDOWS
+ // get executable module
+ TCHAR buffer[1024];
+ if (GetModuleFileName(NULL, buffer, 1024) == 0)
+ ThrowException(General, "Could not retrieve executable path.");
+
+#elif defined(ORXONOX_PLATFORM_APPLE)
+ char buffer[1024];
+ unsigned long path_len = 1023;
+ if (_NSGetExecutablePath(buffer, &path_len))
+ ThrowException(General, "Could not retrieve executable path.");
+
+#else /* Linux */
+ /* written by Nicolai Haehnle <prefect_ at gmx.net> */
+
+ /* Get our PID and build the name of the link in /proc */
+ char linkname[64]; /* /proc/<pid>/exe */
+ if (snprintf(linkname, sizeof(linkname), "/proc/%i/exe", getpid()) < 0)
+ {
+ /* This should only happen on large word systems. I'm not sure
+ what the proper response is here.
+ Since it really is an assert-like condition, aborting the
+ program seems to be in order. */
+ assert(false);
+ }
+
+ /* Now read the symbolic link */
+ char buffer[1024];
+ int ret;
+ ret = readlink(linkname, buffer, 1024);
+ /* In case of an error, leave the handling up to the caller */
+ if (ret == -1)
+ ThrowException(General, "Could not retrieve executable path.");
+
+ /* Ensure proper NUL termination */
+ buffer[ret] = 0;
+#endif
+
+ executablePath_ = bf::path(buffer);
+#ifndef ORXONOX_PLATFORM_APPLE
+ executablePath_ = executablePath_.branch_path(); // remove executable name
+#endif
+
+ /////////////////////
+ // SET MODULE PATH //
+ /////////////////////
+
+ if (bf::exists(executablePath_ / "orxonox_dev_build.keep_me"))
+ {
+ COUT(1) << "Running from the build tree." << std::endl;
+ PathConfig::bDevRun_ = true;
+ }
+ else
+ {
+
+#ifdef INSTALL_COPYABLE // --> relative paths
+
+ // Also set the root path
+ bf::path relativeExecutablePath(specialConfig::defaultRuntimePath);
+ rootPath_ = executablePath_;
+ while (!bf::equivalent(rootPath_ / relativeExecutablePath, executablePath_) && !rootPath_.empty())
+ rootPath_ = rootPath_.branch_path();
+ if (rootPath_.empty())
+ ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?");
+
+#else
+
+ // There is no root path, so don't set it at all
+
+#endif
+ }
+ }
+
+ PathConfig::~PathConfig()
+ {
+ delete &rootPath_;
+ delete &executablePath_;
+ delete &dataPath_;
+ delete &configPath_;
+ delete &logPath_;
+ }
+
+ void PathConfig::setConfigurablePaths()
+ {
+ if (bDevRun_)
+ {
+ dataPath_ = specialConfig::dataDevDirectory;
+ configPath_ = specialConfig::configDevDirectory;
+ logPath_ = specialConfig::logDevDirectory;
+ }
+ else
+ {
+
+#ifdef INSTALL_COPYABLE // --> relative paths
+
+ // Using paths relative to the install prefix, complete them
+ dataPath_ = rootPath_ / specialConfig::defaultDataPath;
+ configPath_ = rootPath_ / specialConfig::defaultConfigPath;
+ logPath_ = rootPath_ / specialConfig::defaultLogPath;
+
+#else
+
+ dataPath_ = specialConfig::dataInstallDirectory;
+
+ // Get user directory
+# ifdef ORXONOX_PLATFORM_UNIX /* Apple? */
+ char* userDataPathPtr(getenv("HOME"));
+# else
+ char* userDataPathPtr(getenv("APPDATA"));
+# endif
+ if (userDataPathPtr == NULL)
+ ThrowException(General, "Could not retrieve user data path.");
+ bf::path userDataPath(userDataPathPtr);
+ userDataPath /= ".orxonox";
+
+ configPath_ = userDataPath / specialConfig::defaultConfigPath;
+ logPath_ = userDataPath / specialConfig::defaultLogPath;
+
+#endif
+
+ }
+
+ // Option to put all the config and log files in a separate folder
+ if (!CommandLineParser::getArgument("writingPathSuffix")->hasDefaultValue())
+ {
+ std::string directory(CommandLineParser::getValue("writingPathSuffix").getString());
+ configPath_ = configPath_ / directory;
+ logPath_ = logPath_ / directory;
+ }
+
+ // Create directories to avoid problems when opening files in non existent folders.
+ std::vector<std::pair<bf::path, std::string> > directories;
+ directories.push_back(std::make_pair(bf::path(configPath_), "config"));
+ directories.push_back(std::make_pair(bf::path(logPath_), "log"));
+
+ for (std::vector<std::pair<bf::path, std::string> >::iterator it = directories.begin();
+ it != directories.end(); ++it)
+ {
+ if (bf::exists(it->first) && !bf::is_directory(it->first))
+ {
+ ThrowException(General, std::string("The ") + it->second + " directory has been preoccupied by a file! \
+ Please remove " + it->first.string());
+ }
+ if (bf::create_directories(it->first)) // function may not return true at all (bug?)
+ {
+ COUT(4) << "Created " << it->second << " directory" << std::endl;
+ }
+ }
+ }
+
+ /*static*/ std::string PathConfig::getRootPathString()
+ {
+ return getInstance().rootPath_.string() + '/';
+ }
+
+ /*static*/ std::string PathConfig::getExecutablePathString()
+ {
+ return getInstance().executablePath_.string() + '/';
+ }
+
+ /*static*/ std::string PathConfig::getDataPathString()
+ {
+ return getInstance().dataPath_.string() + '/';
+ }
+
+ /*static*/ std::string PathConfig::getConfigPathString()
+ {
+ return getInstance().configPath_.string() + '/';
+ }
+
+ /*static*/ std::string PathConfig::getLogPathString()
+ {
+ return getInstance().logPath_.string() + '/';
+ }
+}
Copied: sandbox_light/src/libraries/core/PathConfig.h (from rev 6039, sandbox/src/libraries/core/PathConfig.h)
===================================================================
--- sandbox_light/src/libraries/core/PathConfig.h (rev 0)
+++ sandbox_light/src/libraries/core/PathConfig.h 2009-11-05 21:15:05 UTC (rev 6040)
@@ -0,0 +1,123 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _PathConfig_H__
+#define _PathConfig_H__
+
+#include "CorePrereqs.h"
+
+#include <string>
+#include <vector>
+#include "util/Singleton.h"
+
+namespace orxonox
+{
+ /**
+ @brief
+ The PathConfig class is a singleton used to configure different paths.
+ @details
+ The class provides information about the data, config, log, executable
+ and root path.
+ It determines those by the use of platform specific functions.
+ @remarks
+ Not all paths are always available:
+ - root only when installed copyable
+ - externalData only for development builds in the build tree
+ */
+ class _CoreExport PathConfig : public Singleton<PathConfig>
+ {
+ friend class Singleton<PathConfig>;
+ friend class Core;
+
+ public:
+ /**
+ @brief
+ Retrievs the executable path and sets all hard coded fixed paths (currently only the module path)
+ Also checks for "orxonox_dev_build.keep_me" in the executable diretory.
+ If found it means that this is not an installed run, hence we
+ don't write the logs and config files to ~/.orxonox
+ @throw
+ GeneralException
+ */
+ PathConfig();
+ ~PathConfig();
+
+ //! Returns the path to the root folder as boost::filesystem::path
+ static const boost::filesystem::path& getRootPath()
+ { return getInstance().rootPath_; }
+ //! Returns the path to the executable folder as boost::filesystem::path
+ static const boost::filesystem::path& getExecutablePath()
+ { return getInstance().executablePath_; }
+ //! Returns the path to the data files as boost::filesystem::path
+ static const boost::filesystem::path& getDataPath()
+ { return getInstance().dataPath_; }
+ //! Returns the path to the config files as boost::filesystem::path
+ static const boost::filesystem::path& getConfigPath()
+ { return getInstance().configPath_; }
+ //! Returns the path to the log files as boost::filesystem::path
+ static const boost::filesystem::path& getLogPath()
+ { return getInstance().logPath_; }
+
+ //! Returns the path to the root folder as std::string
+ static std::string getRootPathString();
+ //! Returns the path to the executable folder as std::string
+ static std::string getExecutablePathString();
+ //! Returns the path to the data files as std::string
+ static std::string getDataPathString();
+ //! Returns the path to the config files as std::string
+ static std::string getConfigPathString();
+ //! Returns the path to the log files as std::string
+ static std::string getLogPathString();
+
+ //! Return trrue for runs in the build directory (not installed)
+ static bool isDevelopmentRun() { return getInstance().bDevRun_; }
+
+ private:
+ PathConfig(const PathConfig&); //!< Don't use (undefined symbol)
+
+ /**
+ @brief
+ Sets config, log and media path and creates the folders if necessary.
+ @throws
+ GeneralException
+ */
+ void setConfigurablePaths();
+
+ //! Path to the parent directory of the ones above if program was installed with relativ paths
+ boost::filesystem::path& rootPath_;
+ boost::filesystem::path& executablePath_; //!< Path to the executable
+ boost::filesystem::path& dataPath_; //!< Path to the data files folder
+ boost::filesystem::path& configPath_; //!< Path to the config files folder
+ boost::filesystem::path& logPath_; //!< Path to the log files folder
+
+ bool bDevRun_; //!< True for runs in the build directory (not installed)
+ static PathConfig* singletonPtr_s;
+ };
+}
+
+#endif /* _PathConfig_H__ */
Modified: sandbox_light/src/libraries/util/CMakeLists.txt
===================================================================
--- sandbox_light/src/libraries/util/CMakeLists.txt 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/libraries/util/CMakeLists.txt 2009-11-05 21:15:05 UTC (rev 6040)
@@ -18,6 +18,7 @@
#
SET_SOURCE_FILES(UTIL_SRC_FILES
+ Clock.cc
Exception.cc
Math.cc
MultiType.cc
Copied: sandbox_light/src/libraries/util/Clock.cc (from rev 6039, sandbox/src/libraries/util/Clock.cc)
===================================================================
--- sandbox_light/src/libraries/util/Clock.cc (rev 0)
+++ sandbox_light/src/libraries/util/Clock.cc 2009-11-05 21:15:05 UTC (rev 6040)
@@ -0,0 +1,73 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "Clock.h"
+#include <ogremath/OgreTimer.h>
+
+namespace orxonox
+{
+ Clock::Clock()
+ : timer_(new Ogre::Timer())
+ , storedTime_(0)
+ , tickTime_(0)
+ , tickDt_(0)
+ , tickDtFloat_(0.0f)
+ , lastTimersTime_(0)
+ {
+ }
+
+ Clock::~Clock()
+ {
+ delete timer_;
+ }
+
+ void Clock::capture()
+ {
+ unsigned long timersTime = timer_->getMicroseconds();
+ tickTime_ = storedTime_ + timersTime;
+ tickDt_ = timersTime - lastTimersTime_;
+ tickDtFloat_ = static_cast<float>(tickDt_) / 1000000.0f;
+
+ if (timersTime > 0xFFFFFFFF/4)
+ {
+ // Ogre timer will overflow at 2^32 microseconds if unsigned long is 32 bit
+ storedTime_ += timersTime;
+ lastTimersTime_ = 0;
+ timer_->reset();
+ }
+ else
+ {
+ lastTimersTime_ = timersTime;
+ }
+ }
+
+ unsigned long long Clock::getRealMicroseconds() const
+ {
+ return this->timer_->getMicroseconds() + this->storedTime_;
+ }
+}
Copied: sandbox_light/src/libraries/util/Clock.h (from rev 6039, sandbox/src/libraries/util/Clock.h)
===================================================================
--- sandbox_light/src/libraries/util/Clock.h (rev 0)
+++ sandbox_light/src/libraries/util/Clock.h 2009-11-05 21:15:05 UTC (rev 6040)
@@ -0,0 +1,68 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _Clock_H__
+#define _Clock_H__
+
+#include "UtilPrereqs.h"
+
+namespace Ogre { class Timer; }
+
+namespace orxonox
+{
+ class _UtilExport Clock
+ {
+ public:
+ Clock();
+ ~Clock();
+
+ void capture();
+
+ unsigned long long getMicroseconds() const { return tickTime_; }
+ unsigned long long getMilliseconds() const { return tickTime_ / 1000; }
+ unsigned long getSeconds() const { return static_cast<long> (tickTime_ / 1000000); }
+ float getSecondsPrecise() const { return static_cast<float>(tickTime_ / 1000000.0f); }
+
+ float getDeltaTime() const { return tickDtFloat_; }
+ long getDeltaTimeMicroseconds() const { return tickDt_; }
+
+ unsigned long long getRealMicroseconds() const;
+
+ private:
+ Clock(const Clock& instance);
+
+ Ogre::Timer* timer_;
+ unsigned long long storedTime_;
+ unsigned long long tickTime_;
+ long tickDt_;
+ float tickDtFloat_;
+ unsigned long lastTimersTime_;
+ };
+}
+
+#endif /* _Clock_H__ */
Modified: sandbox_light/src/libraries/util/UtilPrereqs.h
===================================================================
--- sandbox_light/src/libraries/util/UtilPrereqs.h 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/libraries/util/UtilPrereqs.h 2009-11-05 21:15:05 UTC (rev 6040)
@@ -27,8 +27,9 @@
*/
/**
- @file
- @brief Contains all the necessary forward declarations for all classes and structs.
+ at file
+ at brief
+ Shared library macros, enums, constants and forward declarations for the util library
*/
#ifndef _UtilPrereqs_H__
@@ -39,6 +40,7 @@
//-----------------------------------------------------------------------
// Shared library settings
//-----------------------------------------------------------------------
+
#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( UTIL_STATIC_BUILD )
# ifdef UTIL_SHARED_BUILD
# define _UtilExport __declspec(dllexport)
@@ -55,13 +57,30 @@
# define _UtilExport
#endif
+//-----------------------------------------------------------------------
+// Enums
+//-----------------------------------------------------------------------
+namespace orxonox
+{
+ namespace ScopeID
+ {
+ //!A list of available scopes for the Scope template.
+ enum Value
+ {
+ Root,
+ Graphics
+ };
+ }
+}
+
//-----------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------
namespace orxonox
{
+ class Clock;
class Exception;
class ExprParser;
class IntVector2;
@@ -70,7 +89,14 @@
class OutputBuffer;
class OutputBufferListener;
class OutputHandler;
+ template <ScopeID::Value>
+ class Scope;
+ template <class, ScopeID::Value>
+ class ScopedSingleton;
+ class ScopeListener;
class SignalHandler;
+ template <class T>
+ class Singleton;
class SubString;
}
Modified: sandbox_light/src/orxonox/Main.cc
===================================================================
--- sandbox_light/src/orxonox/Main.cc 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/orxonox/Main.cc 2009-11-05 21:15:05 UTC (rev 6040)
@@ -30,14 +30,14 @@
/**
@file
@brief
- The main function of Orxonox.
+ The main function of Orxonox (but not the entry point of the program!)
*/
#include "OrxonoxPrereqs.h"
-#include "core/CommandLine.h"
+#include "util/Clock.h"
+#include "core/CommandLineParser.h"
#include "core/Core.h"
-#include "core/Clock.h"
#include "core/LuaState.h"
#include "ToluaBindOrxonox.h"
#include "Main.h"
@@ -52,7 +52,7 @@
/**
@brief
- Main method. Game starts here (except for static initialisations).
+ Starting point of orxonox (however not the entry point of the program!)
*/
int main(const std::string& strCmdLine)
{
Modified: sandbox_light/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- sandbox_light/src/orxonox/OrxonoxPrereqs.h 2009-11-05 20:33:47 UTC (rev 6039)
+++ sandbox_light/src/orxonox/OrxonoxPrereqs.h 2009-11-05 21:15:05 UTC (rev 6040)
@@ -27,18 +27,19 @@
*/
/**
- @file
- @brief Contains all the necessary forward declarations for all classes and structs.
+ at file
+ at brief
+ Shared library macros, enums, constants and forward declarations for the orxonox library
*/
#ifndef _OrxonoxPrereqs_H__
#define _OrxonoxPrereqs_H__
#include "OrxonoxConfig.h"
-
//-----------------------------------------------------------------------
// Shared library settings
//-----------------------------------------------------------------------
+
#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(ORXONOX_STATIC_BUILD)
# ifdef ORXONOX_SHARED_BUILD
# define _OrxonoxExport __declspec(dllexport)
@@ -62,71 +63,75 @@
namespace orxonox
{
class CameraManager;
+ class Level;
class LevelManager;
class PawnManager;
class PlayerManager;
-
- class Level;
+ class Radar;
class Scene;
- class Tickable;
- // interfaces
- class GametypeMessageListener;
- class NotificationListener;
- class PawnListener;
- class PlayerTrigger;
- class RadarListener;
- class RadarViewable;
- class Rewardable;
- class Teamcolourable;
+ // collisionshapes
+ class CollisionShape;
+ class CompoundCollisionShape;
+ class WorldEntityCollisionShape;
- // worldentities
- class WorldEntity;
- class StaticEntity;
- class MobileEntity;
- class ControllableEntity;
- class MovableEntity;
+ // controllers
+ class AIController;
+ class ArtificialController;
+ class Controller;
+ class HumanController;
+ class ScriptController;
+ class WaypointController;
+ class WaypointPatrolController;
+ // gametypes
+ class Asteroids;
+ class Deathmatch;
+ class Gametype;
+ class TeamBaseMatch;
+ class TeamDeathmatch;
+ class UnderAttack;
+
// graphics
- class Model;
+ class Backlight;
class Billboard;
class BlinkingBillboard;
- class BigExplosion;
- class ExplosionChunk;
+ class Camera;
class FadingBillboard;
class GlobalShader;
class Light;
- class Backlight;
+ class Model;
class ParticleEmitter;
class ParticleSpawner;
- class Camera;
- // mixed
- class SpawnPoint;
- class TeamSpawnPoint;
+ // infos
+ class Bot;
+ class GametypeInfo;
+ class HumanPlayer;
+ class Info;
+ class PlayerInfo;
- class CameraPosition;
- class Sublevel;
- class Radar;
+ // interfaces
+ class GametypeMessageListener;
+ class NotificationListener;
+ class PlayerTrigger;
+ class RadarListener;
+ class RadarViewable;
+ class Rewardable;
+ class TeamColourable;
- class Test;
+ // items
+ class Engine;
+ class Item;
+ class MultiStateEngine;
- // pawns
- class Spectator;
- class Pawn;
- class SpaceShip;
- class TeamBaseMatchBase;
- class Destroyer;
+ // overlays
+ class InGameConsole;
+ class Map;
+ class OrxonoxOverlay;
+ class OverlayGroup;
- // gametypes
- class Gametype;
- class Deathmatch;
- class TeamDeathmatch;
- class Asteroids;
- class TeamBaseMatch;
- class UnderAttack;
-
- // pickups
+ // pickup
class BaseItem;
class DroppedItem;
class EquipmentItem;
@@ -136,60 +141,44 @@
class PickupInventory;
class PickupSpawner;
class UsableItem;
-
- class Jump;
+ // pickup, items
+ class HealthImmediate;
class HealthUsable;
- class PassiveItem;
+ class Jump;
- // items
- class Item;
- class Engine;
- class MultiStateEngine;
- class RotatingEngine;
+ //sound
+ class AmbientSound;
+ class BaseSound;
+ class SoundManager;
+ class WorldSound;
// weaponsystem
- class WeaponSystem;
- class WeaponSet;
- class WeaponSlot;
- class WeaponPack;
- class Weapon;
- class WeaponMode;
class DefaultWeaponmodeLink;
class Munition;
+ class Weapon;
+ class WeaponMode;
+ class WeaponPack;
+ class WeaponSet;
+ class WeaponSlot;
+ class WeaponSystem;
- // controller
- class Controller;
- class HumanController;
- class ArtificialController;
- class AIController;
- class ScriptController;
- class WaypointController;
- class WaypointPatrolController;
-
- // infos
- class Info;
- class PlayerInfo;
- class HumanPlayer;
- class Bot;
- class GametypeInfo;
-
- // collision
- class CollisionShape;
- class CompoundCollisionShape;
- class WorldEntityCollisionShape;
-
- // overlays
- class OverlayGroup;
- class OrxonoxOverlay;
- class Notification;
- class NotificationManager;
- class InGameConsole;
- class Map;
-
- //sound
- class SoundBase;
- class SoundManager;
- class SoundMainMenu;
+ // worldentities
+ class BigExplosion;
+ class CameraPosition;
+ class ControllableEntity;
+ class ExplosionChunk;
+ class MobileEntity;
+ class MovableEntity;
+ class SpawnPoint;
+ class StaticEntity;
+ class TeamSpawnPoint;
+ class WorldEntity;
+ // worldentities, pawns
+ class Destroyer;
+ class Pawn;
+ class SpaceShip;
+ class Spectator;
+ class TeamBaseMatchBase;
}
// Bullet Physics Engine
More information about the Orxonox-commit
mailing list