[Orxonox-commit 4058] r8729 - in code/trunk: . cmake cmake/tools data/gui/scripts data/lua src src/external/bullet src/external/bullet/BulletCollision src/external/bullet/BulletDynamics src/external/bullet/LinearMath src/external/enet src/external/ogreceguirenderer src/external/ois src/external/ois/linux src/external/ois/mac src/external/ois/win32 src/external/tinyxml src/external/tolua/lua src/libraries/core src/libraries/core/command src/libraries/core/input src/libraries/network src/libraries/network/packet src/libraries/tools src/libraries/util src/modules/docking src/modules/notifications src/modules/objects/eventsystem src/modules/overlays/hud src/modules/pickup src/modules/pong src/modules/questsystem src/modules/weapons/munitions src/modules/weapons/projectiles src/orxonox src/orxonox/controllers src/orxonox/gamestates src/orxonox/gametypes src/orxonox/graphics src/orxonox/overlays src/orxonox/sound src/orxonox/weaponsystem
rgrieder at orxonox.net
rgrieder at orxonox.net
Mon Jul 4 02:47:45 CEST 2011
Author: rgrieder
Date: 2011-07-04 02:47:44 +0200 (Mon, 04 Jul 2011)
New Revision: 8729
Added:
code/trunk/cmake/tools/BuildUnits.cmake
code/trunk/src/BuildUnitsConfigGCC.cmake
code/trunk/src/BuildUnitsConfigMSVC.cmake
code/trunk/src/libraries/core/ToluaInterfaceHook.lua
code/trunk/src/libraries/util/tribool.h
Removed:
code/trunk/src/libraries/core/ToluaInterface.h
code/trunk/src/libraries/util/TriBool.h
Modified:
code/trunk/
code/trunk/cmake/CompilerConfigGCC.cmake
code/trunk/cmake/CompilerConfigMSVC.cmake
code/trunk/cmake/tools/GenerateToluaBindings.cmake
code/trunk/cmake/tools/SourceFileUtilities.cmake
code/trunk/cmake/tools/TargetUtilities.cmake
code/trunk/data/gui/scripts/ChatBox-inputonly.lua
code/trunk/data/gui/scripts/ChatBox.lua
code/trunk/data/gui/scripts/MenuSheet.lua
code/trunk/data/gui/scripts/MiscConfigMenu.lua
code/trunk/data/gui/scripts/NotificationLayer.lua
code/trunk/data/gui/scripts/SheetManager.lua
code/trunk/data/lua/Tools.lua
code/trunk/src/CMakeLists.txt
code/trunk/src/OrxonoxConfig.cmake
code/trunk/src/external/bullet/BulletCollision/CMakeLists.txt
code/trunk/src/external/bullet/BulletDynamics/CMakeLists.txt
code/trunk/src/external/bullet/CMakeLists.txt
code/trunk/src/external/bullet/LinearMath/CMakeLists.txt
code/trunk/src/external/enet/CMakeLists.txt
code/trunk/src/external/ogreceguirenderer/CMakeLists.txt
code/trunk/src/external/ois/CMakeLists.txt
code/trunk/src/external/ois/linux/CMakeLists.txt
code/trunk/src/external/ois/mac/CMakeLists.txt
code/trunk/src/external/ois/win32/CMakeLists.txt
code/trunk/src/external/tinyxml/CMakeLists.txt
code/trunk/src/external/tolua/lua/basic.lua
code/trunk/src/external/tolua/lua/package.lua
code/trunk/src/libraries/core/CMakeLists.txt
code/trunk/src/libraries/core/CommandLineParser.cc
code/trunk/src/libraries/core/CommandLineParser.h
code/trunk/src/libraries/core/ConfigValueIncludes.h
code/trunk/src/libraries/core/Core.cc
code/trunk/src/libraries/core/Core.h
code/trunk/src/libraries/core/CoreIncludes.h
code/trunk/src/libraries/core/EventIncludes.h
code/trunk/src/libraries/core/GUIManager.cc
code/trunk/src/libraries/core/GUIManager.h
code/trunk/src/libraries/core/Game.cc
code/trunk/src/libraries/core/LuaState.cc
code/trunk/src/libraries/core/LuaState.h
code/trunk/src/libraries/core/ObjectListBase.h
code/trunk/src/libraries/core/OrxonoxClass.h
code/trunk/src/libraries/core/PathConfig.cc
code/trunk/src/libraries/core/Super.h
code/trunk/src/libraries/core/ViewportEventListener.h
code/trunk/src/libraries/core/command/Functor.h
code/trunk/src/libraries/core/command/IOConsolePOSIX.cc
code/trunk/src/libraries/core/command/IOConsoleWindows.cc
code/trunk/src/libraries/core/command/IOConsoleWindows.h
code/trunk/src/libraries/core/command/Shell.cc
code/trunk/src/libraries/core/command/Shell.h
code/trunk/src/libraries/core/input/InputHandler.h
code/trunk/src/libraries/core/input/InputManager.cc
code/trunk/src/libraries/core/input/InputManager.h
code/trunk/src/libraries/core/input/InputPrereqs.h
code/trunk/src/libraries/core/input/InputState.cc
code/trunk/src/libraries/core/input/InputState.h
code/trunk/src/libraries/core/input/JoyStick.h
code/trunk/src/libraries/core/input/JoyStickQuantityListener.h
code/trunk/src/libraries/core/input/KeyBinderManager.h
code/trunk/src/libraries/core/input/KeyDetector.h
code/trunk/src/libraries/core/input/Keyboard.h
code/trunk/src/libraries/core/input/Mouse.cc
code/trunk/src/libraries/network/WANDiscoverable.h
code/trunk/src/libraries/network/packet/CMakeLists.txt
code/trunk/src/libraries/tools/CMakeLists.txt
code/trunk/src/libraries/tools/Shader.h
code/trunk/src/libraries/tools/Timer.cc
code/trunk/src/libraries/tools/Timer.h
code/trunk/src/libraries/util/CMakeLists.txt
code/trunk/src/libraries/util/Convert.h
code/trunk/src/libraries/util/Debug.h
code/trunk/src/libraries/util/Math.h
code/trunk/src/libraries/util/OutputHandler.cc
code/trunk/src/libraries/util/OutputHandler.h
code/trunk/src/libraries/util/UtilPrereqs.h
code/trunk/src/modules/docking/Dock.cc
code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc
code/trunk/src/modules/objects/eventsystem/EventFilter.cc
code/trunk/src/modules/objects/eventsystem/EventListener.cc
code/trunk/src/modules/overlays/hud/GametypeFadingMessage.h
code/trunk/src/modules/pickup/PickupCollectionIdentifier.h
code/trunk/src/modules/pickup/PickupManager.cc
code/trunk/src/modules/pong/CMakeLists.txt
code/trunk/src/modules/pong/PongAI.cc
code/trunk/src/modules/questsystem/QuestManager.cc
code/trunk/src/modules/weapons/munitions/ReplenishingMunition.cc
code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc
code/trunk/src/orxonox/CMakeLists.txt
code/trunk/src/orxonox/Main.cc
code/trunk/src/orxonox/controllers/AIController.cc
code/trunk/src/orxonox/controllers/AIController.h
code/trunk/src/orxonox/controllers/DroneController.cc
code/trunk/src/orxonox/controllers/DroneController.h
code/trunk/src/orxonox/gamestates/GSLevel.cc
code/trunk/src/orxonox/gametypes/Dynamicmatch.cc
code/trunk/src/orxonox/graphics/CMakeLists.txt
code/trunk/src/orxonox/overlays/InGameConsole.cc
code/trunk/src/orxonox/sound/BaseSound.cc
code/trunk/src/orxonox/weaponsystem/Munition.cc
code/trunk/src/orxonox/weaponsystem/WeaponSystem.cc
Log:
Merged unity_build branch back to trunk.
Features:
- Implemented fully automatic build units to speed up compilation if requested
- Added DOUT macro for quick debug output
- Activated text colouring in the POSIX IOConsole
- DeclareToluaInterface is not necessary anymore
Improvements:
- Output levels now change appropriately when switch back and forth from dev mode
- Log level for the file output is now also correct during startup
- Removed some header file dependencies in core and tools to speed up compilation
no more file for command line options
- Improved util::tribool by adapting some concepts from boost::tribool
Regressions:
- It is not possible anymore to specify command line arguments in an extra file because we've got config values for that purpose.
Property changes on: code/trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/ai:6592-7033
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/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/core5:5768-5928,6009
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/fps:6591-7072
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/menu:5941-6146,6148,7536-7687
/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/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/steering:5949-6091,8140-8595
/code/branches/tetris:8100-8563
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
+ /code/branches/ai:6592-7033
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/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/core5:5768-5928,6009
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/fps:6591-7072
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/menu:5941-6146,6148,7536-7687
/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/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/steering:5949-6091,8140-8595
/code/branches/tetris:8100-8563
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
Modified: code/trunk/cmake/CompilerConfigGCC.cmake
===================================================================
--- code/trunk/cmake/CompilerConfigGCC.cmake 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/cmake/CompilerConfigGCC.cmake 2011-07-04 00:47:44 UTC (rev 8729)
@@ -44,6 +44,13 @@
SET(PCH_COMPILER_SUPPORT TRUE)
ENDIF()
+# __COUNTER__ macro was only added in GCC 4.3
+# It might be required to make full build units work
+COMPARE_VERSION_STRINGS("${GCC_VERSION}" "4.3.0" _compare_result)
+IF(_compare_result GREATER -1)
+ SET(HAVE_COUNTER_MACRO TRUE)
+ENDIF()
+
# Also include environment flags. Could cause conflicts though
SET_COMPILER_FLAGS("$ENV{CXXFLAGS}" CXX CACHE)
SET_COMPILER_FLAGS("$ENV{CFLAGS}" C CACHE)
Modified: code/trunk/cmake/CompilerConfigMSVC.cmake
===================================================================
--- code/trunk/cmake/CompilerConfigMSVC.cmake 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/cmake/CompilerConfigMSVC.cmake 2011-07-04 00:47:44 UTC (rev 8729)
@@ -33,7 +33,11 @@
# Orxonox only supports MSVC 8 and above, which gets asserted above
SET(PCH_COMPILER_SUPPORT TRUE)
+# __COUNTER__ macro has been around since VS 2005
+# It might be required to make full build units work
+SET(HAVE_COUNTER_MACRO TRUE)
+
#################### Compiler Flags #####################
# CMake default flags : -DWIN32 -D_WINDOWS -W3 -Zm1000
Copied: code/trunk/cmake/tools/BuildUnits.cmake (from rev 8716, code/branches/unity_build/cmake/tools/BuildUnits.cmake)
===================================================================
--- code/trunk/cmake/tools/BuildUnits.cmake (rev 0)
+++ code/trunk/cmake/tools/BuildUnits.cmake 2011-07-04 00:47:44 UTC (rev 8729)
@@ -0,0 +1,146 @@
+ #
+ # ORXONOX - the hottest 3D action shooter ever to exist
+ # > www.orxonox.net <
+ #
+ # 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
+ #
+
+FUNCTION(GENERATE_BUILD_UNITS _target_name _all_files_var)
+ SET(_source_files)
+ SET(_total_file_count 0)
+
+ # Count the number of actual C++ source files
+ FOREACH(_file ${${_all_files_var}})
+ # Only look at C++ source files
+ IF(_file MATCHES "\\.(cpp|cc|cxx)$")
+ # Some files might be marked as not to compile at all
+ GET_SOURCE_FILE_PROPERTY(_skip1 ${_file} HEADER_FILE_ONLY)
+ GET_SOURCE_FILE_PROPERTY(_skip2 ${_file} EXCLUDE_FROM_BUILD_UNITS)
+ IF(NOT _skip1 AND NOT _skip2)
+ GET_SOURCE_FILE_PROPERTY(_size ${_file} BUILD_UNIT_SIZE)
+ IF(NOT _size)
+ SET(_size 1)
+ ENDIF()
+ # Append file AND size to the list (like storing an std::pair)
+ LIST(APPEND _source_files ${_file} ${_size})
+ MATH(EXPR _total_file_count "${_total_file_count} + ${_size}")
+ # Don't compile
+ SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES HEADER_FILE_ONLY TRUE)
+ ENDIF()
+ ENDIF()
+ ENDFOREACH(_file)
+
+ # Get number of build units we have to make. The default is NR_OF_BUILD_UNITS
+ # However we can specify different values in a config file
+ SET(_config ${BUILD_UNITS_CONFIG_${NR_OF_BUILD_UNITS}_THREADS})
+ SET(_nr_of_units)
+ IF(_config)
+ LIST(FIND _config ${_target_name} _index)
+ IF(NOT _index EQUAL -1)
+ # Nr of build units is the next element in the list (we assume it exists)
+ MATH(EXPR _index "${_index} + 1")
+ LIST(GET _config ${_index} _nr_of_units)
+ ENDIF()
+ ENDIF()
+ IF(NOT _nr_of_units)
+ # Use default as specified (e.g. "full4" --> 4) or 1 for externals
+ IF(_arg_ORXONOX_EXTERNAL)
+ SET(_nr_of_units 1)
+ ELSE()
+ SET(_nr_of_units ${NR_OF_BUILD_UNITS})
+ ENDIF()
+ ENDIF()
+
+ # Disable precompiled header files for targets with two or less build units
+ IF(_nr_of_units LESS 3)
+ SET(PCH_DISABLE_${_target_name} TRUE PARENT_SCOPE)
+ ENDIF()
+
+ SET(_remaining_files ${_total_file_count})
+ SET(_remaining_units ${_nr_of_units})
+ SET(_unit_nr 1)
+ # Loop counts back from ${_nr_of_units} to 1
+ FOREACH(_remaining_units RANGE ${_nr_of_units} 1 -1)
+ # Use integer division to get the current build unit size
+ MATH(EXPR _aimed_size "${_remaining_files} / ${_remaining_units}")
+
+ SET(_current_size 0)
+ SET(_current_unit)
+
+ SET(_file_index 0)
+ LIST(LENGTH _source_files _list_size)
+ WHILE(${_file_index} LESS ${_list_size} AND NOT ${_current_size} EQUAL ${_aimed_size})
+ # _source_files stores pairs of values (file followed by its size)
+ MATH(EXPR _size_index "${_file_index} + 1")
+ LIST(GET _source_files ${_file_index} _file)
+ LIST(GET _source_files ${_size_index} _size)
+
+ MATH(EXPR _new_size "${_current_size} + ${_size}")
+ IF(${_new_size} GREATER ${_aimed_size})
+ # Try next file in list (jump 2 because pairs are stored)
+ MATH(EXPR _file_index "${_file_index} + 2")
+ ELSE()
+ SET(_current_size ${_new_size})
+ LIST(APPEND _current_unit ${_file})
+ # Remove from _source_files list
+ LIST(REMOVE_AT _source_files ${_file_index} ${_size_index})
+ MATH(EXPR _list_size "${_list_size} - 2")
+ ENDIF()
+ ENDWHILE()
+
+ # Finalise
+ LIST(LENGTH _current_unit _nr_of_included_files)
+ IF(_nr_of_included_files EQUAL 1)
+ # If unit consists of one file, we can compile it the old fashioned way
+ SET_SOURCE_FILES_PROPERTIES(${_current_unit} PROPERTIES HEADER_FILE_ONLY FALSE)
+ ELSEIF(_nr_of_included_files GREATER 1)
+ # Assemble unit by writing some #include statements
+ SET(_include_string)
+ FOREACH(_file ${_current_unit})
+ SET(_include_string "${_include_string}#include \"${_file}\"\n")
+ ENDFOREACH(_file)
+
+ # Generate the filename
+ IF(NOT _nr_of_units EQUAL 1)
+ SET(_suffix ${_unit_nr})
+ ENDIF()
+ SET(_unit_file ${CMAKE_CURRENT_BINARY_DIR}/${_target_name}BuildUnit${_suffix}.cc)
+ # Only write if content has changed (avoids recompile)
+ IF(EXISTS ${_unit_file})
+ FILE(READ ${_unit_file} _file_include_string)
+ ENDIF()
+ IF(NOT _include_string STREQUAL "${_file_include_string}")
+ FILE(WRITE ${_unit_file} "${_include_string}")
+ ENDIF()
+
+ LIST(APPEND _build_units ${_unit_file})
+
+ # Increase file name counter
+ MATH(EXPR _unit_nr "${_unit_nr} + 1")
+ ENDIF()
+
+ # Compute remaining files
+ MATH(EXPR _remaining_files "${_remaining_files} - ${_current_size}")
+ ENDFOREACH(_remaining_units)
+
+ # Add units to list of source files (function, not macro --> parent scope)
+ # Do this ONCE because parent scope changes will NOT be visible here
+ SET(${_all_files_var} ${${_all_files_var}} ${_build_units} PARENT_SCOPE)
+
+ENDFUNCTION(GENERATE_BUILD_UNITS)
Modified: code/trunk/cmake/tools/GenerateToluaBindings.cmake
===================================================================
--- code/trunk/cmake/tools/GenerateToluaBindings.cmake 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/cmake/tools/GenerateToluaBindings.cmake 2011-07-04 00:47:44 UTC (rev 8729)
@@ -48,20 +48,25 @@
SET(_tolua_pkgfile "${CMAKE_CURRENT_BINARY_DIR}/tolua.pkg")
SET(_tolua_cxxfile "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ToluaBind${_tolua_package}.cc")
- SET(_tolua_hfile "${CMAKE_BINARY_DIR}/src/toluabind/${CMAKE_CFG_INTDIR}/ToluaBind${_tolua_package}.h")
+ #SET(_tolua_hfile "${CMAKE_BINARY_DIR}/src/toluabind/${CMAKE_CFG_INTDIR}/ToluaBind${_tolua_package}.h")
SET(${_target_source_files}
${${_target_source_files}}
${_tolua_cxxfile}
- ${_tolua_hfile}
PARENT_SCOPE
)
- # Disable annoying GCC warnings
IF(CMAKE_COMPILER_IS_GNU)
+ # Disable annoying GCC warnings
SET_SOURCE_FILES_PROPERTIES(${_tolua_cxxfile} PROPERTIES COMPILE_FLAGS "-w")
ENDIF()
+ IF(MSVC)
+ # Including the file in a build unit is impossible because CMAKE_CFG_INTDIR
+ # exands to an expression that the compiler doesn't understand
+ SET_SOURCE_FILES_PROPERTIES(${_tolua_cxxfile} PROPERTIES EXCLUDE_FROM_BUILD_UNITS TRUE)
+ ENDIF()
+
# Create temporary package file and implicit dependencies
FILE(REMOVE ${_tolua_pkgfile})
FOREACH(_tolua_inputfile ${_tolua_inputfiles})
@@ -69,13 +74,18 @@
LIST(APPEND _implicit_dependencies CXX ${_tolua_inputfile})
ENDFOREACH(_tolua_inputfile)
+ IF(TOLUA_PARSER_HOOK_SCRIPT)
+ # Hook scripts may contain functions that act as Tolua hooks
+ SET(_hook_script -L "${TOLUA_PARSER_HOOK_SCRIPT}")
+ ENDIF()
+
ADD_CUSTOM_COMMAND(
- OUTPUT ${_tolua_cxxfile} ${_tolua_hfile}
+ OUTPUT ${_tolua_cxxfile}
COMMAND toluaapp_orxonox -n ${_tolua_package}
-w ${CMAKE_CURRENT_SOURCE_DIR}
-o ${_tolua_cxxfile}
- -H ${_tolua_hfile}
-s ${TOLUA_PARSER_SOURCE}
+ ${_hook_script}
${_tolua_pkgfile}
DEPENDS ${TOLUA_PARSER_DEPENDENCIES}
IMPLICIT_DEPENDS ${_implicit_dependencies}
Modified: code/trunk/cmake/tools/SourceFileUtilities.cmake
===================================================================
--- code/trunk/cmake/tools/SourceFileUtilities.cmake 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/cmake/tools/SourceFileUtilities.cmake 2011-07-04 00:47:44 UTC (rev 8729)
@@ -24,10 +24,10 @@
# [ADD/SET]_SOURCE_FILES - Writes source files to the cache by force and
# adds the current directory.
# Also compiles multiple source files into a single
- # one by including them
- # Use COMPILATION_[BEGIN|END] in
+ # translation unit (faster)
+ # Use [END_]BUILD_UNIT in
# [ADD|SET]_SOURCE_FILES and specify the name of
- # the new source file after COMPILATION_BEGIN
+ # the new source file after BUILD_UNIT
# GET_ALL_HEADER_FILES - Finds all header files recursively.
# GENERATE_SOURCE_GROUPS - Set Visual Studio source groups.
#
@@ -35,7 +35,7 @@
FUNCTION(PREPARE_SOURCE_FILES)
SET(_source_files)
FOREACH(_file ${ARGN})
- IF(_file MATCHES "^(COMPILATION_BEGIN|COMPILATION_END)$")
+ IF(_file MATCHES "^(BUILD_UNIT|END_BUILD_UNIT)$")
# Append keywords verbatim
LIST(APPEND _source_files ${_file})
ELSE()
Modified: code/trunk/cmake/tools/TargetUtilities.cmake
===================================================================
--- code/trunk/cmake/tools/TargetUtilities.cmake 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/cmake/tools/TargetUtilities.cmake 2011-07-04 00:47:44 UTC (rev 8729)
@@ -39,6 +39,7 @@
# specified with PCH_FILE
# NO_INSTALL: Do not install the target at all
# NO_VERSION: Prevents adding any version to a target
+ # NO_BUILD_UNITS: Disables automatic (full) build units
#
# Lists:
# LINK_LIBRARIES: Redirects to TARGET_LINK_LIBRARIES
@@ -53,6 +54,9 @@
# PCH_FILE: Precompiled header file
# PCH_EXCLUDE: Source files to be excluded from PCH support
# OUTPUT_NAME: If you want a different name than the target name
+ # EXCLUDE_FROM_BUILD_UNITS: Specifies files that are not put into
+ # automatic (full) build units. They can still
+ # explicitely be included in a BUILD_UNIT (partial)
# Note:
# This function also installs the target!
# Prerequisistes:
@@ -61,6 +65,7 @@
# _target_name, ARGN for the macro arguments
#
+INCLUDE(BuildUnits)
INCLUDE(CMakeDependentOption)
INCLUDE(CapitaliseName)
INCLUDE(GenerateToluaBindings)
@@ -86,46 +91,54 @@
# Specify all possible options (either switch or with add. arguments)
SET(_switches FIND_HEADER_FILES EXCLUDE_FROM_ALL ORXONOX_EXTERNAL
NO_DLL_INTERFACE NO_SOURCE_GROUPS PCH_NO_DEFAULT
- NO_INSTALL NO_VERSION ${_additional_switches})
+ NO_INSTALL NO_VERSION NO_BUILD_UNITS
+ ${_additional_switches})
SET(_list_names LINK_LIBRARIES VERSION SOURCE_FILES
DEFINE_SYMBOL TOLUA_FILES PCH_FILE
PCH_EXCLUDE OUTPUT_NAME LINK_LIBS_LINUX
- LINK_LIBS_WIN32 LINK_LIBS_APPLE LINK_LIBS_UNIX)
+ LINK_LIBS_WIN32 LINK_LIBS_APPLE LINK_LIBS_UNIX
+ EXCLUDE_FROM_BUILD_UNITS)
PARSE_MACRO_ARGUMENTS("${_switches}" "${_list_names}" ${ARGN})
- # Process source files with support for compilations
+ # Process source files with support for build units
# Note: All file paths are relative to the root source directory, even the
- # name of the compilation file.
+ # name of the build unit.
SET(_${_target_name}_source_files)
- SET(_get_compilation_file FALSE)
- SET(_add_to_compilation FALSE)
+ SET(_get_build_unit_file FALSE)
+ SET(_add_to_build_unit FALSE)
FOREACH(_file ${_arg_SOURCE_FILES})
- IF(_file STREQUAL "COMPILATION_BEGIN")
- # Next file is the name of the compilation
- SET(_get_compilation_file TRUE)
- ELSEIF(_file STREQUAL "COMPILATION_END")
- IF(NOT _compilation_file)
- MESSAGE(FATAL_ERROR "No name provided for source file compilation")
+ IF(_file STREQUAL "BUILD_UNIT")
+ # Next file is the name of the build unit
+ SET(_get_build_unit_file TRUE)
+ ELSEIF(_file STREQUAL "END_BUILD_UNIT")
+ IF(NOT _build_unit_file)
+ MESSAGE(FATAL_ERROR "No name provided for build unit")
ENDIF()
- IF(NOT DISABLE_COMPILATIONS)
- IF(NOT _compilation_include_string)
- MESSAGE(STATUS "Warning: Empty source file compilation!")
+ IF(ENABLE_BUILD_UNITS)
+ IF(NOT _build_unit_include_string)
+ MESSAGE(STATUS "Warning: Empty build unit!")
ENDIF()
- IF(EXISTS ${_compilation_file})
- FILE(READ ${_compilation_file} _include_string_file)
+ IF(EXISTS ${_build_unit_file})
+ FILE(READ ${_build_unit_file} _include_string_file)
ENDIF()
- IF(NOT _compilation_include_string STREQUAL "${_include_string_file}")
- FILE(WRITE ${_compilation_file} "${_compilation_include_string}")
+ IF(NOT _build_unit_include_string STREQUAL "${_include_string_file}")
+ FILE(WRITE ${_build_unit_file} "${_build_unit_include_string}")
ENDIF()
- LIST(APPEND _${_target_name}_source_files ${_compilation_file})
+ LIST(APPEND _${_target_name}_source_files ${_build_unit_file})
+ LIST(APPEND _${_target_name}_build_units ${_build_unit_file})
+ # Store the number of files included. May be used for full build units.
+ SET_SOURCE_FILES_PROPERTIES(${_build_unit_file}
+ PROPERTIES BUILD_UNIT_SIZE "${_build_unit_count}")
ENDIF()
- SET(_add_to_compilation FALSE)
- ELSEIF(_get_compilation_file)
- SET(_compilation_file ${CMAKE_BINARY_DIR}/${_file})
- SET(_get_compilation_file FALSE)
- SET(_add_to_compilation TRUE)
- SET(_compilation_include_string)
+ SET(_add_to_build_unit FALSE)
+ ELSEIF(_get_build_unit_file)
+ # Note: ${_file} is relative to the binary directory
+ SET(_build_unit_file ${CMAKE_BINARY_DIR}/${_file})
+ SET(_get_build_unit_file FALSE)
+ SET(_add_to_build_unit TRUE)
+ SET(_build_unit_include_string)
+ SET(_build_unit_count "0")
ELSE()
# Default, add source file
@@ -145,10 +158,11 @@
LIST(APPEND _${_target_name}_source_files ${_file})
- # Handle compilations
- IF(_add_to_compilation AND NOT DISABLE_COMPILATIONS)
+ # Handle build units
+ IF(_add_to_build_unit AND ENABLE_BUILD_UNITS)
IF(_file MATCHES "\\.(c|cc|cpp|cxx)$")
- SET(_compilation_include_string "${_compilation_include_string}#include \"${_file}\"\n")
+ SET(_build_unit_include_string "${_build_unit_include_string}#include \"${_file}\"\n")
+ MATH(EXPR _build_unit_count "1 + ${_build_unit_count}")
ENDIF()
# Don't compile these files, even if they are source files
SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES HEADER_FILE_ONLY TRUE)
@@ -182,6 +196,20 @@
ENDIF()
ENDIF()
+ # Mark files to be excluded from build units
+ IF(_arg_EXCLUDE_FROM_BUILD_UNITS)
+ SET_SOURCE_FILES_PROPERTIES(${_arg_EXCLUDE_FROM_BUILD_UNITS}
+ PROPERTIES EXCLUDE_FROM_BUILD_UNITS TRUE)
+ ENDIF()
+
+ # Full build units
+ IF(ENABLE_BUILD_UNITS AND NOT _arg_NO_BUILD_UNITS)
+ # Use full build units even in partial mode for externals
+ IF(ENABLE_BUILD_UNITS MATCHES "full" OR _arg_ORXONOX_EXTERNAL)
+ GENERATE_BUILD_UNITS(${_target_name} _${_target_name}_files)
+ ENDIF()
+ ENDIF()
+
# First part (pre target) of precompiled header files
IF(PCH_COMPILER_SUPPORT AND _arg_PCH_FILE)
# Provide convenient option to control PCH
@@ -195,7 +223,7 @@
# Almost never used individually, but produces a lot of options --> hide
MARK_AS_ADVANCED(PCH_ENABLE_${_target_name_upper})
- IF(PCH_ENABLE_${_target_name_upper})
+ IF(PCH_ENABLE_${_target_name_upper} AND NOT PCH_DISABLE_${_target_name})
PRECOMPILED_HEADER_FILES_PRE_TARGET(${_target_name} ${_arg_PCH_FILE} _${_target_name}_files EXCLUDE ${_arg_PCH_EXCLUDE})
ENDIF()
ENDIF()
@@ -343,7 +371,7 @@
ENDIF()
# Second part of precompiled header files
- IF(PCH_COMPILER_SUPPORT AND PCH_ENABLE_${_target_name_upper} AND _arg_PCH_FILE)
+ IF(PCH_COMPILER_SUPPORT AND PCH_ENABLE_${_target_name_upper} AND _arg_PCH_FILE AND NOT PCH_DISABLE_${_target_name})
PRECOMPILED_HEADER_FILES_POST_TARGET(${_target_name} ${_arg_PCH_FILE})
ENDIF()
Modified: code/trunk/data/gui/scripts/ChatBox-inputonly.lua
===================================================================
--- code/trunk/data/gui/scripts/ChatBox-inputonly.lua 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/data/gui/scripts/ChatBox-inputonly.lua 2011-07-04 00:47:44 UTC (rev 8729)
@@ -1,5 +1,5 @@
-- ChatBox-inputonly.lua
-local P = createMenuSheet("ChatBox-inputonly", true, TriBool.True, TriBool.Dontcare, false)
+local P = createMenuSheet("ChatBox-inputonly", true, tribool(true), tribool(dontcare), false)
return P
Modified: code/trunk/data/gui/scripts/ChatBox.lua
===================================================================
--- code/trunk/data/gui/scripts/ChatBox.lua 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/data/gui/scripts/ChatBox.lua 2011-07-04 00:47:44 UTC (rev 8729)
@@ -1,6 +1,6 @@
-- ChatBox.lua
-local P = createMenuSheet("ChatBox", true, TriBool.True, TriBool.Dontcare, false)
+local P = createMenuSheet("ChatBox", true, tribool(true), tribool(dontcare), false)
function P.ChatBoxCloseButton_clicked(e)
orxonox.ChatInputHandler:getInstance():deactivate()
Modified: code/trunk/data/gui/scripts/MenuSheet.lua
===================================================================
--- code/trunk/data/gui/scripts/MenuSheet.lua 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/data/gui/scripts/MenuSheet.lua 2011-07-04 00:47:44 UTC (rev 8729)
@@ -10,12 +10,12 @@
-- Use this function to construct a new MenuSheet.
-- Parameters:
-- Except for _name, you can provide nil. Then the default value will be used.
--- For _tShowCusor and _tUseKeyboard you can specify TriBool.Dontcare if the value doesn't matter at all. Then the value of the underlaying sheet will be used.
+-- For _tShowCusor and _tUseKeyboard you can specify tribool(dontcare) if the value doesn't matter at all. Then the value of the underlaying sheet will be used.
function P.new(_name, _bHidePrevious, _tShowCursor, _tUseKeyboard, _bBlockJoyStick)
local newSheet = GUISheet.new(_name)
newSheet.bHidePrevious = handleDefArg(_bHidePrevious, true)
- newSheet.tShowCursor = handleDefArg(_tShowCusor, TriBool.True)
- newSheet.tUseKeyboard = handleDefArg(_tUseKeyboard, TriBool.True)
+ newSheet.tShowCursor = handleDefArg(_tShowCusor, tribool(true))
+ newSheet.tUseKeyboard = handleDefArg(_tUseKeyboard, tribool(true))
newSheet.bBlockJoyStick = handleDefArg(_bBlockJoyStick, false)
setmetatable(newSheet, P)
Modified: code/trunk/data/gui/scripts/MiscConfigMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/MiscConfigMenu.lua 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/data/gui/scripts/MiscConfigMenu.lua 2011-07-04 00:47:44 UTC (rev 8729)
@@ -1,6 +1,6 @@
-- MiscConfigMenu.lua
-local P = createMenuSheet("MiscConfigMenu", true, TriBool.True, TriBool.True)
+local P = createMenuSheet("MiscConfigMenu", true, tribool(true), tribool(true))
P.commandList = {}
P.nameList = {}
Modified: code/trunk/data/gui/scripts/NotificationLayer.lua
===================================================================
--- code/trunk/data/gui/scripts/NotificationLayer.lua 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/data/gui/scripts/NotificationLayer.lua 2011-07-04 00:47:44 UTC (rev 8729)
@@ -1,6 +1,6 @@
-- NotificationLayer.lua
-local P = createMenuSheet("NotificationLayer", true, TriBool.True, TriBool.True)
+local P = createMenuSheet("NotificationLayer", true, tribool(true), tribool(true))
P.queueList = {}
Modified: code/trunk/data/gui/scripts/SheetManager.lua
===================================================================
--- code/trunk/data/gui/scripts/SheetManager.lua 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/data/gui/scripts/SheetManager.lua 2011-07-04 00:47:44 UTC (rev 8729)
@@ -80,7 +80,7 @@
end
if bNoInput == true then
- menuSheet.tShowCursor = TriBool.Dontcare
+ menuSheet.tShowCursor = tribool(dontcare)
end
-- Add the sheet in a tuple of additional information
@@ -109,10 +109,10 @@
inputMgr:enterState(menuSheet.inputState)
end
- -- Only change cursor situation if menuSheet.tShowCursor ~= TriBool.Dontcare
- if menuSheet.tShowCursor == TriBool.True then
+ -- Only change cursor situation if menuSheet.tShowCursor ~= tribool(dontcare)
+ if menuSheet.tShowCursor == tribool(true) then
showCursor()
- elseif menuSheet.tShowCursor == TriBool.False then
+ elseif menuSheet.tShowCursor == tribool(false) then
hideCursor()
end
@@ -185,11 +185,11 @@
-- CURSOR SHOWING
local i = activeMenuSheets.size
- -- Find top most sheet that doesn't have tShowCusor == TriBool.Dontcare
- while i > 0 and activeMenuSheets[i].sheet.tShowCursor == TriBool.Dontcare do
+ -- Find top most sheet that doesn't have tShowCusor == tribool(dontcare)
+ while i > 0 and activeMenuSheets[i].sheet.tShowCursor == tribool(dontcare) do
i = i - 1
end
- if i > 0 and activeMenuSheets[i].sheet.tShowCursor == TriBool.True then
+ if i > 0 and activeMenuSheets[i].sheet.tShowCursor == tribool(true) then
showCursor()
else
hideCursor()
@@ -255,15 +255,15 @@
function windowResized(e)
for name, sheet in pairs(loadedSheets) do
- if orxonox.GraphicsManager:getInstance():isFullScreen() or sheet.tShowCursor == TriBool.False then
- inputMgr:setMouseExclusive(sheet.inputState, TriBool.True)
+ if orxonox.GraphicsManager:getInstance():isFullScreen() or sheet.tShowCursor == tribool(false) then
+ inputMgr:setMouseExclusive(sheet.inputState, tribool(true))
else
- inputMgr:setMouseExclusive(sheet.inputState, TriBool.False)
+ inputMgr:setMouseExclusive(sheet.inputState, tribool(false))
end
end
local sheetTuple = activeMenuSheets[activeMenuSheets.size]
if sheetTuple then
- if orxonox.GraphicsManager:getInstance():isFullScreen() and sheetTuple.sheet.tShowCursor ~= TriBool.False then
+ if orxonox.GraphicsManager:getInstance():isFullScreen() and sheetTuple.sheet.tShowCursor ~= tribool(false) then
showCursor()
else
hideCursor()
Modified: code/trunk/data/lua/Tools.lua
===================================================================
--- code/trunk/data/lua/Tools.lua 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/data/lua/Tools.lua 2011-07-04 00:47:44 UTC (rev 8729)
@@ -15,10 +15,6 @@
return 0
end
--- Short forms for TriBool
-TriBool =
-{
- True = orxonox.TriBool.True,
- False = orxonox.TriBool.False,
- Dontcare = orxonox.TriBool.Dontcare
-}
+-- Shortcuts for tribool
+tribool = orxonox.tribool
+dontcare = orxonox.dontcare_keyword_t()
Copied: code/trunk/src/BuildUnitsConfigGCC.cmake (from rev 8716, code/branches/unity_build/src/BuildUnitsConfigGCC.cmake)
===================================================================
--- code/trunk/src/BuildUnitsConfigGCC.cmake (rev 0)
+++ code/trunk/src/BuildUnitsConfigGCC.cmake 2011-07-04 00:47:44 UTC (rev 8729)
@@ -0,0 +1,74 @@
+ #
+ # ORXONOX - the hottest 3D action shooter ever to exist
+ # > www.orxonox.net <
+ #
+ # 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
+ # Description:
+ # Configures the number of build units per library
+ #
+
+SET(BUILD_UNITS_CONFIG_1_THREADS
+ util 1
+ core 2
+ network 1
+ tools 1
+ orxonox 8
+ designtools 1
+ notifications 1
+ objects 2
+ overlays 2
+ pickup 2
+ pong 1
+ questsystem 1
+ weapons 1
+)
+
+SET(BUILD_UNITS_CONFIG_2_THREADS ${BUILD_UNITS_CONFIG_1_THREADS})
+
+SET(BUILD_UNITS_CONFIG_4_THREADS
+ util 1
+ core 4
+ network 2
+ tools 2
+ orxonox 8
+ designtools 1
+ notifications 1
+ objects 2
+ overlays 2
+ pickup 1
+ pong 1
+ questsystem 1
+ weapons 1
+)
+
+SET(BUILD_UNITS_CONFIG_8_THREADS
+ util 2
+ core 8
+ network 5
+ tools 3
+ orxonox 8
+ designtools 1
+ notifications 1
+ objects 3
+ overlays 3
+ pickup 2
+ pong 1
+ questsystem 3
+ weapons 3
+)
Copied: code/trunk/src/BuildUnitsConfigMSVC.cmake (from rev 8716, code/branches/unity_build/src/BuildUnitsConfigMSVC.cmake)
===================================================================
--- code/trunk/src/BuildUnitsConfigMSVC.cmake (rev 0)
+++ code/trunk/src/BuildUnitsConfigMSVC.cmake 2011-07-04 00:47:44 UTC (rev 8729)
@@ -0,0 +1,88 @@
+ #
+ # ORXONOX - the hottest 3D action shooter ever to exist
+ # > www.orxonox.net <
+ #
+ # 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
+ # Description:
+ # Configures the number of build units per library
+ #
+
+SET(BUILD_UNITS_CONFIG_1_THREADS
+ util 1
+ core 1
+ network 1
+ tools 1
+ orxonox 2 # Avoids running out of symbol adresses (fix with /bigobj)
+ designtools 1
+ notifications 1
+ objects 1
+ overlays 1
+ pickup 1
+ pong 1
+ questsystem 1
+ weapons 1
+)
+
+SET(BUILD_UNITS_CONFIG_2_THREADS
+ util 1
+ core 2
+ network 1
+ tools 1
+ orxonox 2
+ designtools 1
+ notifications 1
+ objects 2
+ overlays 1
+ pickup 1
+ pong 1
+ questsystem 1
+ weapons 1
+)
+
+SET(BUILD_UNITS_CONFIG_4_THREADS
+ util 2
+ core 4
+ network 2
+ tools 2
+ orxonox 4
+ designtools 1
+ notifications 1
+ objects 2
+ overlays 2
+ pickup 1
+ pong 1
+ questsystem 2
+ weapons 2
+)
+
+SET(BUILD_UNITS_CONFIG_8_THREADS
+ util 2
+ core 8
+ network 5
+ tools 3
+ orxonox 8
+ designtools 1
+ notifications 1
+ objects 3
+ overlays 3
+ pickup 2
+ pong 1
+ questsystem 3
+ weapons 3
+)
Modified: code/trunk/src/CMakeLists.txt
===================================================================
--- code/trunk/src/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -65,10 +65,6 @@
REMOVE_LINKER_FLAGS("-INCREMENTAL:YES" Debug)
ADD_LINKER_FLAGS ("-INCREMENTAL:NO" Debug)
ENDIF()
- IF(NOT DISABLE_COMPILATIONS)
- # Compilations seem to generate 'memory leaks' with static variables
- MESSAGE("Warning: You should disable Compilations when using VLD!")
- ENDIF()
ENDIF()
ENDIF()
@@ -148,13 +144,10 @@
################### Tolua Bind ##################
-# Create directory because the tolua application doesn't work otherwise
-IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR})
- FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR})
-ENDIF()
+# Add hook script to the lua code that generates the bindings
+SET(TOLUA_PARSER_HOOK_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/libraries/core/ToluaInterfaceHook.lua)
+SET(TOLUA_PARSER_DEPENDENCIES ${TOLUA_PARSER_DEPENDENCIES} ${TOLUA_PARSER_HOOK_SCRIPT})
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR})
-
################ Sub Directories ################
ADD_SUBDIRECTORY(external)
Modified: code/trunk/src/OrxonoxConfig.cmake
===================================================================
--- code/trunk/src/OrxonoxConfig.cmake 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/OrxonoxConfig.cmake 2011-07-04 00:47:44 UTC (rev 8729)
@@ -33,8 +33,33 @@
OPTION(PCH_ENABLE "Global PCH switch" TRUE)
ENDIF()
-# Global switch to disable multiple file compilations
-OPTION(DISABLE_COMPILATIONS "Global multi-file compilation switch" FALSE)
+# Global option to steer building muliple files as a single one
+# off/false: Turn off completely
+# partial: Only combine files explicitly specified with BUILD_UNIT
+# full##: Use ## source files per orxonox library and use manual build units
+# for external dependencies. Example: full8 will in general use 8
+# source files per library, but more specifically tries to occupy
+# 8 CPU threads.
+# This is configured manually in BuildUnitsConfig.cmake
+SET(ENABLE_BUILD_UNITS "partial" CACHE STRING "Enables building multiple source files as one.")
+IF(ENABLE_BUILD_UNITS)
+ IF(NOT "${ENABLE_BUILD_UNITS}" STREQUAL "partial")
+ STRING(REGEX REPLACE "^full([1-9][0-9]?)$" "\\1" _nr_of_units "${ENABLE_BUILD_UNITS}")
+ IF("${_nr_of_units}" STREQUAL "${ENABLE_BUILD_UNITS}") # Regex match failed
+ MESSAGE(FATAL_ERROR "Unrecognised option for ENABLE_BUILD_UNITS: ${ENABLE_BUILD_UNITS}")
+ ELSE()
+ SET(NR_OF_BUILD_UNITS ${_nr_of_units})
+ IF(NOT HAVE_COUNTER_MACRO)
+ MESSAGE(WARNING "Your compiler doesn't support the __COUNTER__ macro. Full build units might not work!")
+ ENDIF()
+ ENDIF()
+ ENDIF()
+ IF(CMAKE_COMPILER_IS_GNU)
+ INCLUDE(BuildUnitsConfigGCC.cmake)
+ ELSEIF(MSVC)
+ INCLUDE(BuildUnitsConfigMSVC.cmake)
+ ENDIF()
+ENDIF()
# Use WinMain() or main()?
IF(WIN32)
Modified: code/trunk/src/external/bullet/BulletCollision/CMakeLists.txt
===================================================================
--- code/trunk/src/external/bullet/BulletCollision/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/external/bullet/BulletCollision/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -1,7 +1,5 @@
ADD_SOURCE_FILES(BULLET_FILES
-COMPILATION_BEGIN BulletCollisionCompilation.cpp
-
BroadphaseCollision/btAxisSweep3.cpp
BroadphaseCollision/btBroadphaseProxy.cpp
BroadphaseCollision/btCollisionAlgorithm.cpp
@@ -83,15 +81,12 @@
NarrowPhaseCollision/btGjkPairDetector.cpp
NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp
NarrowPhaseCollision/btPersistentManifold.cpp
+ NarrowPhaseCollision/btPolyhedralContactClipping.cpp
NarrowPhaseCollision/btRaycastCallback.cpp
NarrowPhaseCollision/btSubSimplexConvexCast.cpp
NarrowPhaseCollision/btVoronoiSimplexSolver.cpp
-COMPILATION_END
- # Raises compiler errors when compiled inside the compilation
- NarrowPhaseCollision/btPolyhedralContactClipping.cpp
-
# Headers
BroadphaseCollision/btAxisSweep3.h
BroadphaseCollision/btBroadphaseInterface.h
Modified: code/trunk/src/external/bullet/BulletDynamics/CMakeLists.txt
===================================================================
--- code/trunk/src/external/bullet/BulletDynamics/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/external/bullet/BulletDynamics/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -1,7 +1,5 @@
ADD_SOURCE_FILES(BULLET_FILES
-COMPILATION_BEGIN BulletDynamicsCompilation.cpp
-
Character/btKinematicCharacterController.cpp
ConstraintSolver/btConeTwistConstraint.cpp
@@ -25,8 +23,6 @@
Vehicle/btRaycastVehicle.cpp
Vehicle/btWheelInfo.cpp
-COMPILATION_END
-
# Headers
ConstraintSolver/btConeTwistConstraint.h
ConstraintSolver/btConstraintSolver.h
Modified: code/trunk/src/external/bullet/CMakeLists.txt
===================================================================
--- code/trunk/src/external/bullet/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/external/bullet/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -31,6 +31,8 @@
NO_DLL_INTERFACE
VERSION
2.78
+ EXCLUDE_FROM_BUILD_UNITS
+ BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp
SOURCE_FILES
${BULLET_FILES}
)
Modified: code/trunk/src/external/bullet/LinearMath/CMakeLists.txt
===================================================================
--- code/trunk/src/external/bullet/LinearMath/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/external/bullet/LinearMath/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -1,20 +1,18 @@
ADD_SOURCE_FILES(BULLET_FILES
-COMPILATION_BEGIN BulletLinearMathCompilation.cpp
btAlignedAllocator.cpp
btConvexHull.cpp
- btConvexHullComputer.cpp
+ btConvexHullComputer.cpp
btGeometryUtil.cpp
btQuickprof.cpp
btSerializer.cpp
-COMPILATION_END
# Headers
btAabbUtil2.h
btAlignedAllocator.h
btAlignedObjectArray.h
btConvexHull.h
- btConvexHullComputer.h
+ btConvexHullComputer.h
btDefaultMotionState.h
btGeometryUtil.h
btHashMap.h
Modified: code/trunk/src/external/enet/CMakeLists.txt
===================================================================
--- code/trunk/src/external/enet/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/external/enet/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -28,7 +28,6 @@
utility.h
win32.h
-COMPILATION_BEGIN ENetCompilation.c
callbacks.c
compress.c
host.c
@@ -38,7 +37,6 @@
protocol.c
unix.c
win32.c
-COMPILATION_END
)
ADD_COMPILER_FLAGS("-DHAS_POLL -DHAS_FCNTL -DHAS_MSGHDR_FLAGS -DHAS_SOCKLEN_T")
Modified: code/trunk/src/external/ogreceguirenderer/CMakeLists.txt
===================================================================
--- code/trunk/src/external/ogreceguirenderer/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/external/ogreceguirenderer/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -22,11 +22,9 @@
OgreCEGUIResourceProvider.h
OgreCEGUITexture.h
-COMPILATION_BEGIN OgreCEGUIRendererCompilation.cpp
OgreCEGUIRenderer.cpp
OgreCEGUIResourceProvider.cpp
OgreCEGUITexture.cpp
-COMPILATION_END
)
ORXONOX_ADD_LIBRARY(ogreceguirenderer_orxonox
Modified: code/trunk/src/external/ois/CMakeLists.txt
===================================================================
--- code/trunk/src/external/ois/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/external/ois/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -34,7 +34,6 @@
OISObject.h
OISPrereqs.h
-#COMPILATION_BEGIN OISCompilation.cpp
OISEffect.cpp
OISException.cpp
OISForceFeedback.cpp
@@ -42,8 +41,8 @@
OISJoyStick.cpp
OISKeyboard.cpp
OISObject.cpp
-#COMPILATION_END
)
+
IF(WIN32)
ADD_SUBDIRECTORY(win32)
ELSEIF(APPLE)
@@ -57,6 +56,11 @@
INCLUDE_DIRECTORIES(${WMI_INCLUDE_DIR})
ENDIF()
+# Apple has problems with OIS and build units
+IF(APPLE)
+ SET(USE_BUILD_UNITS NO_BUILD_UNITS)
+ENDIF()
+
ORXONOX_ADD_LIBRARY(ois_orxonox
ORXONOX_EXTERNAL
DEFINE_SYMBOL
@@ -71,6 +75,7 @@
/System/Library/Frameworks/Carbon.framework
LINK_LIBS_LINUX
X11
+ ${USE_BUILD_UNITS}
SOURCE_FILES
${OIS_FILES}
)
Modified: code/trunk/src/external/ois/linux/CMakeLists.txt
===================================================================
--- code/trunk/src/external/ois/linux/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/external/ois/linux/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -7,12 +7,10 @@
LinuxMouse.h
LinuxPrereqs.h
-COMPILATION_BEGIN OISLinuxCompilation.cpp
EventHelpers.cpp
LinuxForceFeedback.cpp
LinuxInputManager.cpp
LinuxJoyStickEvents.cpp
LinuxKeyboard.cpp
LinuxMouse.cpp
-COMPILATION_END
)
Modified: code/trunk/src/external/ois/mac/CMakeLists.txt
===================================================================
--- code/trunk/src/external/ois/mac/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/external/ois/mac/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -7,12 +7,10 @@
MacMouse.h
MacPrereqs.h
-#COMPILATION_BEGIN OISMacCompilation.cpp
MacHelpers.cpp
MacHIDManager.cpp
MacInputManager.cpp
MacJoyStick.cpp
MacKeyboard.cpp
MacMouse.cpp
-#COMPILATION_END
)
Modified: code/trunk/src/external/ois/win32/CMakeLists.txt
===================================================================
--- code/trunk/src/external/ois/win32/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/external/ois/win32/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -6,11 +6,9 @@
Win32Mouse.h
Win32Prereqs.h
-COMPILATION_BEGIN OISWin32Compilation.cpp
Win32ForceFeedback.cpp
Win32InputManager.cpp
Win32JoyStick.cpp
Win32KeyBoard.cpp
Win32Mouse.cpp
-COMPILATION_END
)
Modified: code/trunk/src/external/tinyxml/CMakeLists.txt
===================================================================
--- code/trunk/src/external/tinyxml/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/external/tinyxml/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -23,13 +23,11 @@
tinystr.h
tinyxml.h
-COMPILATION_BEGIN TicppCompilation.cpp
ticpp.cpp
tinystr.cpp
tinyxml.cpp
tinyxmlerror.cpp
tinyxmlparser.cpp
-COMPILATION_END
)
ORXONOX_ADD_LIBRARY(tinyxml_orxonox
Modified: code/trunk/src/external/tolua/lua/basic.lua
===================================================================
--- code/trunk/src/external/tolua/lua/basic.lua 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/external/tolua/lua/basic.lua 2011-07-04 00:47:44 UTC (rev 8729)
@@ -353,4 +353,6 @@
return nil
end
-
+-- called after all the required C++ includes have been written
+function post_include_hook(package_name)
+end
Modified: code/trunk/src/external/tolua/lua/package.lua
===================================================================
--- code/trunk/src/external/tolua/lua/package.lua 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/external/tolua/lua/package.lua 2011-07-04 00:47:44 UTC (rev 8729)
@@ -135,6 +135,8 @@
i = i+1
end
+ post_include_hook(self.name)
+
output('\n')
output('#ifdef ORXONOX_RELEASE\n')
output('# define TOLUA_RELEASE\n')
Modified: code/trunk/src/libraries/core/CMakeLists.txt
===================================================================
--- code/trunk/src/libraries/core/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -18,54 +18,53 @@
#
SET_SOURCE_FILES(CORE_SRC_FILES
+
+#BUILD_UNIT CoreStableBuildUnit.cc
+ ClassTreeMask.cc
CommandLineParser.cc
ConfigValueContainer.cc
- Core.cc
DynLib.cc
DynLibManager.cc
Event.cc
Game.cc
GameMode.cc
GameState.cc
- GraphicsManager.cc
- GUIManager.cc
+ Identifier.cc
Language.cc
+ Loader.cc
LuaState.cc
- ObjectListBase.cc
- OrxonoxClass.cc
- Resource.cc
-
- # hierarchy
- Identifier.cc
MetaObjectList.cc
-
- # level
- BaseObject.cc
- ClassTreeMask.cc
- Loader.cc
Namespace.cc
NamespaceNode.cc
+ ObjectListBase.cc
+ OrxonoxClass.cc
Template.cc
- XMLPort.cc
-
-COMPILATION_BEGIN ListenerCompilation.cc
ViewportEventListener.cc
WindowEventListener.cc
XMLNameListener.cc
-COMPILATION_END
+ XMLPort.cc
+#END_BUILD_UNIT
-COMPILATION_BEGIN FilesystemCompilation.cc
+ BaseObject.cc
+ Core.cc
+
+BUILD_UNIT OgreBuildUnit.cc
+ GraphicsManager.cc
+ GUIManager.cc
+ Resource.cc
+END_BUILD_UNIT
+
+BUILD_UNIT FilesystemBuildUnit.cc
command/ArgumentCompletionFunctions.cc
ConfigFileManager.cc
PathConfig.cc
-COMPILATION_END
+END_BUILD_UNIT
- # multithreading
- ThreadPool.cc
-COMPILATION_BEGIN ThreadCompilation.cc
+BUILD_UNIT ThreadBuildUnit.cc
command/TclThreadManager.cc
Thread.cc
-COMPILATION_END
+ ThreadPool.cc
+END_BUILD_UNIT
)
ADD_SUBDIRECTORY(command)
Modified: code/trunk/src/libraries/core/CommandLineParser.cc
===================================================================
--- code/trunk/src/libraries/core/CommandLineParser.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/CommandLineParser.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -40,8 +40,6 @@
namespace orxonox
{
- SetCommandLineOnlyArgument(optionsFile, "start.ini").shortcut("o");
-
/**
@brief
Parses a value string for a command line argument.
@@ -49,10 +47,8 @@
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)
+ void CommandLineArgument::parse(const std::string& value)
{
- 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
@@ -115,21 +111,21 @@
_getInstance().cmdLineArgs_.clear();
}
- /**
- @brief
- Reads the command line parses the values of each argument.
- It is then stored in the corresponding CommandLineArgument.
+ /** Parses the command line string for arguments and stores these.
@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
+ space separated 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.
- @param bParsingFile
- Parsing a file or the command line itself
+ @param cmdLine
+ Command line string WITHOUT the execution path.
*/
- void CommandLineParser::_parse(const std::vector<std::string>& arguments, bool bParsingFile)
+ void CommandLineParser::_parse(const std::string& cmdLine)
{
+ std::vector<std::string> arguments;
+ SubString tokens(cmdLine, " ", " ", false, '\\', true, '"', true, '\0', '\0', false);
+ for (unsigned i = 0; i < tokens.size(); ++i)
+ arguments.push_back(tokens[i]);
+
try
{
// why this? See bFirstTimeParse_ declaration.
@@ -176,13 +172,13 @@
value = removeTrailingWhitespaces(value);
if (!name.empty())
{
- checkFullArgument(name, value, bParsingFile);
+ checkFullArgument(name, value);
name.clear();
assert(shortcut.empty());
}
else if (!shortcut.empty())
{
- checkShortcut(shortcut, value, bParsingFile);
+ checkShortcut(shortcut, value);
shortcut.clear();
assert(name.empty());
}
@@ -221,18 +217,18 @@
value = removeTrailingWhitespaces(value);
if (!name.empty())
{
- checkFullArgument(name, value, bParsingFile);
+ checkFullArgument(name, value);
assert(shortcut.empty());
}
else if (!shortcut.empty())
{
- checkShortcut(shortcut, value, bParsingFile);
+ checkShortcut(shortcut, value);
assert(name.empty());
}
}
catch (const ArgumentException& ex)
{
- COUT(0) << "Could not parse command line (including additional files): " << ex.what() << std::endl;
+ COUT(0) << "Could not parse command line: " << ex.what() << std::endl;
COUT(0) << CommandLineParser::getUsageInformation() << std::endl;
throw GeneralException("");
}
@@ -248,13 +244,13 @@
@param bParsingFile
Parsing a file or the command line itself
*/
- void CommandLineParser::checkFullArgument(const std::string& name, const std::string& value, bool bParsingFile)
+ void CommandLineParser::checkFullArgument(const std::string& name, const std::string& value)
{
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);
+ it->second->parse(value);
}
/**
@@ -267,13 +263,13 @@
@param bParsingFile
Parsing a file or the command line itself
*/
- void CommandLineParser::checkShortcut(const std::string& shortcut, const std::string& value, bool bParsingFile)
+ void CommandLineParser::checkShortcut(const std::string& shortcut, const std::string& value)
{
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);
+ it->second->parse(value);
}
std::string CommandLineParser::getUsageInformation()
@@ -341,52 +337,4 @@
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, '\0', '\0', 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()
- {
- const 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, '\0', '\0', 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);
- }
}
Modified: code/trunk/src/libraries/core/CommandLineParser.h
===================================================================
--- code/trunk/src/libraries/core/CommandLineParser.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/CommandLineParser.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -50,18 +50,11 @@
#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)
+ = orxonox::CommandLineParser::addArgument(#name, defaultValue)
#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)
+ = orxonox::CommandLineParser::addArgument(#name, false)
-
namespace orxonox
{
/**
@@ -105,18 +98,17 @@
{ this->usageInformation_ = usage; return *this; }
//! Returns the actual value of the argument. Can be equal to default value.
- MultiType getValue() const { return value_; }
+ const MultiType& getValue() const { return value_; }
//! Returns the given default value as type T.
- MultiType getDefaultValue() const { return defaultValue_; }
+ const MultiType& getDefaultValue() const { return defaultValue_; }
private:
//! Constructor initialises both value_ and defaultValue_ with defaultValue.
- CommandLineArgument(const std::string& name, const MultiType& defaultValue, bool bCommandLineOnly)
+ CommandLineArgument(const std::string& name, const MultiType& defaultValue)
: bHasDefaultValue_(true)
, name_(name)
, value_(defaultValue)
, defaultValue_(defaultValue)
- , bCommandLineOnly_(bCommandLineOnly)
{ }
//! Undefined copy constructor
@@ -124,7 +116,7 @@
~CommandLineArgument() { }
//! Parses the value string of a command line argument.
- void parse(const std::string& value, bool bParsingFile);
+ void parse(const std::string& value);
//! Tells whether the value has been changed by the command line.
bool bHasDefaultValue_;
@@ -136,7 +128,6 @@
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
};
@@ -154,8 +145,8 @@
public:
//! Parse redirection to internal member method.
- static void parseCommandLine(const std::string& cmdLine) { _getInstance()._parseCommandLine(cmdLine); }
- static void parseFile() { _getInstance()._parseFile(); }
+ static void parse(const std::string& cmdLine)
+ { _getInstance()._parse(cmdLine); }
static std::string getUsageInformation();
@@ -164,10 +155,10 @@
template <class T>
static void getValue(const std::string& name, T* value)
{ *value = (T)(getArgument(name)->getValue()); }
- static MultiType getValue(const std::string& name)
+ static const 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 CommandLineArgument& addArgument(const std::string& name, T defaultValue);
static bool existsArgument(const std::string& name)
{
@@ -188,11 +179,9 @@
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);
+ void _parse(const std::string& cmdLine);
+ void checkFullArgument(const std::string& name, const std::string& value);
+ void checkShortcut(const std::string& shortcut, const std::string& value);
/**
Tells whether we parsed for the first time. The CommmandLineArguments are added before main().
@@ -221,11 +210,9 @@
Name of the argument. Shortcut can be added later.
@param defaultValue
Default value that is used when argument was not given.
- @param bCommandLineOnly
- Parsing a file or the command line itself
*/
template <class T>
- CommandLineArgument& CommandLineParser::addArgument(const std::string& name, T defaultValue, bool bCommandLineOnly)
+ CommandLineArgument& CommandLineParser::addArgument(const std::string& name, T defaultValue)
{
OrxAssert(!_getInstance().existsArgument(name),
"Cannot add a command line argument with name '" + name + "' twice.");
@@ -233,7 +220,7 @@
"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));
+ return *(_getInstance().cmdLineArgs_[name] = new CommandLineArgument(name, defaultValue));
}
}
Modified: code/trunk/src/libraries/core/ConfigValueIncludes.h
===================================================================
--- code/trunk/src/libraries/core/ConfigValueIncludes.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/ConfigValueIncludes.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -254,4 +254,19 @@
#define ModifyConfigValue(varname, modifier, ...) \
ModifyConfigValueGeneric(this, &varname, #varname, modifier, __VA_ARGS__)
+/** Modifies a runtime configurable value by using a modifier and some arguments.
+ If the container for the value doesn't yet exist, a warning is displayed.
+ Also, the @a variable argument will be modified and set to the current value.
+ at param variable
+ Pointer to the variable where the value should be written to
+ at param entryName
+ Name of the entry in the ini file (e.g. [MySection] myValue)
+ at param modifier
+ On of these functions: set, tset, add, remove, reset, update
+ at param ...
+ Arguments for the modifier function
+*/
+#define ModifyConfigValueExternal(variable, entryName, modifier, ...) \
+ ModifyConfigValueGeneric(this, &variable, entryName, modifier, __VA_ARGS__)
+
#endif /* _ConfigValueIncludes_H__ */
Modified: code/trunk/src/libraries/core/Core.cc
===================================================================
--- code/trunk/src/libraries/core/Core.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/Core.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -68,6 +68,7 @@
#include "Identifier.h"
#include "Language.h"
#include "LuaState.h"
+#include "ObjectList.h"
#include "command/ConsoleCommand.h"
#include "command/IOConsole.h"
#include "command/TclBind.h"
@@ -130,7 +131,7 @@
}
// Parse command line arguments AFTER the modules have been loaded (static code!)
- CommandLineParser::parseCommandLine(cmdLine);
+ CommandLineParser::parse(cmdLine);
// Set configurable paths like log, config and media
this->pathConfig_->setConfigurablePaths();
@@ -143,9 +144,6 @@
// Set the correct log path. Before this call, /tmp (Unix) or %TEMP% (Windows) was used
OutputHandler::getInstance().setLogPath(PathConfig::getLogPathString());
- // Parse additional options file now that we know its path
- 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
@@ -167,6 +165,8 @@
// possibility to configure everything below here
RegisterRootObject(Core);
this->setConfigValues();
+ // Rewrite the log file with the correct log levels
+ OutputHandler::getInstance().rewriteLogFile();
#if !defined(ORXONOX_PLATFORM_APPLE) && !defined(ORXONOX_USE_WINMAIN)
// Create persistent IO console
@@ -229,20 +229,25 @@
safeObjectDelete(&pathConfig_);
}
+ namespace DefaultLevelLogFile
+ {
+ const OutputLevel::Value Dev = OutputLevel::Debug;
+ const OutputLevel::Value User = OutputLevel::Info;
+ }
+
//! Function to collect the SetConfigValue-macro calls.
void Core::setConfigValues()
{
-#ifdef ORXONOX_RELEASE
- const unsigned int defaultLevelLogFile = 3;
-#else
- const unsigned int defaultLevelLogFile = 4;
-#endif
- SetConfigValueExternal(softDebugLevelLogFile_, "OutputHandler", "softDebugLevelLogFile", defaultLevelLogFile)
- .description("The maximum level of debug output shown in the log file");
- OutputHandler::getInstance().setSoftDebugLevel(OutputHandler::logFileOutputListenerName_s, this->softDebugLevelLogFile_);
+ // Choose the default level according to the path Orxonox was started (build directory or not)
+ OutputLevel::Value defaultLogLevel = (PathConfig::buildDirectoryRun() ? DefaultLevelLogFile::Dev : DefaultLevelLogFile::User);
+ SetConfigValueExternal(debugLevelLogFile_, "OutputHandler", "debugLevelLogFile", defaultLogLevel)
+ .description("The maximum level of debug output written to the log file");
+ OutputHandler::getInstance().setSoftDebugLevel("LogFile", debugLevelLogFile_);
+
SetConfigValue(bDevMode_, PathConfig::buildDirectoryRun())
- .description("Developer mode. If not set, hides some things from the user to not confuse him.");
+ .description("Developer mode. If not set, hides some things from the user to not confuse him.")
+ .callback(this, &Core::devModeChanged);
SetConfigValue(language_, Language::getInstance().defaultLanguage_)
.description("The language of the in game text")
.callback(this, &Core::languageChanged);
@@ -257,6 +262,39 @@
.description("Timestamp when the ogre config file was changed.");
}
+ /** Callback function for changes in the dev mode that affect debug levels.
+ The function behaves according to these rules:
+ - 'normal' mode is defined based on where the program was launched: if
+ the launch path was the build directory, development mode \c on is
+ normal, otherwise normal means development mode \c off.
+ - Debug levels should not be hard configured (\c config instead of
+ \c tconfig) in non 'normal' mode to avoid strange behaviour.
+ - Changing the development mode from 'normal' to the other state will
+ immediately change the debug levels to predefined values which can be
+ reconfigured with \c tconfig.
+ @note
+ The debug levels for the IOConsole and the InGameConsole can be found
+ in the Shell class. The same rules apply.
+ */
+ void Core::devModeChanged()
+ {
+ bool isNormal = (bDevMode_ == PathConfig::buildDirectoryRun());
+ if (isNormal)
+ {
+ ModifyConfigValueExternal(debugLevelLogFile_, "debugLevelLogFile", update);
+ }
+ else
+ {
+ OutputLevel::Value level = (bDevMode_ ? DefaultLevelLogFile::Dev : DefaultLevelLogFile::User);
+ ModifyConfigValueExternal(debugLevelLogFile_, "debugLevelLogFile", tset, level);
+ }
+
+ // Inform listeners
+ ObjectList<DevModeListener>::iterator it = ObjectList<DevModeListener>::begin();
+ for (; it != ObjectList<DevModeListener>::end(); ++it)
+ it->devModeChanged(bDevMode_);
+ }
+
//! Callback function if the language has changed.
void Core::languageChanged()
{
@@ -439,4 +477,10 @@
{
ModifyConfigValue(ogreConfigTimestamp_, set, static_cast<long long>(time(NULL)));
}
+
+
+ DevModeListener::DevModeListener()
+ {
+ RegisterRootObject(DevModeListener);
+ }
}
Modified: code/trunk/src/libraries/core/Core.h
===================================================================
--- code/trunk/src/libraries/core/Core.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/Core.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -44,14 +44,21 @@
#include "CorePrereqs.h"
#include <string>
-#include <loki/ScopeGuard.h>
-
#include "util/DestructionHelper.h"
#include "util/Singleton.h"
#include "OrxonoxClass.h"
namespace orxonox
{
+ //! Informs about changes in the Development Mode.
+ class DevModeListener : virtual public OrxonoxClass
+ {
+ public:
+ DevModeListener();
+ virtual ~DevModeListener() {}
+ virtual void devModeChanged(bool value) = 0;
+ };
+
/**
@brief
The Core class is a singleton used to configure the program basics.
@@ -100,6 +107,7 @@
private:
Core(const Core&); //!< Don't use (undefined symbol)
+ void devModeChanged();
void languageChanged();
void initRandomNumberGenerator();
@@ -127,7 +135,7 @@
Scope<ScopeID::Graphics>* graphicsScope_;
bool bGraphicsLoaded_;
- int softDebugLevelLogFile_; //!< The debug level for the log file (belongs to OutputHandler)
+ int debugLevelLogFile_; //!< The debug level for the log file (belongs to OutputHandler)
std::string language_; //!< The language
bool bInitRandomNumberGenerator_; //!< If true, srand(time(0)) is called
bool bStartIOConsole_; //!< Set to false if you don't want to use the IOConsole
Modified: code/trunk/src/libraries/core/CoreIncludes.h
===================================================================
--- code/trunk/src/libraries/core/CoreIncludes.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/CoreIncludes.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -79,7 +79,6 @@
#include "util/Debug.h"
#include "Identifier.h"
-#include "SubclassIdentifier.h"
#include "ClassFactory.h"
#include "ObjectList.h"
Modified: code/trunk/src/libraries/core/EventIncludes.h
===================================================================
--- code/trunk/src/libraries/core/EventIncludes.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/EventIncludes.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -36,6 +36,8 @@
#define _EventIncludes_H__
#include "CorePrereqs.h"
+
+#include "Event.h"
#include "XMLPort.h"
#include "command/Executor.h"
Modified: code/trunk/src/libraries/core/GUIManager.cc
===================================================================
--- code/trunk/src/libraries/core/GUIManager.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/GUIManager.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -489,7 +489,7 @@
GUIManager::hideGUI(name);
}
- const std::string& GUIManager::createInputState(const std::string& name, TriBool::Value showCursor, TriBool::Value useKeyboard, bool bBlockJoyStick)
+ const std::string& GUIManager::createInputState(const std::string& name, tribool showCursor, tribool useKeyboard, bool bBlockJoyStick)
{
InputState* state = InputManager::getInstance().createInputState(name);
if (!state)
@@ -505,24 +505,24 @@
#ifdef ORXONOX_PLATFORM_APPLE
// There is no non exclusive mode on OS X yet
- state->setMouseExclusive(TriBool::True);
+ state->setMouseExclusive(true);
#else
- if (showCursor == TriBool::Dontcare)
- state->setMouseExclusive(TriBool::Dontcare);
- else if (GraphicsManager::getInstance().isFullScreen() || showCursor == TriBool::False)
- state->setMouseExclusive(TriBool::True);
+ if (showCursor == dontcare)
+ state->setMouseExclusive(dontcare);
+ else if (GraphicsManager::getInstance().isFullScreen() || showCursor == false)
+ state->setMouseExclusive(true);
else
- state->setMouseExclusive(TriBool::False);
+ state->setMouseExclusive(false);
#endif
- if (showCursor == TriBool::True)
+ if (showCursor == true)
state->setMouseHandler(this);
- else if (showCursor == TriBool::False)
+ else if (showCursor == false)
state->setMouseHandler(&InputHandler::EMPTY);
- if (useKeyboard == TriBool::True)
+ if (useKeyboard == true)
state->setKeyHandler(this);
- else if (useKeyboard == TriBool::False)
+ else if (useKeyboard == false)
state->setKeyHandler(&InputHandler::EMPTY);
if (bBlockJoyStick)
@@ -716,6 +716,14 @@
listbox->setItemTooltipsEnabled(enabled);
}
+ /** Helper method to get the developer's mode without having to export Core.h.
+ @see Core::inDevMode
+ */
+ /*static*/ bool GUIManager::inDevMode()
+ {
+ return Core::getInstance().inDevMode();
+ }
+
/**
@brief Callback of window event listener, called if the window is resized. Sets the display size of CEGUI.
*/
Modified: code/trunk/src/libraries/core/GUIManager.h
===================================================================
--- code/trunk/src/libraries/core/GUIManager.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/GUIManager.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -38,7 +38,6 @@
#include "CorePrereqs.h"
#include <map>
-#include <set>
#include <string>
#include <CEGUIForwardRefs.h>
#include <CEGUIVersion.h>
@@ -46,18 +45,12 @@
#include "util/DestructionHelper.h"
#include "util/OgreForwardRefs.h"
-#include "util/TriBool.h"
+#include "util/tribool.h"
#include "util/Singleton.h"
#include "input/InputHandler.h"
-#include "Core.h"
#include "OrxonoxClass.h"
#include "WindowEventListener.h"
-// Tolua includes (have to be relative to the current directory)
-/*
-$cfile "../util/TriBool.h" // tolua_export
-*/
-
#if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7
# define ORXONOX_OLD_CEGUI
#endif
@@ -66,6 +59,20 @@
{ // tolua_export
class PlayerInfo; // Forward declaration
+ // Acquaint Tolua with tribool
+ /* tolua_begin
+ struct dontcare_keyword_t
+ {
+ dontcare_keyword_t();
+ };
+ class tribool
+ {
+ tribool(bool value);
+ tribool(dontcare_keyword_t);
+ bool operator==(tribool);
+ };
+ tolua_end */
+
/**
@class GUIManager
@brief
@@ -103,14 +110,10 @@
void setBackgroundImage(const std::string& imageSet, const std::string imageName); // tolua_export
void setBackgroundImage(const std::string& image);
- /**
- @brief Helper method to get the developer's mode without having to export Core.h.
- @see Core::inDevMode
- */
- static bool inDevMode(void) { return Core::getInstance().inDevMode(); } // tolua_export
+ static bool inDevMode(void); // tolua_export
//! Creates a new InputState to be used with a GUI Sheet
- const std::string& createInputState(const std::string& name, TriBool::Value showCursor = TriBool::True, TriBool::Value useKeyboard = TriBool::True, bool bBlockJoyStick = false); // tolua_export
+ const std::string& createInputState(const std::string& name, tribool showCursor = tribool(true), tribool useKeyboard = tribool(true), bool bBlockJoyStick = false); // tolua_export
LuaState* getLuaState(void)
{ return this->luaState_; }
Modified: code/trunk/src/libraries/core/Game.cc
===================================================================
--- code/trunk/src/libraries/core/Game.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/Game.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -108,7 +108,7 @@
this->core_ = new Core(cmdLine);
// Do this after the Core creation!
- ClassIdentifier<Game>::getIdentifier("Game")->initialiseObject(this, "Game", true);
+ RegisterRootObject(Game);
this->setConfigValues();
// After the core has been created, we can safely instantiate the GameStates that don't require graphics
Modified: code/trunk/src/libraries/core/LuaState.cc
===================================================================
--- code/trunk/src/libraries/core/LuaState.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/LuaState.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -39,19 +39,12 @@
#include "util/Debug.h"
#include "util/Exception.h"
#include "Resource.h"
-#include "ToluaBindCore.h"
#include "command/IOConsole.h"
namespace orxonox
{
- LuaState::ToluaInterfaceMap LuaState::toluaInterfaces_s;
- std::vector<LuaState*> LuaState::instances_s;
-
const std::string LuaState::ERROR_HANDLER_NAME = "errorHandler";
- // Do this after declaring toluaInterfaces_s and instances_s to avoid larger problems
- DeclareToluaInterface(Core);
-
LuaState::LuaState()
: bIsRunning_(false)
, includeParseFunction_(NULL)
@@ -276,9 +269,21 @@
return IOConsole::exists();
}
+ /*static*/ LuaState::ToluaInterfaceMap& LuaState::getToluaInterfaces()
+ {
+ static ToluaInterfaceMap p;
+ return p;
+ }
+
+ /*static*/ std::vector<LuaState*>& LuaState::getInstances()
+ {
+ static std::vector<LuaState*> p;
+ return p;
+ }
+
/*static*/ bool LuaState::addToluaInterface(int (*function)(lua_State*), const std::string& name)
{
- for (ToluaInterfaceMap::const_iterator it = toluaInterfaces_s.begin(); it != toluaInterfaces_s.end(); ++it)
+ for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
{
if (it->first == name || it->second == function)
{
@@ -286,10 +291,10 @@
return true;
}
}
- toluaInterfaces_s[name] = function;
+ getToluaInterfaces()[name] = function;
// Open interface in all LuaStates
- for (std::vector<LuaState*>::const_iterator it = instances_s.begin(); it != instances_s.end(); ++it)
+ for (std::vector<LuaState*>::const_iterator it = getInstances().begin(); it != getInstances().end(); ++it)
(*function)((*it)->luaState_);
// Return dummy bool
@@ -298,22 +303,22 @@
/*static*/ bool LuaState::removeToluaInterface(const std::string& name)
{
- ToluaInterfaceMap::iterator it = toluaInterfaces_s.find(name);
- if (it == toluaInterfaces_s.end())
+ ToluaInterfaceMap::iterator it = getToluaInterfaces().find(name);
+ if (it == getToluaInterfaces().end())
{
COUT(2) << "Warning: Cannot remove Tolua interface '" << name << "': Not found" << std::endl;
return true;
}
// Close interface in all LuaStates
- for (std::vector<LuaState*>::const_iterator itState = instances_s.begin(); itState != instances_s.end(); ++itState)
+ for (std::vector<LuaState*>::const_iterator itState = getInstances().begin(); itState != getInstances().end(); ++itState)
{
lua_pushnil((*itState)->luaState_);
lua_setglobal((*itState)->luaState_, it->first.c_str());
}
// Remove entry
- toluaInterfaces_s.erase(it);
+ getToluaInterfaces().erase(it);
// Return dummy bool
return true;
@@ -321,13 +326,13 @@
/*static*/ void LuaState::openToluaInterfaces(lua_State* state)
{
- for (ToluaInterfaceMap::const_iterator it = toluaInterfaces_s.begin(); it != toluaInterfaces_s.end(); ++it)
+ for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
(*it->second)(state);
}
/*static*/ void LuaState::closeToluaInterfaces(lua_State* state)
{
- for (ToluaInterfaceMap::const_iterator it = toluaInterfaces_s.begin(); it != toluaInterfaces_s.end(); ++it)
+ for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
{
lua_pushnil(state);
lua_setglobal(state, it->first.c_str());
Modified: code/trunk/src/libraries/core/LuaState.h
===================================================================
--- code/trunk/src/libraries/core/LuaState.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/LuaState.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -47,10 +47,7 @@
#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
-#include <loki/ScopeGuard.h>
-#include "ToluaInterface.h"
-
namespace orxonox // tolua_export
{ // tolua_export
class LuaFunctor; // tolua_export
@@ -120,9 +117,27 @@
std::string (*includeParseFunction_)(const std::string&);
typedef std::map<std::string, int (*)(lua_State *L)> ToluaInterfaceMap;
- static ToluaInterfaceMap toluaInterfaces_s;
- static std::vector<LuaState*> instances_s;
+ static ToluaInterfaceMap& getToluaInterfaces();
+ static std::vector<LuaState*>& getInstances();
}; // tolua_export
+
+
+ //! Helper class that registers/unregisters tolua bindings
+ class ToluaBindingsHelper
+ {
+ public:
+ ToluaBindingsHelper(int (*function)(lua_State*), const std::string& libraryName)
+ : libraryName_(libraryName)
+ {
+ LuaState::addToluaInterface(function, libraryName_);
+ }
+ ~ToluaBindingsHelper()
+ {
+ LuaState::removeToluaInterface(libraryName_);
+ }
+ private:
+ std::string libraryName_;
+ };
} // tolua_export
#endif /* _LuaState_H__ */
Modified: code/trunk/src/libraries/core/ObjectListBase.h
===================================================================
--- code/trunk/src/libraries/core/ObjectListBase.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/ObjectListBase.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -40,9 +40,7 @@
#define _ObjectListBase_H__
#include "CorePrereqs.h"
-
#include <vector>
-#include "OrxonoxClass.h"
namespace orxonox
{
Modified: code/trunk/src/libraries/core/OrxonoxClass.h
===================================================================
--- code/trunk/src/libraries/core/OrxonoxClass.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/OrxonoxClass.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -44,10 +44,10 @@
#define _OrxonoxClass_H__
#include "CorePrereqs.h"
-#include "Super.h"
#include <set>
#include <vector>
+#include "Super.h"
/**
@def CCOUT
Modified: code/trunk/src/libraries/core/PathConfig.cc
===================================================================
--- code/trunk/src/libraries/core/PathConfig.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/PathConfig.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -73,7 +73,7 @@
PathConfig* PathConfig::singletonPtr_s = 0;
SetCommandLineArgument(externalDataPath, "").information("Path to the external data files");
- SetCommandLineOnlyArgument(writingPathSuffix, "").information("Additional subfolder for config and log files");
+ SetCommandLineArgument(writingPathSuffix, "").information("Additional subfolder for config and log files");
PathConfig::PathConfig()
: rootPath_(*(new bf::path()))
Modified: code/trunk/src/libraries/core/Super.h
===================================================================
--- code/trunk/src/libraries/core/Super.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/Super.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -72,9 +72,7 @@
#define _Super_H__
#include "CorePrereqs.h"
-
#include "util/Debug.h"
-#include "Event.h"
///////////////////////
// Macro definitions //
Deleted: code/trunk/src/libraries/core/ToluaInterface.h
===================================================================
--- code/trunk/src/libraries/core/ToluaInterface.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/ToluaInterface.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -1,47 +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:
- * ...
- *
- */
-
-/**
- at file
- at ingroup Lua
- at brief
- This is required because tolua would parse this macro in LuaState.h and fail
-*/
-
-#ifndef _ToluaInterface_H__
-#define _ToluaInterface_H__
-
-#include "CorePrereqs.h"
-#include <boost/preprocessor/cat.hpp>
-
-// Macro for declaring a tolua interface of a library/module
-#define DeclareToluaInterface(libraryName) \
- static bool BOOST_PP_CAT(bDummy##libraryName, __UNIQUE_NUMBER__) = orxonox::LuaState::addToluaInterface(&tolua_##libraryName##_open, #libraryName); \
- static Loki::ScopeGuardImpl1<bool (*)(const std::string&), std::string> BOOST_PP_CAT(dummy##libraryName, __UNIQUE_NUMBER__)(&orxonox::LuaState::removeToluaInterface, #libraryName)
-
-#endif /* _ToluaInterface_H__ */
Copied: code/trunk/src/libraries/core/ToluaInterfaceHook.lua (from rev 8716, code/branches/unity_build/src/libraries/core/ToluaInterfaceHook.lua)
===================================================================
--- code/trunk/src/libraries/core/ToluaInterfaceHook.lua (rev 0)
+++ code/trunk/src/libraries/core/ToluaInterfaceHook.lua 2011-07-04 00:47:44 UTC (rev 8729)
@@ -0,0 +1,30 @@
+--
+-- ORXONOX - the hottest 3D action shooter ever to exist
+-- > www.orxonox.net <
+--
+-- 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
+--
+
+-- Writes the static initialiser that registers the package open() function
+function post_include_hook(package_name)
+ output('\n')
+ output('#include "core/LuaState.h"\n')
+ output('int tolua_'..package_name..'_open(lua_State* tolua_S);\n')
+ output('static orxonox::ToluaBindingsHelper initialiser(&tolua_'..package_name..'_open, "'..package_name..'");')
+end
Modified: code/trunk/src/libraries/core/ViewportEventListener.h
===================================================================
--- code/trunk/src/libraries/core/ViewportEventListener.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/ViewportEventListener.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -29,9 +29,9 @@
#ifndef _ViewportEventListener_H__
#define _ViewportEventListener_H__
+#include "CorePrereqs.h"
+
#include "util/OgreForwardRefs.h"
-
-#include "CorePrereqs.h"
#include "OrxonoxClass.h"
namespace orxonox
Modified: code/trunk/src/libraries/core/command/Functor.h
===================================================================
--- code/trunk/src/libraries/core/command/Functor.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/command/Functor.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -113,10 +113,10 @@
#ifndef _Functor_H__
#define _Functor_H__
+#include "core/CorePrereqs.h"
+
#include <typeinfo>
-#include "core/CorePrereqs.h"
-
#include "util/Debug.h"
#include "util/MultiType.h"
#include "core/OrxonoxClass.h"
Modified: code/trunk/src/libraries/core/command/IOConsolePOSIX.cc
===================================================================
--- code/trunk/src/libraries/core/command/IOConsolePOSIX.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/command/IOConsolePOSIX.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -235,26 +235,26 @@
void IOConsole::printOutputLine(const std::string& text, Shell::LineType type)
{
-/*
// Colour line
switch (type)
{
- case Shell::None: this->cout_ << "\033[37m"; break;
case Shell::Error: this->cout_ << "\033[91m"; break;
- case Shell::Warning: this->cout_ << "\033[31m"; break;
- case Shell::Info: this->cout_ << "\033[34m"; break;
- case Shell::Debug: this->cout_ << "\033[36m"; break;
- case Shell::Verbose: this->cout_ << "\033[35m"; break;
- case Shell::Ultra: this->cout_ << "\033[37m"; break;
+ case Shell::Warning: this->cout_ << "\033[93m"; break;
+ case Shell::Info: this->cout_ << "\033[90m"; break;
+ case Shell::Debug: this->cout_ << "\033[90m"; break;
+ case Shell::Verbose: this->cout_ << "\033[90m"; break;
+ case Shell::Ultra: this->cout_ << "\033[90m"; break;
+ case Shell::Command: this->cout_ << "\033[36m"; break;
+ case Shell::Hint: this->cout_ << "\033[33m"; break;
+ case Shell::TDebug: this->cout_ << "\033[95m"; break;
default: break;
}
-*/
// Print output line
this->cout_ << text;
- // Reset colour to white
-// this->cout_ << "\033[37m";
+ // Reset colour atributes
+ this->cout_ << "\033[0m";
}
void IOConsole::printInputLine()
Modified: code/trunk/src/libraries/core/command/IOConsoleWindows.cc
===================================================================
--- code/trunk/src/libraries/core/command/IOConsoleWindows.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/command/IOConsoleWindows.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -207,6 +207,7 @@
case Shell::Ultra: colour = FOREGROUND_INTENSITY ; break;
case Shell::Command: colour = FOREGROUND_GREEN | FOREGROUND_BLUE; break;
case Shell::Hint: colour = FOREGROUND_GREEN | FOREGROUND_RED ; break;
+ case Shell::TDebug: colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE; break;
default: colour = FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE; break;
}
Modified: code/trunk/src/libraries/core/command/IOConsoleWindows.h
===================================================================
--- code/trunk/src/libraries/core/command/IOConsoleWindows.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/command/IOConsoleWindows.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -38,7 +38,6 @@
#include <sstream>
#include <string>
-#include <vector>
#include "util/Singleton.h"
#include "Shell.h"
Modified: code/trunk/src/libraries/core/command/Shell.cc
===================================================================
--- code/trunk/src/libraries/core/command/Shell.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/command/Shell.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -33,12 +33,15 @@
#include "Shell.h"
+#include "util/Math.h"
#include "util/OutputHandler.h"
#include "util/StringUtils.h"
#include "util/SubString.h"
#include "core/CoreIncludes.h"
#include "core/ConfigFileManager.h"
#include "core/ConfigValueIncludes.h"
+#include "core/PathConfig.h"
+#include "core/input/InputBuffer.h"
#include "CommandExecutor.h"
#include "ConsoleCommand.h"
@@ -83,10 +86,10 @@
this->setConfigValues();
// Get the previous output and add it to the Shell
- for (OutputHandler::OutputVectorIterator it = OutputHandler::getInstance().getOutputVectorBegin();
- it != OutputHandler::getInstance().getOutputVectorEnd(); ++it)
+ OutputHandler::OutputVector::const_iterator it = OutputHandler::getInstance().getOutput().begin();
+ for (;it != OutputHandler::getInstance().getOutput().end(); ++it)
{
- if (it->first <= this->getSoftDebugLevel())
+ if (it->first <= debugLevel_)
{
this->outputBuffer_ << it->second;
this->outputChanged(it->first);
@@ -95,6 +98,7 @@
// Register the shell as output listener
OutputHandler::getInstance().registerOutputListener(this);
+ OutputHandler::getInstance().setSoftDebugLevel(consoleName_, debugLevel_);
}
/**
@@ -106,6 +110,12 @@
this->inputBuffer_->destroy();
}
+ namespace DefaultLogLevel
+ {
+ const OutputLevel::Value Dev = OutputLevel::Info;
+ const OutputLevel::Value User = OutputLevel::Error;
+ }
+
/**
@brief Defines the config values.
*/
@@ -118,14 +128,11 @@
setConfigValueGeneric(this, &commandHistory_, ConfigFileType::CommandHistory, "Shell", "commandHistory_", std::vector<std::string>());
SetConfigValue(cacheSize_s, 32);
-#ifdef ORXONOX_RELEASE
- const unsigned int defaultLevel = 1;
-#else
- const unsigned int defaultLevel = 3;
-#endif
- SetConfigValueExternal(softDebugLevel_, "OutputHandler", "softDebugLevel" + this->consoleName_, defaultLevel)
- .description("The maximal level of debug output shown in the Shell");
- this->setSoftDebugLevel(this->softDebugLevel_);
+ // Choose the default level according to the path Orxonox was started (build directory or not)
+ OutputLevel::Value defaultDebugLevel = (PathConfig::buildDirectoryRun() ? DefaultLogLevel::Dev : DefaultLogLevel::User);
+ SetConfigValueExternal(debugLevel_, "OutputHandler", "debugLevel" + consoleName_, defaultDebugLevel)
+ .description("The maximum level of debug output shown in the " + consoleName_);
+ OutputHandler::getInstance().setSoftDebugLevel(consoleName_, debugLevel_);
}
/**
@@ -152,6 +159,23 @@
}
}
+ /** Called upon changes in the development mode (by Core)
+ Behaviour details see Core::devModeChanged.
+ */
+ void Shell::devModeChanged(bool value)
+ {
+ bool isNormal = (value == PathConfig::buildDirectoryRun());
+ if (isNormal)
+ {
+ ModifyConfigValueExternal(debugLevel_, "debugLevel" + consoleName_, update);
+ }
+ else
+ {
+ OutputLevel::Value level = (value ? DefaultLogLevel::Dev : DefaultLogLevel::User);
+ ModifyConfigValueExternal(debugLevel_, "debugLevel" + consoleName_, tset, level);
+ }
+ }
+
/**
@brief Registers this object as listener for different key-events at the input buffer.
*/
@@ -214,6 +238,18 @@
this->updateListeners<&ShellListener::cursorChanged>();
}
+ /// Returns the current position of the cursor in the input buffer.
+ unsigned int Shell::getCursorPosition() const
+ {
+ return this->inputBuffer_->getCursorPosition();
+ }
+
+ /// Returns the current content of the input buffer (the text which was entered by the user)
+ const std::string& Shell::getInput() const
+ {
+ return this->inputBuffer_->get();
+ }
+
/**
@brief Sends output to the internal output buffer.
*/
Modified: code/trunk/src/libraries/core/command/Shell.h
===================================================================
--- code/trunk/src/libraries/core/command/Shell.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/command/Shell.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -48,8 +48,8 @@
#include <vector>
#include "util/OutputHandler.h"
+#include "core/Core.h"
#include "core/OrxonoxClass.h"
-#include "core/input/InputBuffer.h"
namespace orxonox
{
@@ -84,12 +84,13 @@
Different graphical consoles build upon a Shell, for example InGameConsole and IOConsole.
*/
- class _CoreExport Shell : virtual public OrxonoxClass, public OutputListener
+ class _CoreExport Shell : public OutputListener, public DevModeListener
{
public:
/// Defines the type of a line of text in the Shell - some types depend on the output level, others are of internal use.
enum LineType
{
+ TDebug = OutputLevel::TDebug,
None = OutputLevel::None,
Warning = OutputLevel::Warning,
Error = OutputLevel::Error,
@@ -117,13 +118,9 @@
{ return this->inputBuffer_; }
void setCursorPosition(unsigned int cursor);
- /// Returns the current position of the cursor in the input buffer.
- inline unsigned int getCursorPosition() const
- { return this->inputBuffer_->getCursorPosition(); }
+ unsigned int getCursorPosition() const;
- /// Returns the current content of the input buffer (the text which was entered by the user)
- inline const std::string& getInput() const
- { return this->inputBuffer_->get(); }
+ const std::string& getInput() const;
typedef std::list<std::pair<std::string, LineType> > LineList;
LineList::const_iterator getNewestLineIterator() const;
@@ -146,6 +143,9 @@
private:
Shell(const Shell& other);
+ // DevModeListener
+ void devModeChanged(bool value);
+
void addToHistory(const std::string& command);
const std::string& getFromHistory() const;
void clearInput();
@@ -196,7 +196,7 @@
unsigned int maxHistoryLength_; ///< The maximum number of saved commands
unsigned int historyOffset_; ///< The command history is a circular buffer, this variable defines the current write-offset
std::vector<std::string> commandHistory_; ///< The history of commands that were entered by the user
- int softDebugLevel_; ///< The maximum level of output that is displayed in the shell (will be passed to OutputListener to filter output)
+ int debugLevel_; //!< The maximum level of output that is displayed in the shell (will be passed to OutputListener to filter output)
static unsigned int cacheSize_s; ///< The maximum cache size of the CommandExecutor - this is stored here for better readability of the config file and because CommandExecutor is no OrxonoxClass
};
}
Modified: code/trunk/src/libraries/core/input/InputHandler.h
===================================================================
--- code/trunk/src/libraries/core/input/InputHandler.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/input/InputHandler.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -30,10 +30,19 @@
#define _InputHandler_H__
#include "InputPrereqs.h"
-#include "util/Math.h"
namespace orxonox
{
+ /// A Vector class containing two integers @a x and @a y.
+ class IntVector2
+ {
+ public:
+ IntVector2() : x(0), y(0) { }
+ IntVector2(int _x, int _y) : x(_x), y(_y) { }
+ int x;
+ int y;
+ };
+
namespace ButtonEvent
{
//! Helper enum to deploy events with the help of templates
Modified: code/trunk/src/libraries/core/input/InputManager.cc
===================================================================
--- code/trunk/src/libraries/core/input/InputManager.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/input/InputManager.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -93,7 +93,7 @@
: internalState_(Bad)
, oisInputManager_(0)
, devices_(2)
- , exclusiveMouse_(TriBool::False)
+ , exclusiveMouse_(false)
, emptyState_(0)
, calibratorCallbackHandler_(0)
{
@@ -107,7 +107,7 @@
this->setConfigValues();
if (GraphicsManager::getInstance().isFullScreen())
- exclusiveMouse_ = TriBool::True;
+ exclusiveMouse_ = true;
this->loadDevices();
// Lowest priority empty InputState
@@ -160,7 +160,7 @@
paramList.insert(StringPair("w32_keyboard", "DISCL_NONEXCLUSIVE"));
paramList.insert(StringPair("w32_keyboard", "DISCL_FOREGROUND"));
paramList.insert(StringPair("w32_mouse", "DISCL_FOREGROUND"));
- if (exclusiveMouse_ == TriBool::True || GraphicsManager::getInstance().isFullScreen())
+ if (exclusiveMouse_ || GraphicsManager::getInstance().isFullScreen())
{
// Disable Windows key plus special keys (like play, stop, next, etc.)
paramList.insert(StringPair("w32_keyboard", "DISCL_NOWINKEY"));
@@ -173,7 +173,7 @@
// Trouble might be that the Pressed event occurs a bit too often...
paramList.insert(StringPair("XAutoRepeatOn", "true"));
- if (exclusiveMouse_ == TriBool::True || GraphicsManager::getInstance().isFullScreen())
+ if (exclusiveMouse_ || GraphicsManager::getInstance().isFullScreen())
{
if (CommandLineParser::getValue("keyboard_no_grab").getBool())
paramList.insert(StringPair("x11_keyboard_grab", "false"));
@@ -446,15 +446,16 @@
activeStatesTicked_.push_back(*it);
// Check whether we have to change the mouse mode
- TriBool::Value requestedMode = TriBool::Dontcare;
+ tribool requestedMode = dontcare;
std::vector<InputState*>& mouseStates = devices_[InputDeviceEnumerator::Mouse]->getStateListRef();
if (mouseStates.empty())
- requestedMode = TriBool::False;
+ requestedMode = false;
else
requestedMode = mouseStates.front()->getMouseExclusive();
- if (requestedMode != TriBool::Dontcare && exclusiveMouse_ != requestedMode)
+ if (requestedMode != dontcare && exclusiveMouse_ != requestedMode)
{
- exclusiveMouse_ = requestedMode;
+ assert(requestedMode != dontcare);
+ exclusiveMouse_ = (requestedMode == true);
if (!GraphicsManager::getInstance().isFullScreen())
this->reloadInternal();
}
@@ -643,7 +644,7 @@
state->destroy();
}
- bool InputManager::setMouseExclusive(const std::string& name, TriBool::Value value)
+ bool InputManager::setMouseExclusive(const std::string& name, tribool value)
{
if (name == "empty")
{
Modified: code/trunk/src/libraries/core/input/InputManager.h
===================================================================
--- code/trunk/src/libraries/core/input/InputManager.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/input/InputManager.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -32,13 +32,12 @@
#include "InputPrereqs.h"
#include <map>
-#include <set>
#include <string>
#include <vector>
#include <boost/function.hpp>
#include "util/Singleton.h"
-#include "util/TriBool.h"
+#include "util/tribool.h"
#include "core/WindowEventListener.h"
// tolua_begin
@@ -168,7 +167,7 @@
@return
True if the call was successful, fals if the name was not found
*/
- bool setMouseExclusive(const std::string& name, TriBool::Value value); // tolua_export
+ bool setMouseExclusive(const std::string& name, tribool value); // tolua_export
//-------------------------------
// Various getters and setters
@@ -214,7 +213,7 @@
State internalState_; //!< Current internal state
OIS::InputManager* oisInputManager_; //!< OIS input manager
std::vector<InputDevice*> devices_; //!< List of all input devices (keyboard, mouse, joy sticks)
- TriBool::Value exclusiveMouse_; //!< Currently applied mouse mode
+ bool exclusiveMouse_; //!< Currently applied mouse mode
// some internally handled states and handlers
InputState* emptyState_; //!< Lowest priority states (makes handling easier)
Modified: code/trunk/src/libraries/core/input/InputPrereqs.h
===================================================================
--- code/trunk/src/libraries/core/input/InputPrereqs.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/input/InputPrereqs.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -40,7 +40,6 @@
#include <ois/OISKeyboard.h>
#include <ois/OISMouse.h>
-#include <ois/OISJoyStick.h>
#include "util/OrxEnum.h"
namespace orxonox
Modified: code/trunk/src/libraries/core/input/InputState.cc
===================================================================
--- code/trunk/src/libraries/core/input/InputState.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/input/InputState.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -36,7 +36,7 @@
: name_(name)
, bAlwaysGetsInput_(bAlwaysGetsInput)
, bTransparent_(bTransparent)
- , exclusiveMouse_(TriBool::Dontcare)
+ , exclusiveMouse_(dontcare)
, bExpired_(true)
, handlers_(2)
, joyStickHandlerAll_(0)
Modified: code/trunk/src/libraries/core/input/InputState.h
===================================================================
--- code/trunk/src/libraries/core/input/InputState.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/input/InputState.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -37,7 +37,7 @@
#include <boost/function.hpp>
#include <boost/bind.hpp>
-#include "util/TriBool.h"
+#include "util/tribool.h"
#include "InputHandler.h"
#include "InputManager.h"
#include "JoyStickQuantityListener.h"
@@ -111,8 +111,8 @@
//! Sets an InputHandler to be used for all devices
void setHandler (InputHandler* handler);
- void setMouseExclusive(TriBool::Value value) { exclusiveMouse_ = value; this->bExpired_ = true; }
- TriBool::Value getMouseExclusive() const { return exclusiveMouse_; }
+ void setMouseExclusive(tribool value) { exclusiveMouse_ = value; this->bExpired_ = true; }
+ tribool getMouseExclusive() const { return exclusiveMouse_; }
//! Returns the name of the state (which is unique!)
const std::string& getName() const { return name_; }
@@ -165,7 +165,7 @@
const std::string name_; //!< Name of the state
const bool bAlwaysGetsInput_; //!< See class declaration for explanation
const bool bTransparent_; //!< See class declaration for explanation
- TriBool::Value exclusiveMouse_; //!< See class declaration for explanation
+ tribool exclusiveMouse_; //!< See class declaration for explanation
int priority_; //!< Current priority (might change)
bool bExpired_; //!< See hasExpired()
std::vector<InputHandler*> handlers_; //!< Vector with all handlers where the index is the device ID
Modified: code/trunk/src/libraries/core/input/JoyStick.h
===================================================================
--- code/trunk/src/libraries/core/input/JoyStick.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/input/JoyStick.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -33,6 +33,7 @@
#include <string>
#include <vector>
+#include <ois/OISJoyStick.h>
#include "InputDevice.h"
namespace orxonox
Modified: code/trunk/src/libraries/core/input/JoyStickQuantityListener.h
===================================================================
--- code/trunk/src/libraries/core/input/JoyStickQuantityListener.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/input/JoyStickQuantityListener.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -35,6 +35,8 @@
#define _JoyStickQuantityListener_H__
#include "InputPrereqs.h"
+
+#include <vector>
#include "core/OrxonoxClass.h"
namespace orxonox
Modified: code/trunk/src/libraries/core/input/KeyBinderManager.h
===================================================================
--- code/trunk/src/libraries/core/input/KeyBinderManager.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/input/KeyBinderManager.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -33,7 +33,6 @@
#include <map>
#include <string>
-#include <boost/shared_ptr.hpp>
#include "util/Singleton.h"
#include "core/OrxonoxClass.h"
Modified: code/trunk/src/libraries/core/input/KeyDetector.h
===================================================================
--- code/trunk/src/libraries/core/input/KeyDetector.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/input/KeyDetector.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -31,7 +31,6 @@
#include "InputPrereqs.h"
-#include <boost/shared_ptr.hpp>
#include "util/Singleton.h"
#include "KeyBinder.h"
Modified: code/trunk/src/libraries/core/input/Keyboard.h
===================================================================
--- code/trunk/src/libraries/core/input/Keyboard.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/input/Keyboard.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -30,8 +30,6 @@
#define _Core_Keyboard_H__
#include "InputPrereqs.h"
-
-#include "InputHandler.h"
#include "InputDevice.h"
namespace orxonox
Modified: code/trunk/src/libraries/core/input/Mouse.cc
===================================================================
--- code/trunk/src/libraries/core/input/Mouse.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/core/input/Mouse.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -36,6 +36,7 @@
#ifdef ORXONOX_PLATFORM_LINUX
// include this as last, X11 seems to define some macros...
#include <ois/linux/LinuxMouse.h>
+#undef Success
#endif
namespace orxonox
Modified: code/trunk/src/libraries/network/WANDiscoverable.h
===================================================================
--- code/trunk/src/libraries/network/WANDiscoverable.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/network/WANDiscoverable.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -27,7 +27,7 @@
#define _WANDiscoverable_H__
#include "NetworkPrereqs.h"
-// #include "core/OrxonoxClass.h"
+#include "core/OrxonoxClass.h"
#include "core/CoreIncludes.h"
#include "MasterServerComm.h"
Modified: code/trunk/src/libraries/network/packet/CMakeLists.txt
===================================================================
--- code/trunk/src/libraries/network/packet/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/network/packet/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -1,5 +1,6 @@
ADD_SOURCE_FILES(NETWORK_SRC_FILES
-COMPILATION_BEGIN PacketCompilation.cc
+
+BUILD_UNIT PacketBuildUnit.cc
Acknowledgement.cc
Chat.cc
ClassID.cc
@@ -9,7 +10,8 @@
Gamestate.cc
Packet.cc
Welcome.cc
-COMPILATION_END
+END_BUILD_UNIT
+
ServerInformation.cc
)
Modified: code/trunk/src/libraries/tools/CMakeLists.txt
===================================================================
--- code/trunk/src/libraries/tools/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/tools/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -1,19 +1,23 @@
SET_SOURCE_FILES(TOOLS_SRC_FILES
-COMPILATION_BEGIN ResourceCompilation.cc
+
+BUILD_UNIT ResourceBuildUnit.cc
ResourceCollection.cc
ResourceLocation.cc
-COMPILATION_END
+END_BUILD_UNIT
+
TextureGenerator.cc
Timer.cc
-COMPILATION_BEGIN OgreCompilation.cc
+
+BUILD_UNIT OgreBuildUnit.cc
BillboardSet.cc
DynamicLines.cc
DynamicRenderable.cc
Mesh.cc
ParticleInterface.cc
Shader.cc
-COMPILATION_END
+END_BUILD_UNIT
)
+
#ADD_SUBDIRECTORY(bsp)
ADD_SUBDIRECTORY(interfaces)
Modified: code/trunk/src/libraries/tools/Shader.h
===================================================================
--- code/trunk/src/libraries/tools/Shader.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/tools/Shader.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -31,14 +31,11 @@
#include "tools/ToolsPrereqs.h"
-#include <map>
+#include <list>
#include <string>
-#include <vector>
-
#include <OgreCompositorInstance.h>
#include "util/MultiType.h"
-#include "util/OgreForwardRefs.h"
#include "core/ViewportEventListener.h"
namespace orxonox
Modified: code/trunk/src/libraries/tools/Timer.cc
===================================================================
--- code/trunk/src/libraries/tools/Timer.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/tools/Timer.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -41,6 +41,7 @@
#include "core/CoreIncludes.h"
#include "core/command/ConsoleCommand.h"
#include "core/command/CommandExecutor.h"
+#include "core/command/Executor.h"
#include "core/command/Functor.h"
#include "tools/interfaces/TimeFactorListener.h"
@@ -177,6 +178,26 @@
}
/**
+ @brief Initializes and starts the timer, which will call an executor after some time.
+ @param interval The timer-interval in seconds
+ @param bLoop If true, the executor gets called every @a interval seconds
+ @param executor The executor that will be called
+ @param bKillAfterCall If true, the timer will be deleted after the executor was called
+ */
+ void Timer::setTimer(float interval, bool bLoop, const ExecutorPtr& executor, bool bKillAfterCall)
+ {
+ this->setInterval(interval);
+ this->bLoop_ = bLoop;
+ this->executor_ = executor;
+ this->bActive_ = true;
+
+ this->time_ = this->interval_;
+ this->bKillAfterCall_ = bKillAfterCall;
+
+ executor->getFunctor()->setSafeMode(true);
+ }
+
+ /**
@brief Calls the executor and destroys the timer if requested.
*/
void Timer::run()
Modified: code/trunk/src/libraries/tools/Timer.h
===================================================================
--- code/trunk/src/libraries/tools/Timer.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/tools/Timer.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -79,7 +79,7 @@
#include "tools/ToolsPrereqs.h"
#include "core/OrxonoxClass.h"
-#include "core/command/Executor.h"
+#include "core/command/ExecutorPtr.h"
namespace orxonox
{
@@ -108,26 +108,8 @@
Timer(float interval, bool bLoop, const ExecutorPtr& executor, bool bKillAfterCall = false);
- /**
- @brief Initializes and starts the timer, which will call an executor after some time.
- @param interval The timer-interval in seconds
- @param bLoop If true, the executor gets called every @a interval seconds
- @param executor The executor that will be called
- @param bKillAfterCall If true, the timer will be deleted after the executor was called
- */
- void setTimer(float interval, bool bLoop, const ExecutorPtr& executor, bool bKillAfterCall = false)
- {
- this->setInterval(interval);
- this->bLoop_ = bLoop;
- this->executor_ = executor;
- this->bActive_ = true;
+ void setTimer(float interval, bool bLoop, const ExecutorPtr& executor, bool bKillAfterCall = false);
- this->time_ = this->interval_;
- this->bKillAfterCall_ = bKillAfterCall;
-
- executor->getFunctor()->setSafeMode(true);
- }
-
void run();
/// Re-starts the timer: The executor will be called after @a interval seconds.
Modified: code/trunk/src/libraries/util/CMakeLists.txt
===================================================================
--- code/trunk/src/libraries/util/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/util/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -18,7 +18,8 @@
#
SET_SOURCE_FILES(UTIL_SRC_FILES
-COMPILATION_BEGIN StableCompilation.cc
+
+BUILD_UNIT StableBuildUnit.cc
Clipboard.cc
Clock.cc
Convert.cc
@@ -31,7 +32,7 @@
Sleep.cc
SmallObjectAllocator.cc
SubString.cc
-COMPILATION_END
+END_BUILD_UNIT
MultiType.cc
Exception.cc
@@ -40,13 +41,6 @@
StringUtils.cc
)
-IF(MSVC)
- # Simply using #pragma warning(disable:4244) doesn't really disable it
- # if the warning occurs in a template in another file
- # Hence promote it manually to a higher warning level (4)
- SET_SOURCE_FILES_PROPERTIES(MultiType.cc PROPERTIES COMPILE_FLAGS "-w44244")
-ENDIF()
-
ORXONOX_ADD_LIBRARY(util
FIND_HEADER_FILES
LINK_LIBRARIES
Modified: code/trunk/src/libraries/util/Convert.h
===================================================================
--- code/trunk/src/libraries/util/Convert.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/util/Convert.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -132,6 +132,12 @@
#include "Debug.h"
#include "ImplicitConversion.h"
+// disable warnings about possible loss of data
+#ifdef ORXONOX_COMPILER_MSVC
+# pragma warning(push)
+# pragma warning(disable:4244)
+#endif
+
namespace orxonox
{
///////////////////
@@ -470,4 +476,9 @@
};
}
+// Reinstate warnings
+#ifdef ORXONOX_COMPILER_MSVC
+# pragma warning(pop)
+#endif
+
#endif /* _Convert_H__ */
Modified: code/trunk/src/libraries/util/Debug.h
===================================================================
--- code/trunk/src/libraries/util/Debug.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/util/Debug.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -82,8 +82,6 @@
// Adjust this to discard certain output with level > hardDebugLevel at compile time already
#ifdef ORXONOX_RELEASE
const int hardDebugLevel = OutputLevel::Verbose;
-#elif defined(NDEBUG)
- const int hardDebugLevel = OutputLevel::Verbose;
#else
//! Maximum level for debug output that should be even processed at run time
const int hardDebugLevel = OutputLevel::Ultra;
@@ -124,4 +122,10 @@
/*else*/ : \
orxonox::OutputHandler::getOutStream(level)
+/** Logs debug output: You can use DOUT exactly like @c std::cout.
+ Use this macro to produce temporary debug output that will be removed later on.
+ The console output shall have a special colour if available.
+*/
+#define DOUT orxonox::OutputHandler::getOutStream(-1) << "+++ "
+
#endif /* _Util_Debug_H__ */
Modified: code/trunk/src/libraries/util/Math.h
===================================================================
--- code/trunk/src/libraries/util/Math.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/util/Math.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -298,31 +298,6 @@
}
_UtilExport unsigned long getUniqueNumber();
-
- /**
- @brief A Vector class containing two integers @a x and @a y.
- */
- class IntVector2
- {
- public:
- IntVector2() : x(0), y(0) { }
- IntVector2(int _x, int _y) : x(_x), y(_y) { }
- int x;
- int y;
- };
-
- /**
- @brief A Vector class containing three integers @a x, @a y, and @a z.
- */
- class IntVector3
- {
- public:
- IntVector3() : x(0), y(0), z(0) { }
- IntVector3(int _x, int _y, int _z) : x(_x), y(_y), z(_z) { }
- int x;
- int y;
- int z;
- };
}
#endif /* _Util_Math_H__ */
Modified: code/trunk/src/libraries/util/OutputHandler.cc
===================================================================
--- code/trunk/src/libraries/util/OutputHandler.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/util/OutputHandler.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -68,7 +68,7 @@
Gets temporary log path and starts the log file
*/
LogFileWriter()
- : OutputListener(OutputHandler::logFileOutputListenerName_s)
+ : OutputListener("LogFile")
{
// Get path for a temporary file
#ifdef ORXONOX_PLATFORM_WINDOWS
@@ -84,35 +84,59 @@
time(&rawtime);
timeinfo = localtime(&rawtime);
- this->logFile_.open(this->logFilename_.c_str(), std::fstream::out);
- this->logFile_ << "Started log on " << asctime(timeinfo) << std::endl;
- this->logFile_.flush();
-
- this->outputStream_ = &this->logFile_;
+ this->openFile();
+ if (this->logFile_.is_open())
+ {
+ this->logFile_ << "Started log on " << asctime(timeinfo) << std::endl;
+ this->logFile_.flush();
+ }
}
//! Closes the log file
~LogFileWriter()
{
- this->logFile_ << "Closed log" << std::endl;
- this->logFile_.close();
+ if (this->logFile_.is_open())
+ {
+ this->logFile_ << "Closed log" << std::endl;
+ this->logFile_.close();
+ }
}
//! Changes the log path
void setLogPath(const std::string& path)
{
- this->logFile_.close();
- // Read old file into a buffer
- std::ifstream old(this->logFilename_.c_str());
+ if (this->logFile_.is_open())
+ this->logFile_.close();
+
+ // Open the new file
this->logFilename_ = path + logFileBaseName_g;
- // Open the new file and feed it the content of the old one
+ this->openFile();
+ }
+
+ //! Erases the log file
+ void clearFile()
+ {
+ if (this->logFile_.is_open())
+ {
+ this->logFile_.close();
+ this->openFile();
+ }
+ }
+
+ private:
+ void openFile()
+ {
this->logFile_.open(this->logFilename_.c_str(), std::fstream::out);
- this->logFile_ << old.rdbuf();
- this->logFile_.flush();
- old.close();
+
+ if (this->logFile_.is_open())
+ this->outputStream_ = &this->logFile_;
+ else
+ {
+ COUT(2) << "Warning: Failed to open log file. File logging disabled." << std::endl;
+ this->outputStream_ = NULL;
+ }
}
- private:
std::ofstream logFile_; //!< File handle for the log file
std::string logFilename_; //!< Filename of the log file
};
@@ -132,7 +156,7 @@
public:
//! Only assigns the output stream with std::cout
ConsoleWriter()
- : OutputListener("consoleLog")
+ : OutputListener("Console")
{
this->outputStream_ = &std::cout;
}
@@ -146,26 +170,23 @@
@brief
OutputListener that writes all the output piece by piece to an array
associated with the corresponding output level.
+ Used as buffer until all output devices have been initialised.
@note
- Only output below or equal to the current soft debug level is written
- to minimise huge arrays for the normal run.
+ At some point, OutputHandler::disableMemoryLog() has to be called in
+ order to avoid large memory footprints of this class.
*/
class MemoryLogWriter : public OutputListener
{
public:
friend class OutputHandler;
- /**
- @brief
- Sets the right soft debug level and registers itself
- */
MemoryLogWriter()
: OutputListener("memoryLog")
{
this->outputStream_ = &this->buffer_;
}
- //! Pushed the just written output to the internal array
+ //! Push the just written output to the internal array
void outputChanged(int level)
{
if (!this->buffer_.str().empty())
@@ -179,42 +200,44 @@
}
private:
- std::ostringstream buffer_; //!< Stream object used to process the output
- std::vector<std::pair<int, std::string> > output_; //!< Vector containing ALL output
+ std::ostringstream buffer_; //!< Stream object used to process the output
+ OutputHandler::OutputVector output_; //!< Vector containing ALL output
};
/////////////////////////
///// OutputHandler /////
/////////////////////////
- const std::string OutputHandler::logFileOutputListenerName_s = "logFile";
- int OutputHandler::softDebugLevel_s = hardDebugLevel;
+ int OutputHandler::softDebugLevel_s = hardDebugLevel;
//! Creates the LogFileWriter and the MemoryLogWriter
OutputHandler::OutputHandler()
: outputLevel_(OutputLevel::Verbose)
{
+ // Note: These levels only concern startup before orxonox.ini is read.
#ifdef ORXONOX_RELEASE
- const OutputLevel::Value defaultLevelConsole = OutputLevel::Error;
- const OutputLevel::Value defaultLevelLogFile = OutputLevel::Info;
+ const OutputLevel::Value initialLevelConsole = OutputLevel::Error;
#else
- const OutputLevel::Value defaultLevelConsole = OutputLevel::Info;
- const OutputLevel::Value defaultLevelLogFile = OutputLevel::Debug;
+ const OutputLevel::Value initialLevelConsole = OutputLevel::Info;
#endif
+ // Use high log level because we rewrite the log file anyway with the
+ // correct level. But if Orxonox were to crash before that, we might be
+ // grateful to have a high debug level, esp. for releases.
+ const OutputLevel::Value intialLevelLogFile = OutputLevel::Debug;
this->logFile_ = new LogFileWriter();
// Use default level until we get the configValue from the Core
- this->logFile_->softDebugLevel_ = defaultLevelLogFile;
+ this->logFile_->softDebugLevel_ = intialLevelLogFile;
this->registerOutputListener(this->logFile_);
this->consoleWriter_ = new ConsoleWriter();
- this->consoleWriter_->softDebugLevel_ = defaultLevelConsole;
+ this->consoleWriter_->softDebugLevel_ = initialLevelConsole;
this->registerOutputListener(this->consoleWriter_);
- this->output_ = new MemoryLogWriter();
- // We capture as much input as the listener with the highest level
- this->output_->softDebugLevel_ = getSoftDebugLevel();
- this->registerOutputListener(this->output_);
+ this->memoryBuffer_ = new MemoryLogWriter();
+ // Write everything, e.g. use hardDebugLevel
+ this->memoryBuffer_->softDebugLevel_ = hardDebugLevel;
+ this->registerOutputListener(this->memoryBuffer_);
}
//! Destroys the LogFileWriter and the MemoryLogWriter
@@ -222,7 +245,7 @@
{
delete this->logFile_;
delete this->consoleWriter_;
- delete this->output_;
+ delete this->memoryBuffer_; // Might already be NULL
}
OutputHandler& OutputHandler::getInstance()
@@ -233,7 +256,7 @@
void OutputHandler::registerOutputListener(OutputListener* listener)
{
- for (std::list<OutputListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
+ for (std::vector<OutputListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
{
if ((*it)->name_ == listener->name_)
{
@@ -242,20 +265,43 @@
}
}
this->listeners_.push_back(listener);
- // Update global soft debug level
- this->setSoftDebugLevel(listener->getOutputListenerName(), listener->getSoftDebugLevel());
+ this->updateGlobalDebugLevel();
}
void OutputHandler::unregisterOutputListener(OutputListener* listener)
{
- this->listeners_.remove(listener);
+ for (std::vector<OutputListener*>::iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
+ {
+ if ((*it)->name_ == listener->name_)
+ {
+ this->listeners_.erase(it);
+ break;
+ }
+ }
+ this->updateGlobalDebugLevel();
}
void OutputHandler::setLogPath(const std::string& path)
{
this->logFile_->setLogPath(path);
+ this->rewriteLogFile();
}
+ void OutputHandler::rewriteLogFile()
+ {
+ logFile_->clearFile();
+
+ if (logFile_->outputStream_ == NULL)
+ return;
+
+ for (OutputVector::const_iterator it = this->getOutput().begin(); it != this->getOutput().end(); ++it)
+ {
+ if (it->first <= logFile_->softDebugLevel_)
+ (*logFile_->outputStream_) << it->second;
+ }
+ logFile_->outputStream_->flush();
+ }
+
void OutputHandler::disableCout()
{
this->unregisterOutputListener(this->consoleWriter_);
@@ -266,19 +312,21 @@
this->registerOutputListener(this->consoleWriter_);
}
- OutputHandler::OutputVectorIterator OutputHandler::getOutputVectorBegin() const
+ void OutputHandler::disableMemoryLog()
{
- return this->output_->output_.begin();
+ this->unregisterOutputListener(this->memoryBuffer_);
+ // Only clear the buffer so we can still reference the vector
+ this->memoryBuffer_->output_.clear();
}
- OutputHandler::OutputVectorIterator OutputHandler::getOutputVectorEnd() const
+ const OutputHandler::OutputVector& OutputHandler::getOutput() const
{
- return this->output_->output_.end();
+ return this->memoryBuffer_->output_;
}
int OutputHandler::getSoftDebugLevel(const std::string& name) const
{
- for (std::list<OutputListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
+ for (std::vector<OutputListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
{
if ((*it)->name_ == name)
return (*it)->softDebugLevel_;
@@ -288,15 +336,21 @@
void OutputHandler::setSoftDebugLevel(const std::string& name, int level)
{
- int globalSoftDebugLevel = -1;
- for (std::list<OutputListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
+ for (std::vector<OutputListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
{
if ((*it)->name_ == name)
(*it)->softDebugLevel_ = level;
- if ((*it)->softDebugLevel_ > globalSoftDebugLevel)
- globalSoftDebugLevel = (*it)->softDebugLevel_;
}
- // Update global soft debug level
+ this->updateGlobalDebugLevel();
+ }
+
+ void OutputHandler::updateGlobalDebugLevel()
+ {
+ int globalSoftDebugLevel = -1;
+ std::vector<OutputListener*>::const_iterator it = this->listeners_.begin();
+ for (; it != this->listeners_.end(); ++it)
+ globalSoftDebugLevel = std::max(globalSoftDebugLevel, (*it)->softDebugLevel_);
+
OutputHandler::softDebugLevel_s = globalSoftDebugLevel;
}
}
Modified: code/trunk/src/libraries/util/OutputHandler.h
===================================================================
--- code/trunk/src/libraries/util/OutputHandler.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/util/OutputHandler.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -38,7 +38,6 @@
#include "UtilPrereqs.h"
-#include <list>
#include <ostream>
#include <string>
#include <vector>
@@ -62,6 +61,7 @@
{
enum Value
{
+ TDebug = -1,
None = 0,
Error = 1,
Warning = 2,
@@ -102,11 +102,9 @@
static inline OutputHandler& getOutStream(int level)
{ return OutputHandler::getInstance().setOutputLevel(level); }
- typedef std::vector<std::pair<int, std::string> >::const_iterator OutputVectorIterator;
- //! Returns an iterator to the beginning of the all-output vector
- OutputVectorIterator getOutputVectorBegin() const;
- //! Returns an iterator to the end of the all-output vector
- OutputVectorIterator getOutputVectorEnd() const;
+ typedef std::vector<std::pair<int, std::string> > OutputVector;
+ //! Returns all output written so far (empty if disableMemoryLog() was called)
+ const OutputVector& getOutput() const;
//! Writes to all output devices
static inline void log(const std::string& text)
@@ -135,10 +133,17 @@
//! Set the log path once the program has been properly initialised
void setLogPath(const std::string& path);
+ /** Rewrites the log file (completely respects the current debug level).
+ Once disableMemoryLog() has been called, this function will do nothing.
+ */
+ void rewriteLogFile();
+
//! Disables the std::cout stream for output
void disableCout();
//! Enables the std::cout stream for output (startup behaviour)
void enableCout();
+ //! Stop writing to the memory buffer (call this as soon as possible to minimise memory usage)
+ void disableMemoryLog();
//! Sets the level of the incoming output and returns the OutputHandler
inline OutputHandler& setOutputLevel(int level)
@@ -212,20 +217,20 @@
//! Dummy operator required by Debug.h for the ternary operator
inline operator int() const { return 0; }
- //! Name of the OutputListener that writes to the log file
- static const std::string logFileOutputListenerName_s;
-
private:
OutputHandler();
~OutputHandler();
OutputHandler(const OutputHandler& rhs); //!< Copy-constructor: Unused and undefined
- std::list<OutputListener*> listeners_; //!< Array with all registered output listeners
- int outputLevel_; //!< The level of the incoming output
- LogFileWriter* logFile_; //!< Listener that writes to the log file
- ConsoleWriter* consoleWriter_; //!< Listener for std::cout (just program beginning)
- MemoryLogWriter* output_; //!< Listener that Stores ALL output below the current soft debug level
- static int softDebugLevel_s; //!< Maximum of all soft debug levels. @note This is only static for faster access
+ /// Evaluates the maximum global log level
+ void updateGlobalDebugLevel();
+
+ std::vector<OutputListener*> listeners_; //!< Array with all registered output listeners
+ int outputLevel_; //!< The level of the incoming output
+ LogFileWriter* logFile_; //!< Writes output to the log file
+ ConsoleWriter* consoleWriter_; //!< Writes to std::cout (can be disabled)
+ MemoryLogWriter* memoryBuffer_; //!< Writes to memory as a buffer (can/must be stopped at some time)
+ static int softDebugLevel_s; //!< Maximum of all soft debug levels. @note This is only static for faster access
};
/**
@@ -250,14 +255,6 @@
virtual void outputChanged(int level) {}
//! Returns the name of this output listener
const std::string& getOutputListenerName() const { return this->name_; }
- //! Returns the soft debug level of the listener
- int getSoftDebugLevel() const { return this->softDebugLevel_; }
- //! Sets the soft debug level of the listener
- void setSoftDebugLevel(int level)
- {
- this->softDebugLevel_ = level;
- OutputHandler::getInstance().setSoftDebugLevel(this->name_, level);
- }
protected:
std::ostream* outputStream_; //!< Pointer to the associated output stream, can be NULL
@@ -270,7 +267,7 @@
template<class T>
inline OutputHandler& OutputHandler::output(const T& output)
{
- for (std::list<OutputListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
+ for (std::vector<OutputListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
{
if (this->outputLevel_ <= (*it)->softDebugLevel_ && (*it)->outputStream_ != NULL)
{
Deleted: code/trunk/src/libraries/util/TriBool.h
===================================================================
--- code/trunk/src/libraries/util/TriBool.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/util/TriBool.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -1,59 +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
- @ingroup Util
-*/
-
-#ifndef _TriBool_H__
-#define _TriBool_H__
-
-#include "UtilPrereqs.h"
-
-// tolua_begin
-namespace orxonox
-{
- /** Sort of a boolean value that also has state \c Dontcare
- @remarks
- Even though \c False has the value 0, both \c True and \c Dontcare have
- a value other than 0. Keep that in mind when using TriBools in if statements.
- */
- namespace TriBool
- {
- enum Value
- {
- False = 0,
- True = 1,
- Dontcare = 2
- };
- }
-}
-// tolua_end
-
-#endif /* _TriBool_H__ */
Modified: code/trunk/src/libraries/util/UtilPrereqs.h
===================================================================
--- code/trunk/src/libraries/util/UtilPrereqs.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/libraries/util/UtilPrereqs.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -86,8 +86,6 @@
class Clock;
class Exception;
class ExprParser;
- class IntVector2;
- class IntVector3;
class MultiType;
class OutputHandler;
class OutputListener;
Copied: code/trunk/src/libraries/util/tribool.h (from rev 8716, code/branches/unity_build/src/libraries/util/tribool.h)
===================================================================
--- code/trunk/src/libraries/util/tribool.h (rev 0)
+++ code/trunk/src/libraries/util/tribool.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -0,0 +1,138 @@
+// Three-state boolean logic library
+
+// Copyright Douglas Gregor 2002-2004. Use, modification and
+// distribution is subject to the Boost Software License, Version
+// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// Modifications by Orxonox to shape the third state into 'dontcare' instead
+// of 'indeterminate'. The difference is that 'dontcare' is actually a value
+// so that (dontcare == dontcare).
+// Also removed all logic operators except for == and !=
+
+
+// For more information, see http://www.boost.org
+#ifndef ORXONOX_TRIBOOL_H
+#define ORXONOX_TRIBOOL_H
+
+namespace orxonox {
+
+/**
+ * INTERNAL ONLY
+ * The type of the 'dontcare' keyword.
+ */
+struct dontcare_keyword_t { };
+
+/**
+ * \brief Keyword for the dontcare tribool value
+ */
+const dontcare_keyword_t dontcare = dontcare_keyword_t();
+
+/**
+ * \brief A 3-state boolean type.
+ *
+ * 3-state boolean values are either true, false, or
+ * dontcare.
+ */
+class tribool
+{
+public:
+ /**
+ * Construct a new 3-state boolean value with the value 'false'.
+ *
+ * \throws nothrow
+ */
+ tribool() : value(false_value) {}
+
+ /**
+ * Construct a new 3-state boolean value with the given boolean
+ * value, which may be \c true or \c false.
+ *
+ * \throws nothrow
+ */
+ tribool(bool value) : value(value? true_value : false_value) {}
+
+ /**
+ * Construct a new 3-state boolean value with an dontcare value.
+ *
+ * \throws nothrow
+ */
+ tribool(dontcare_keyword_t) : value(dontcare_value) {}
+
+ /**
+ * \brief Compare tribools for equality
+ *
+ * \returns the result of comparing two tribool values.
+ * \throws nothrow
+ */
+ inline bool operator==(tribool y)
+ {
+ return (this->value == y.value);
+ }
+
+ /**
+ * \overload
+ */
+ inline bool operator==(bool y) { return (*this) == tribool(y); }
+
+ /**
+ * \overload
+ */
+ inline bool operator==(dontcare_keyword_t)
+ { return tribool(dontcare) == (*this); }
+
+ /**
+ * \brief Compare tribools for inequality
+ *
+ * \returns the result of comparing two tribool values for inequality.
+ * \throws nothrow
+ */
+ inline bool operator!=(tribool y)
+ {
+ return !((*this) == y);
+ }
+
+ /**
+ * \overload
+ */
+ inline bool operator!=(bool y) { return (*this) != tribool(y); }
+
+ /**
+ * \overload
+ */
+ inline bool operator!=(dontcare_keyword_t)
+ { return (*this) != tribool(dontcare); }
+
+ /**
+ * The actual stored value in this 3-state boolean, which may be false, true,
+ * or dontcare.
+ */
+ enum value_t { false_value, true_value, dontcare_value } value;
+};
+
+/**
+ * \overload
+ */
+inline bool operator==(bool x, tribool y) { return tribool(x) == y; }
+
+/**
+ * \overload
+ */
+inline bool operator==(dontcare_keyword_t, tribool x)
+{ return tribool(dontcare) == x; }
+
+/**
+ * \overload
+ */
+inline bool operator!=(bool x, tribool y) { return tribool(x) != y; }
+
+/**
+ * \overload
+ */
+inline bool operator!=(dontcare_keyword_t, tribool x)
+{ return tribool(dontcare) != x; }
+
+} // end namespace orxonox
+
+#endif // ORXONOX_TRIBOOL_H
+
Modified: code/trunk/src/modules/docking/Dock.cc
===================================================================
--- code/trunk/src/modules/docking/Dock.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/modules/docking/Dock.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -43,13 +43,8 @@
#include "interfaces/PlayerTrigger.h"
#include "worldentities/pawns/Pawn.h"
-#include "ToluaBindDocking.h"
-
namespace orxonox
{
- // Register tolua_open function when loading the library
- DeclareToluaInterface(Docking);
-
CreateFactory(Dock);
SetConsoleCommand("Dock", "dock", &Dock::cmdDock).addShortcut().setAsInputCommand();
Modified: code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -42,16 +42,11 @@
#include "core/XMLPort.h"
#include "util/Convert.h"
-#include "ToluaBindNotifications.h"
-
namespace orxonox
{
CreateFactory(NotificationQueueCEGUI);
- // Register tolua_open function when loading the library.
- DeclareToluaInterface(Notifications);
-
/*static*/ const std::string NotificationQueueCEGUI::NOTIFICATION_LAYER("NotificationLayer");
NotificationQueueCEGUI::NotificationQueueCEGUI(BaseObject* creator) : NotificationQueue(creator)
Modified: code/trunk/src/modules/objects/eventsystem/EventFilter.cc
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventFilter.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/modules/objects/eventsystem/EventFilter.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -29,6 +29,7 @@
#include "EventFilter.h"
#include "core/CoreIncludes.h"
+#include "core/Event.h"
#include "core/XMLPort.h"
#include "EventName.h"
Modified: code/trunk/src/modules/objects/eventsystem/EventListener.cc
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventListener.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/modules/objects/eventsystem/EventListener.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -29,6 +29,7 @@
#include "EventListener.h"
#include "core/CoreIncludes.h"
+#include "core/Event.h"
#include "core/XMLPort.h"
namespace orxonox
Modified: code/trunk/src/modules/overlays/hud/GametypeFadingMessage.h
===================================================================
--- code/trunk/src/modules/overlays/hud/GametypeFadingMessage.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/modules/overlays/hud/GametypeFadingMessage.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -26,8 +26,8 @@
*
*/
-#ifndef _GametypeInfoMessage_H__
-#define _GametypeInfoMessage_H__
+#ifndef _GametypeFadingMessage_H__
+#define _GametypeFadingMessage_H__
#include "overlays/OverlaysPrereqs.h"
Modified: code/trunk/src/modules/pickup/PickupCollectionIdentifier.h
===================================================================
--- code/trunk/src/modules/pickup/PickupCollectionIdentifier.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/modules/pickup/PickupCollectionIdentifier.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -33,7 +33,7 @@
*/
#ifndef _PickupCollectionIdentifier_H__
-#define _PickupCollectionIdentifier_H_
+#define _PickupCollectionIdentifier_H__
#include "PickupPrereqs.h"
@@ -74,4 +74,4 @@
}
-#endif // _PickupCollectionIdentifier_H_
+#endif // _PickupCollectionIdentifier_H__
Modified: code/trunk/src/modules/pickup/PickupManager.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupManager.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/modules/pickup/PickupManager.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -48,13 +48,8 @@
#include "CollectiblePickup.h"
#include "PickupRepresentation.h"
-#include "ToluaBindPickup.h"
-
namespace orxonox
{
- // Register tolua_open function when loading the library
- DeclareToluaInterface(Pickup);
-
ManageScopedSingleton(PickupManager, ScopeID::Root, false);
// Initialization of the name of the PickupInventory GUI.
Modified: code/trunk/src/modules/pong/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/pong/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/modules/pong/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -1,5 +1,5 @@
SET_SOURCE_FILES(PONG_SRC_FILES
-COMPILATION_BEGIN PongCompilation.cc
+BUILD_UNIT PongBuildUnit.cc
Pong.cc
PongAI.cc
PongBall.cc
@@ -7,7 +7,7 @@
PongBot.cc
PongCenterpoint.cc
PongScore.cc
-COMPILATION_END
+END_BUILD_UNIT
)
ORXONOX_ADD_LIBRARY(pong
Modified: code/trunk/src/modules/pong/PongAI.cc
===================================================================
--- code/trunk/src/modules/pong/PongAI.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/modules/pong/PongAI.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -35,6 +35,7 @@
#include "core/CoreIncludes.h"
#include "core/ConfigValueIncludes.h"
+#include "core/command/Executor.h"
#include "tools/Timer.h"
#include "worldentities/ControllableEntity.h"
Modified: code/trunk/src/modules/questsystem/QuestManager.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestManager.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/modules/questsystem/QuestManager.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -46,13 +46,8 @@
#include "QuestHint.h"
#include "QuestItem.h"
-#include "ToluaBindQuestsystem.h"
-
namespace orxonox
{
- // Register tolua_open function when loading the library
- DeclareToluaInterface(Questsystem);
-
ManageScopedSingleton(QuestManager, ScopeID::Root, false);
/**
Modified: code/trunk/src/modules/weapons/munitions/ReplenishingMunition.cc
===================================================================
--- code/trunk/src/modules/weapons/munitions/ReplenishingMunition.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/modules/weapons/munitions/ReplenishingMunition.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -27,7 +27,9 @@
*/
#include "ReplenishingMunition.h"
+
#include "core/CoreIncludes.h"
+#include "core/command/Executor.h"
namespace orxonox
{
Modified: code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -30,6 +30,7 @@
#include "util/Convert.h"
#include "core/CoreIncludes.h"
+#include "core/command/Executor.h"
namespace orxonox
{
Modified: code/trunk/src/orxonox/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/orxonox/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -34,10 +34,11 @@
ChatHistory.cc
ChatInputHandler.cc
# Test.cc
-COMPILATION_BEGIN SceneCompilation.cc
+
+BUILD_UNIT SceneBuildUnit.cc
CameraManager.cc
Scene.cc
-COMPILATION_END
+END_BUILD_UNIT
)
ADD_SUBDIRECTORY(collisionshapes)
Modified: code/trunk/src/orxonox/Main.cc
===================================================================
--- code/trunk/src/orxonox/Main.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/orxonox/Main.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -38,12 +38,7 @@
#include "core/CommandLineParser.h"
#include "core/Game.h"
#include "core/LuaState.h"
-#include "ToluaBindOrxonox.h"
-#include "ToluaBindNetwork.h"
-DeclareToluaInterface(Orxonox);
-DeclareToluaInterface(Network);
-
namespace orxonox
{
SetCommandLineSwitch(console).information("Start in console mode (text IO only)");
Modified: code/trunk/src/orxonox/controllers/AIController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/AIController.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/orxonox/controllers/AIController.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -36,7 +36,7 @@
namespace orxonox
{
- static const float ACTION_INTERVAL = 1.0f;
+ const float AIController::ACTION_INTERVAL = 1.0f;
CreateFactory(AIController);
Modified: code/trunk/src/orxonox/controllers/AIController.h
===================================================================
--- code/trunk/src/orxonox/controllers/AIController.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/orxonox/controllers/AIController.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -49,6 +49,8 @@
virtual void action();
private:
+ static const float ACTION_INTERVAL;
+
Timer actionTimer_;
};
}
Modified: code/trunk/src/orxonox/controllers/DroneController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/DroneController.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/orxonox/controllers/DroneController.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -42,7 +42,7 @@
*/
CreateFactory(DroneController);
- static const float ACTION_INTERVAL = 1.0f;
+ const float DroneController::ACTION_INTERVAL = 1.0f;
DroneController::DroneController(BaseObject* creator) : ArtificialController(creator)
{
Modified: code/trunk/src/orxonox/controllers/DroneController.h
===================================================================
--- code/trunk/src/orxonox/controllers/DroneController.h 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/orxonox/controllers/DroneController.h 2011-07-04 00:47:44 UTC (rev 8729)
@@ -68,6 +68,8 @@
bool isShooting_;
private:
+ static const float ACTION_INTERVAL;
+
Timer actionTimer_;
WeakPtr<Pawn> owner_;
Drone* drone_;
Modified: code/trunk/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSLevel.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/orxonox/gamestates/GSLevel.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -76,12 +76,12 @@
if (GameMode::showsGraphics())
{
gameInputState_ = InputManager::getInstance().createInputState("game");
- gameInputState_->setMouseExclusive(TriBool::True);
+ gameInputState_->setMouseExclusive(true);
gameInputState_->setHandler(KeyBinderManager::getInstance().getDefaultAsHandler());
KeyBinderManager::getInstance().setToDefault();
guiMouseOnlyInputState_ = InputManager::getInstance().createInputState("guiMouseOnly");
- guiMouseOnlyInputState_->setMouseExclusive(TriBool::True);
+ guiMouseOnlyInputState_->setMouseExclusive(true);
guiMouseOnlyInputState_->setMouseHandler(&GUIManager::getInstance());
guiKeysOnlyInputState_ = InputManager::getInstance().createInputState("guiKeysOnly");
Modified: code/trunk/src/orxonox/gametypes/Dynamicmatch.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/Dynamicmatch.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/orxonox/gametypes/Dynamicmatch.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -47,6 +47,7 @@
#include "util/Convert.h"
#include "core/CoreIncludes.h"
+#include "core/command/Executor.h"
#include "network/Host.h"
#include "infos/PlayerInfo.h"
#include "worldentities/pawns/Pawn.h"
Modified: code/trunk/src/orxonox/graphics/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/graphics/CMakeLists.txt 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/orxonox/graphics/CMakeLists.txt 2011-07-04 00:47:44 UTC (rev 8729)
@@ -8,9 +8,10 @@
AnimatedModel.cc
ParticleEmitter.cc
ParticleSpawner.cc
-COMPILATION_BEGIN GraphicsCompilation.cc
+
+BUILD_UNIT GraphicsBuildUnit.cc
Backlight.cc
Camera.cc
Light.cc
-COMPILATION_END
+END_BUILD_UNIT
)
Modified: code/trunk/src/orxonox/overlays/InGameConsole.cc
===================================================================
--- code/trunk/src/orxonox/overlays/InGameConsole.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/orxonox/overlays/InGameConsole.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -90,6 +90,10 @@
this->setConfigValues();
this->initialise();
+
+ // Output buffering is not anymore needed. Not the best solution to do
+ // this here, but there isn't much of another way.
+ OutputHandler::getInstance().disableMemoryLog();
}
/**
@@ -585,6 +589,9 @@
case Shell::Hint: colourTop = ColourValue(0.80f, 0.80f, 0.80f, 1.00f);
colourBottom = ColourValue(0.90f, 0.90f, 0.90f, 1.00f); break;
+ case Shell::TDebug: colourTop = ColourValue(0.90f, 0.00f, 0.90f, 1.00f);
+ colourBottom = ColourValue(1.00f, 0.00f, 1.00f, 1.00f); break;
+
default: colourTop = ColourValue(0.90f, 0.90f, 0.90f, 1.00f);
colourBottom = ColourValue(1.00f, 1.00f, 1.00f, 1.00f); break;
}
Modified: code/trunk/src/orxonox/sound/BaseSound.cc
===================================================================
--- code/trunk/src/orxonox/sound/BaseSound.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/orxonox/sound/BaseSound.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -60,7 +60,8 @@
BaseSound::~BaseSound()
{
- this->stop();
+ if (this->state_ != Stopped)
+ this->stop();
// Release buffer
if (this->soundBuffer_ != NULL)
{
Modified: code/trunk/src/orxonox/weaponsystem/Munition.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/Munition.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/orxonox/weaponsystem/Munition.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -28,7 +28,9 @@
*/
#include "Munition.h"
+
#include "core/CoreIncludes.h"
+#include "core/command/Executor.h"
namespace orxonox
{
Modified: code/trunk/src/orxonox/weaponsystem/WeaponSystem.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponSystem.cc 2011-07-03 15:44:55 UTC (rev 8728)
+++ code/trunk/src/orxonox/weaponsystem/WeaponSystem.cc 2011-07-04 00:47:44 UTC (rev 8729)
@@ -29,6 +29,7 @@
#include "WeaponSystem.h"
#include "core/CoreIncludes.h"
+#include "core/SubclassIdentifier.h"
#include "worldentities/pawns/Pawn.h"
#include "WeaponSlot.h"
More information about the Orxonox-commit
mailing list