Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6417


Ignore:
Timestamp:
Dec 25, 2009, 10:23:58 PM (11 years ago)
Author:
rgrieder
Message:

Merged presentation2 branch back to trunk.
Major new features:

  • Actual GUI with settings, etc.
  • Improved space ship steering (human interaction)
  • Rocket fire and more particle effects
  • Advanced sound framework
Location:
code/trunk
Files:
5 deleted
357 edited
65 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/README

    r1505 r6417  
    33We are proud to present you Orxonox - the most ferious 3D space shooter ever to exist.
    44
    5 This game is free, if you have paid for this, get your money back! The source code of this game is licensed under the GPL (GNU General Public License). 
     5This game is free, if you have paid for this, get your money back! The source code of this game is licensed under the GPL (GNU General Public License).
    66The game content is licensed under the Creative Commons Attribution-Sharealike 2.5 license. For more information read LICENSE in the same folder you found this file.
    77
  • code/trunk/bin/dedicatedClient.bat.in

    • Property svn:eol-style set to native
  • code/trunk/bin/dedicatedClient.in

    • Property svn:eol-style set to native
  • code/trunk/cmake/FindLua.cmake

    r2710 r6417  
    136136      ENDIF()
    137137    ENDIF(${LUA_5.0_LUA_LIBRARY} MATCHES "framework")
    138    
     138
    139139    IF(LUA_5.0_LIBRARIES)
    140140      SET(LUA_5.0_FOUND TRUE)
  • code/trunk/cmake/FindPackageHandleAdvancedArgs.cmake

    r2710 r6417  
    2525 #    EXACT keyword if specified in FIND_PACKAGE(...).
    2626 #
    27  
     27
    2828INCLUDE(FindPackageHandleStandardArgs)
    2929INCLUDE(CompareVersionStrings)
  • code/trunk/cmake/LibraryConfig.cmake

    r5794 r6417  
    2525 #    for certain libraries (Boost, OpenAL, TCL)
    2626 #
    27  
     27
    2828INCLUDE(CompareVersionStrings)
    2929INCLUDE(FindPackageHandleStandardArgs)
  • code/trunk/cmake/LibraryConfigApple.cmake

    r5781 r6417  
    2323 #    Sets necessary library options and paths on Mac.
    2424 #
    25  
     25
    2626IF(APPLE)
    2727  MESSAGE(STATUS "Running on Apple. Using customized paths and options.")
  • code/trunk/cmake/PrecompiledHeaderFiles.cmake

    r5929 r6417  
    2323
    2424INCLUDE(GetGCCCompilerFlags)
    25  
     25
    2626MACRO(PRECOMPILED_HEADER_FILES_PRE_TARGET _target_name _header_file_arg _sourcefile_var)
    2727
     
    9494          SET(_old_flags "")
    9595        ENDIF()
    96         SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES COMPILE_FLAGS "${_old_flags} /FI\"${_pch_header_file}\" /Yu\"${_pch_header_file}\" /Fp\"${_pch_file}\"")
     96        SET_SOURCE_FILES_PROPERTIES(${_file} PROPERTIES COMPILE_FLAGS "${_old_flags} /FI\"${_pch_header_file}\" /Yu\"${_pch_header_file}\" /Fp\"${_pch_file}\"")
    9797      ENDIF(NOT _is_header)
    9898    ENDFOREACH(_file)
     
    152152        COMMAND ${CMAKE_CXX_COMPILER}
    153153        ARGS ${pchsupport_compiler_cxx_arg1} ${_pch_gcc_flags} -c -x c++-header -o ${_pch_file} ${_pch_header_file}
    154         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
     154        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    155155        DEPENDS ${_pch_dep_helper_file}
    156156        IMPLICIT_DEPENDS CXX ${_pch_header_file}
  • code/trunk/cmake/SourceFileUtilities.cmake

    r6084 r6417  
    7575      IF(_compile AND NOT DISABLE_COMPILATIONS)
    7676        LIST(APPEND _compilation ${_filepath})
    77         LIST(APPEND _fullpath_sources "H")
     77        LIST(APPEND _fullpath_sources "H")
    7878      ENDIF()
    7979    ENDIF()
  • code/trunk/data/DataInstallScript.cmake

    r5781 r6417  
    2929
    3030# Write some comment
    31 FILE(APPEND @DATA_INSTALL_DIRECTORY@/resources.oxr "\n\n\n <!-- ---------------------------------------- -->")
    32 FILE(APPEND @DATA_INSTALL_DIRECTORY@/resources.oxr     "\n <!-- Content from the external data directory -->")
    33 FILE(APPEND @DATA_INSTALL_DIRECTORY@/resources.oxr     "\n <!-- ---------------------------------------- -->\n\n")
     31FILE(APPEND @DATA_INSTALL_DIRECTORY@/DefaultResources.oxr "\n\n\n <!-- ---------------------------------------- -->")
     32FILE(APPEND @DATA_INSTALL_DIRECTORY@/DefaultResources.oxr     "\n <!-- Content from the external data directory -->")
     33FILE(APPEND @DATA_INSTALL_DIRECTORY@/DefaultResources.oxr     "\n <!-- ---------------------------------------- -->\n\n")
    3434
    3535# Append the external file
    3636FILE(READ   @EXTERNAL_DATA_DIRECTORY@/resources.oxr _external_file)
    37 FILE(APPEND @DATA_INSTALL_DIRECTORY@/resources.oxr ${_external_file})
     37FILE(APPEND @DATA_INSTALL_DIRECTORY@/DefaultResources.oxr ${_external_file})
  • code/trunk/data/defaultConfig/keybindings.ini

    r5929 r6417  
    2323KeyEnd=boost
    2424KeyEquals=
    25 KeyEscape="exit"
     25KeyEscape="keyESC"
    2626KeyF="scale -1 moveUpDown"
    2727KeyF1="OverlayGroup toggleVisibility Debug"
     
    122122KeyStop=
    123123KeySystemRequest=
    124 KeyT=
    125 KeyTab="cycleNavigationFocus"
    126 KeyU=
     124KeyT="onpress fire 2"
     125KeyTab="NewHumanController changeMode"
     126KeyU=""
    127127KeyUP="scale 1 moveFrontBack"
    128128KeyUnassigned="openConsole"
     
    147147
    148148[MouseButtons]
    149 MouseButton3=
    150 MouseButton4=
    151 MouseButton5=
    152 MouseButton6=
    153 MouseButton7=
    154 MouseLeft="fire 0"
    155 MouseMiddle=
    156 MouseRight="fire 1"
    157 MouseWheel1Down=
    158 MouseWheel1Up=
    159 MouseWheel2Down=
    160 MouseWheel2Up=
     149Button3=
     150Button4=
     151Button5=
     152Button6=
     153Button7=
    161154Left="fire 0"
    162 Right="fire 1"
     155Middle=
     156Right= fire 1 | unfire
     157Wheel1Down="NewHumanController decelerate"
     158Wheel1Up="NewHumanController accelerate"
     159Wheel2Down=
     160Wheel2Up=
    163161
    164162[MouseAxes]
  • code/trunk/data/gui/layouts/MainMenu.layout

    r5781 r6417  
    1 <?xml version="1.0" ?>
    2 <GUILayout>
    3     <Window Type="TaharezLook/StaticImage" Name="orxonox/Background">
    4     <Property Name="UnifiedSize" Value="{{1.0,0},{1.0,0}}"/>
    5     <Property Name="Image" Value="set:MainMenuBackground image:Background"/>
    6     <Property Name="FrameEnabled" Value="set:true"/>
    7     <Property Name="BackgroundEnabled" Value="set:false"/>
    8  
    9         <Window Type="TaharezLook/Button" Name="orxonox/StandaloneButton">
    10             <Property Name="UnifiedPosition" Value="{{0.11,0},{0.3,0}}"/>
    11             <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
    12             <Property Name="Text" Value="Standalone"/>
    13             <Property Name="Disabled" Value="true"/>
    14             <Event Name="Clicked" Function="MainMenu.button_standalone_clicked"/>
     1<?xml version="1.0" encoding="UTF-8"?>
     2
     3<GUILayout >
     4    <Window Type="TaharezLook/StaticImage" Name="orxonox/MainMenuBackground" >
     5        <Property Name="FrameEnabled" Value="False" />
     6        <Property Name="InheritsAlpha" Value="False" />
     7        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     8        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1.02125,0},{1.02167,0}}" />
     9        <Property Name="BackgroundEnabled" Value="False" />
     10        <Window Type="TaharezLook/Button" Name="orxonox/QuickGameTestButton" >
     11            <Property Name="Text" Value="Quickstart" />
     12            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     13            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.2875,0},{0.6,0},{0.3375,0}}" />
     14            <Event Name="Clicked" Function="MainMenu.QuickGameTestButton_clicked"/>
    1515        </Window>
    16        
    17         <Window Type="TaharezLook/Listbox" Name="orxonox/LevelListbox">
    18             <Property Name="UnifiedPosition" Value="{{0.4,0},{0.3,0}}"/>
     16        <Window Type="TaharezLook/Button" Name="orxonox/SingleplayerButton" >
     17            <Property Name="Text" Value="Singleplayer" />
    1918            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    20             <Property Name="UnifiedSize" Value="{{0.35,0},{0.33,0}}" />
    21             <Property Name="Tooltip" Value="Available Levels." />
    22             <Event Name="ItemSelectionChanged" Function="MainMenu.listbox_level_selectionchanged" />
     19            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.3625,0},{0.6,0},{0.4125,0}}" />
     20            <Event Name="Clicked" Function="MainMenu.SingleplayerButton_clicked"/>
    2321        </Window>
    24        
    25         <Window Type="TaharezLook/Button" Name="orxonox/DedicatedButton">
    26             <Property Name="UnifiedPosition" Value="{{0.11,0},{0.376,0}}"/>
    27             <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
    28             <Property Name="Text" Value="Dedicated"/>
    29             <Event Name="Clicked" Function="MainMenu.button_dedicated_clicked"/>
     22        <Window Type="TaharezLook/Button" Name="orxonox/MultiplayerButton" >
     23            <Property Name="Text" Value="Multiplayer" />
     24            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     25            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.4375,0},{0.6,0},{0.4875,0}}" />
     26            <Event Name="Clicked" Function="MainMenu.MultiplayerButton_clicked"/>
    3027        </Window>
    31        
    32         <Window Type="TaharezLook/Button" Name="orxonox/ServerButton">
    33             <Property Name="UnifiedPosition" Value="{{0.11,0},{0.452,0}}"/>
    34             <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
    35             <Property Name="Text" Value="Server"/>
    36             <Event Name="Clicked" Function="MainMenu.button_server_clicked"/>
     28        <Window Type="TaharezLook/Button" Name="orxonox/SettingsButton" >
     29            <Property Name="Text" Value="Settings" />
     30            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     31            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.5125,0},{0.6,0},{0.5625,0}}" />
     32            <Event Name="Clicked" Function="MainMenu.SettingsButton_clicked"/>
    3733        </Window>
    38        
    39         <Window Type="TaharezLook/Button" Name="orxonox/ClientButton">
    40             <Property Name="UnifiedPosition" Value="{{0.11,0},{0.528,0}}"/>
    41             <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
    42             <Property Name="Text" Value="Client"/>
    43             <Event Name="Clicked" Function="MainMenu.button_client_clicked"/>
     34        <Window Type="TaharezLook/Button" Name="orxonox/CreditsButton" >
     35            <Property Name="Text" Value="Credits" />
     36            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     37            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.5875,0},{0.6,0},{0.6375,0}}" />
     38            <Event Name="Clicked" Function="MainMenu.CreditsButton_clicked"/>
    4439        </Window>
    45        
    46         <Window Type="TaharezLook/Button" Name="orxonox/QuitButton">
    47             <Property Name="UnifiedPosition" Value="{{0.11,0},{0.604,0}}"/>
    48             <Property Name="UnifiedSize" Value="{{0.15,0},{0.05,0}}"/>
    49             <Property Name="Text" Value="Quit"/>
    50             <Event Name="Clicked" Function="MainMenu.button_quit_clicked"/>
     40        <Window Type="TaharezLook/Button" Name="orxonox/ExitButton" >
     41            <Property Name="Text" Value="Exit" />
     42            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
     43            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.6625,0},{0.6,0},{0.7125,0}}" />
     44            <Event Name="Clicked" Function="MainMenu.ExitButton_clicked"/>
    5145        </Window>
    5246    </Window>
  • code/trunk/data/gui/layouts/PickupInventory.layout

    r5781 r6417  
    1515            <Property Name="TabPanePosition" Value="Bottom" />
    1616            <Property Name="UnifiedAreaRect" Value="{{0,10},{0,30},{1,-10},{1,-10}}" />
    17            
     17
    1818            <Window Type="TaharezLook/ScrollablePane" Name="orxonox/Inventory/TabControl/TabEquipment">
    1919                <Property Name="Text" Value="Equipment" />
  • code/trunk/data/gui/layouts/QuestGUI.layout

    r5781 r6417  
    66    <Property Name="FrameEnabled" Value="set:true"/>
    77    <Property Name="BackgroundEnabled" Value="set:false"/>
     8    <Property Name="InheritsAlpha" Value="False" />
    89
    910        <Window Type="TaharezLook/Titlebar" Name="orxonox/QuestGUI/Title">
  • code/trunk/data/gui/scripts/InitialiseGUI.lua

    r5781 r6417  
    1414
    1515loadedGUIs = {}
     16cursorVisibility = {}
     17activeSheets = {}
     18nrOfActiveSheets = 0
     19root = nil
     20bShowsCursor = false
     21bHidePrevious = {}
     22
     23-- Require all tools
     24require("GUITools")
    1625
    1726-- loads the GUI with the specified filename
     
    2231    if loadedGui == nil then
    2332        loadedGuiNS = require(filename)
     33        if loadedGuiNS == nil then
     34            return
     35        end
    2436        loadedGui = loadedGuiNS:load()
    2537        loadedGUIs[filename] = loadedGui
     
    2739        if table.getn(loadedGUIs) == 1 then
    2840            current = loadedGUIs[1]
    29             showing = false
    3041        end
    3142        -- hide new GUI as we do not want to show it accidentially
     
    3546end
    3647
    37 function showGUI(filename, ptr)
    38     gui = showGUI(filename)
     48function showGUI(filename, hidePrevious, bCursorVisible, ptr)
     49    gui = showGUI(filename, hidePrevious, bCursorVisible)
    3950    gui.overlay = ptr
    4051end
     
    4253-- shows the specified and loads it if not loaded already
    4354-- be sure to set the global variable "filename" before calling this function
    44 function showGUI(filename)
    45     if current == nil or current.filename ~= filename then
    46         current = loadedGUIs[filename]
    47         if current == nil then
    48             current = loadGUI(filename)
    49         end
    50         system:setGUISheet(current.window)
    51     end
    52     current:show()
    53     showing = true
    54     return current
    55 end
    56 
    57 function toggleGUI()
    58     if showing == true then
    59         current:hide()
     55function showGUI(filename, hidePrevious, bCursorVisible)
     56    if bCursorVisible == nil then
     57        if nrOfActiveSheets > 0 then
     58            bCursorVisible = cursorVisibility[activeSheets[nrOfActiveSheets]]
     59        else
     60            bCursorVisible = true
     61        end
     62    end
     63
     64    if root == nil then
     65        setBackground("")
     66    end
     67
     68    local currentGUI = loadedGUIs[filename]
     69    if(currentGUI == nil) then
     70        currentGUI = loadGUI(filename)
     71    end
     72
     73    if(root:isChild(currentGUI.window)) then
     74        root:removeChildWindow(currentGUI.window)
     75    end
     76    root:addChildWindow(currentGUI.window)
     77
     78    if bCursorVisible then
     79        showCursor()
     80    else
     81        hideCursor()
     82    end
     83
     84    if find( activeSheets, filename ) ~= nil then
     85        table.remove( activeSheets, find( activeSheets, filename ) )
     86        nrOfActiveSheets = nrOfActiveSheets - 1
     87    else
     88        if nrOfActiveSheets == 0 then
     89            orxonox.InputManager:getInstance():enterState("guiMouseOnly")
     90            orxonox.HumanController:pauseControl()
     91        end
     92    end
     93    nrOfActiveSheets = nrOfActiveSheets + 1
     94    table.insert(activeSheets, filename)
     95    activeSheets[nrOfActiveSheets] = filename
     96    bHidePrevious[filename]=hidePrevious
     97    cursorVisibility[filename] = bCursorVisible
     98
     99    if hidePrevious == true then
     100        for i=1,nrOfActiveSheets-1 do
     101            loadedGUIs[ activeSheets[i] ]:hide()
     102        end
     103    end
     104    currentGUI:show()
     105    return currentGUI
     106end
     107
     108function hideCursor()
     109    if bShowsCursor==true then
     110        bShowsCursor=false
    60111        cursor:hide()
    61         showing = false
    62     else
    63         current:show()
     112    end
     113end
     114
     115function showCursor()
     116    if bShowsCursor==false then
     117        bShowsCursor=true
    64118        cursor:show()
    65         showing = true
    66     end
    67     return showing
    68 end
    69 
    70 function hideCursor()
    71     cursor:hide()
    72 end
    73 
    74 function showCursor()
    75     cursor:show()
     119    end
    76120end
    77121
    78122function hideGUI(filename)
    79     current = loadedGUIs[filename]
    80     if current ~= nil then
    81         current:hide()
    82         showing = false
    83     end
    84 end
     123    local currentGUI = loadedGUIs[filename]
     124    if currentGUI == nil then
     125        return
     126    end
     127    currentGUI:hide()
     128    if bHidePrevious[filename] == true then
     129        local i = nrOfActiveSheets-1
     130        while i>0 do
     131            loadedGUIs[ activeSheets[i] ]:show()
     132            if bHidePrevious[filename]==true then
     133                break
     134            else
     135                i=i-1
     136            end
     137        end
     138    end
     139    root:removeChildWindow(currentGUI.window)
     140    local i=1
     141    while activeSheets[i] do
     142        if activeSheets[i+1] == nil then
     143            if activeSheets[i-1] ~= nil then
     144                if cursorVisibility[ activeSheets[i-1] ] == true then
     145                    showCursor()
     146                else
     147                    hideCursor()
     148                end
     149            else
     150                hideCursor()
     151            end
     152        end
     153        if activeSheets[i] == filename then
     154            table.remove( activeSheets, i )
     155            nrOfActiveSheets = nrOfActiveSheets-1
     156        else
     157            i = i+1
     158        end
     159    end
     160    cursorVisibility[filename] = nil -- remove the cursor visibility of the current gui from the table
     161    bHidePrevious[filename] = nil
     162    if nrOfActiveSheets == 0 then
     163        orxonox.InputManager:getInstance():leaveState("guiMouseOnly")
     164        orxonox.HumanController:resumeControl()
     165        hideCursor()
     166    end
     167end
     168
     169function hideAllGUIs()
     170    while nrOfActiveSheets ~= 0 do
     171        hideGUI(activeSheets[nrOfActiveSheets])
     172    end
     173end
     174
     175function keyESC()
     176    if nrOfActiveSheets == 1 and activeSheets[1] == "MainMenu" then
     177        orxonox.execute("exit")
     178    elseif nrOfActiveSheets > 0 then
     179        orxonox.execute("hideGUI "..activeSheets[nrOfActiveSheets])
     180    else
     181        showGUI("InGameMenu")
     182    end
     183end
     184
     185function setBackground(filename)
     186    local newroot
     187    if root ~= nil then
     188        root:rename("oldRootWindow")
     189    end
     190    if filename ~= "" then
     191        newroot = winMgr:loadWindowLayout(filename .. ".layout")
     192        newroot:rename("AbsoluteRootWindow")
     193        system:setGUISheet(newroot)
     194    else
     195        newroot = winMgr:createWindow("DefaultWindow", "AbsoluteRootWindow")
     196        newroot:setProperty("Alpha", "0.0")
     197        newroot:setSize(CEGUI.UVector2(CEGUI.UDim(1.0,0),CEGUI.UDim(1.0,0)))
     198        system:setGUISheet(newroot)
     199    end
     200    if root ~= nil then
     201        local child
     202        while root:getChildCount()~=0 do
     203            child = root:getChildAtIdx(0)
     204            root:removeChildWindow(child)
     205            newroot:addChildWindow(child)
     206        end
     207        winMgr:destroyWindow(root)
     208    end
     209    newroot:show()
     210    root = newroot
     211end
     212
     213function find(table, value)
     214    local i=0
     215    while table[i] ~= nil do
     216        if table[i]==value then
     217            return i
     218        else
     219            i=i+1
     220        end
     221    end
     222    return nil
     223end
     224
     225function test(e)
     226    debug(0, "Blubb")
     227end
  • code/trunk/data/gui/scripts/MainMenu.lua

    r5781 r6417  
    1212P.layoutString = "MainMenu.layout"
    1313
    14 function P:init()
    15     listbox = winMgr:getWindow("orxonox/LevelListbox")
    16     preselect = orxonox.LevelManager:getInstance():getDefaultLevel()
    17     orxonox.LevelManager:getInstance():compileAvailableLevelList()
    18     local levelList = {}
    19     local index = 0
    20     local level = ""
    21     while true do
    22       level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index)
    23       if level == "" then
    24         break
    25       end
    26       table.insert(levelList, level)
    27       index = index + 1
    28     end
    29     table.sort(levelList)
    30     for k,v in pairs(levelList) do
    31         item = CEGUI.createListboxTextItem(v)       
    32         item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
    33         CEGUI.toListbox(listbox):addItem(item)
    34         if v .. ".oxw" == preselect then
    35             listbox:setItemSelectState(item, true)
    36         end
    37     end
     14-- events for MainMenu
     15function P.QuickGameTestButton_clicked(e)
     16    orxonox.execute("startGame")
    3817end
    3918
    40 
    41 -- events for mainmenu
    42 function P.button_quit_clicked(e)
    43     hideGUI()
    44     orxonox.CommandExecutor:execute("exit")
     19function P.SingleplayerButton_clicked(e)
     20    showGUI("SingleplayerMenu", true)
    4521end
    4622
    47 function P.button_standalone_clicked(e)
    48     choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
    49     if choice then
    50         orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
    51         orxonox.CommandExecutor:execute("startGame")
    52         toggleGUI()
    53     end
     23function P.MultiplayerButton_clicked(e)
     24    showGUI("MultiplayerMenu", true)
    5425end
    5526
    56 function P.button_server_clicked(e)
    57     choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
    58     if choice then
    59         orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
    60         orxonox.CommandExecutor:execute("startServer")
    61         toggleGUI()
    62     end
     27function P.SettingsButton_clicked(e)
     28    showGUI("SettingsMenu", true)
    6329end
    6430
    65 function P.button_dedicated_clicked(e)
    66     choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
    67     if choice then
    68         orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
    69         orxonox.CommandExecutor:execute("startDedicated")
    70         toggleGUI()
    71     end
     31function P.CreditsButton_clicked(e)
     32    showGUI("CreditsMenu", true)
    7233end
    7334
    74 function P.button_client_clicked(e)
    75     choice = winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem()
    76     if choice then
    77         orxonox.LevelManager:getInstance():setDefaultLevel(choice:getText() .. ".oxw")
    78         orxonox.CommandExecutor:execute("startClient")
    79         toggleGUI()
    80     end
    81 end
    82 
    83 function P.listbox_level_selectionchanged(e)
    84     if winMgr:getWindow("orxonox/LevelListbox"):getFirstSelectedItem() then
    85         winMgr:getWindow("orxonox/StandaloneButton"):enable()
    86     else
    87         winMgr:getWindow("orxonox/StandaloneButton"):disable()
    88     end
     35function P.ExitButton_clicked(e)
     36    orxonox.execute("exit")
    8937end
    9038
  • code/trunk/data/gui/scripts/PickupInventory.lua

    r5781 r6417  
    2020    local equipCount = orxonox.PickupInventory:getEquipmentCount()
    2121    local usableCount = orxonox.PickupInventory:getUsableCount()
    22    
     22
    2323    if equipCount ~= self.lastEquipmentCount_ or usableCount ~= self.lastUsableCount_ then
    2424        self:updateTabs()
     
    3939    local t = name:sub(25, 27)
    4040    local i = name:sub(29)
    41    
     41
    4242    if t == "equ" then
    43        
     43
    4444    end
    45    
     45
    4646    if t == "use" then
    4747        if self.currentUsableID_ >= 0 then
     
    6060    orxonox.PickupInventory:getSingleton():clearInventory(winMgr, eqWin, usWin)
    6161    orxonox.PickupInventory:getSingleton():updateTabs(winMgr, eqWin, usWin)
    62    
     62
    6363    self.currentUsableID_ = orxonox.PickupInventory:getCurrentUsableIndex()
    6464    self.lastEquipmentCount_ = orxonox.PickupInventory:getEquipmentCount()
  • code/trunk/data/gui/scripts/QuestGUI.lua

    r5781 r6417  
    1515
    1616    local questManager = orxonox.QuestManager:getInstance()
    17      
     17
    1818    local questsList = winMgr:getWindow("orxonox/QuestGUI/QuestsList")
    1919
  • code/trunk/data/levels/empty_level.oxw

    r5781 r6417  
    1717    skybox       = "Orxonox/Starbox"
    1818  >
     19
     20<!--Rocket position="-10, 3.5,800" velocity="0,0,-100">
     21      <attached>
     22        <Model pitch=180 position="0,0,0" scale=1.5 mesh="rocket_test.mesh" >
     23          <attached>
     24           <ParticleEmitter pitch=0 roll=0 position="0,5,0" source="Orxonox/laser" lifetime=2.0 loop=1 startdelay=3.0/>
     25           <ParticleEmitter pitch=-90 roll=0 position="0,-5,0" source="Orxonox/particlecanon" lifetime=2.0 loop=1 startdelay=3.0/>
     26           <ParticleEmitter pitch=-90 roll=0 position="0,0,-2" source="Orxonox/rocketfire" lifetime=2.0 loop=1 startdelay=3.0 />
     27           <ParticleEmitter pitch=-90 roll=0 position="0,0,-2" source="Orxonox/smoke" lifetime=2.0 loop=1 startdelay=3.0 />
     28          </attached>
     29          </Model>
     30        </attached>
     31    </Rocket-->
     32
     33
    1934    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
    20     <SpawnPoint position="0,0,100" spawnclass=SpaceShip pawndesign=spaceshippirate />
     35    <SpawnPoint position="0,0,100" spawnclass=SpaceShip pawndesign=spaceshipassff />
    2136  </Scene>
    2237</Level>
  • code/trunk/data/levels/events.oxw

    • Property svn:eol-style set to native
    r5929 r6417  
    4545      works with all amounts of objects from zero to infinity. In the examples I used two objects each.
    4646    -->
    47      
     47
    4848
    4949    <!-- red -->
  • code/trunk/data/levels/gametype_asteroids.oxw

    r5781 r6417  
    2828?>
    2929
    30     <MovableEntity 
    31      position="<?lua print(math.random()* 15000 - 1000) ?>,<?lua print(math.random() * 12000 - 4000) ?>,<?lua print(math.random() * 12000 - 4000) ?>"        collisionType=dynamic 
     30    <MovableEntity
     31     position="<?lua print(math.random()* 15000 - 1000) ?>,<?lua print(math.random() * 12000 - 4000) ?>,<?lua print(math.random() * 12000 - 4000) ?>"        collisionType=dynamic
    3232     linearDamping=0.8
    3333     angularDamping=0
    34      scale=<?lua print(j * 150)?> 
     34     scale=<?lua print(j * 150)?>
    3535     collisiondamage=1
    3636     enablecollisiondamage=true>
  • code/trunk/data/levels/includes/weaponsettings3.oxi

    r5781 r6417  
    22      <WeaponSlot position="-15.0,-1.5,0" />
    33      <WeaponSlot position=" 15.0,-1.5,0" />
    4       <WeaponSlot position="  0.0, 0.0,0" />
     4      <WeaponSlot position="    0,   0,0" />
    55    </weaponslots>
    66    <weaponsets>
    77      <WeaponSet firemode=0 />
    88      <WeaponSet firemode=1 />
     9      <WeaponSet firemode=2 />
    910    </weaponsets>
    1011    <weapons>
     
    1314          <DefaultWeaponmodeLink firemode=0 weaponmode=0 />
    1415          <DefaultWeaponmodeLink firemode=1 weaponmode=1 />
     16          <DefaultWeaponmodeLink firemode=2 weaponmode=2 />
    1517        </links>
    1618        <Weapon>
     
    3638          <LightningGun mode=1 muzzleoffset="0,0,0" />
    3739        </Weapon>
     40        <Weapon>
     41          <RocketFire mode=2 muzzleoffset="0,0,0" />
     42        </Weapon>
    3843      </WeaponPack>
    3944      <WeaponPack>
     
    4146          <DefaultWeaponmodeLink firemode=1 weaponmode=0 />
    4247        </links>
    43         <Weapon>
    44           <!-- EnergyDrink mode=0 munitionpershot=0 delay=0  material="Flares/point_lensflare"muzzleoffset="2,-0.2,-1" / -->
    45         </Weapon>
     48        <!--Weapon>
     49          <EnergyDrink mode=0 munitionpershot=0 delay=0  material="Flares/point_lensflare"muzzleoffset="2,-0.2,-1" />
     50        </Weapon-->
    4651      </WeaponPack>
    4752    </weapons>
  • code/trunk/data/levels/includes/weaponsettings_ghost.oxi

    • Property svn:eol-style set to native
    r5989 r6417  
    1616          <HsW01 mode=0 munitionpershot=0 delay=0 material="Flares/point_lensflare" />
    1717          <HsW01 mode=0 munitionpershot=0 delay=0.125 material="Flares/point_lensflare" muzzleoffset=" 0.5,0.6,1.7" />
     18          <LightningGun mode=1 muzzleoffset="0,0,0" />
    1819        </Weapon>
    1920        <Weapon>
    2021          <HsW01 mode=0 munitionpershot=0 delay=0  material="Flares/point_lensflare" />
    2122          <HsW01 mode=0 munitionpershot=0 delay=0.125 material="Flares/point_lensflare" muzzleoffset="-0.5,0.6,1.7" />
     23          <LightningGun mode=1 muzzleoffset="0,0,0" />
    2224        </Weapon>
    2325      </WeaponPack>
  • code/trunk/data/levels/old/physicstest.oxw

    r5781 r6417  
    1212
    1313<?lua
    14 for i = 1, 226, 1 
     14for i = 1, 226, 1
    1515do ?>
    1616  <Model position="<?lua print(math.random() * 40000 - 20000)?>, <?lua print(math.random() * 40000 - 20000) ?>, <?lua print(math.random() * 40000 - 20000) ?>" scale="<?lua print(math.random() * 250 + 20) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" rotationAxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationRate="<?lua print(math.random() * 30 + 15) ?>" />
    17 <?lua 
     17<?lua
    1818end
    1919?>
  • code/trunk/data/levels/old/physicstest2.oxw

    r5929 r6417  
    2121    <SpawnPoint position="0, 300, -300" pitch=-90 spawnclass=SpaceShip pawndesign=spaceshipassff /-->
    2222
    23         <!-- axes in ogre's origin of coordinate system for phsics engine testing purposes-->
    24         <StaticEntity
     23    <!-- axes in ogre's origin of coordinate system for phsics engine testing purposes-->
     24    <StaticEntity
    2525     position        = "0,0,0"
    2626     name            = "banana"
     
    3535        <PlaneCollisionShape name="thePlane" planeNormal="0,1,0" planeOffset=0 />
    3636      </collisionShapes>
    37         </StaticEntity>
    38 
    39         <!-- red sphere for phsics engine testing purposes-->
    40         <!--StaticEntity position="40,0,0">
    41                 <attached>
    42                         <Model position="0,0,0" scale=1 mesh="sphere.mesh" />
    43                 </attached>
    44         </StaticEntity-->
    45 
    46         <!-- yellow cube for phsics engine testing purposes-->
    47         <!--StaticEntity position="80,0,0">
     37    </StaticEntity>
     38
     39    <!-- red sphere for phsics engine testing purposes-->
     40    <!--StaticEntity position="40,0,0">
     41      <attached>
     42        <Model position="0,0,0" scale=1 mesh="sphere.mesh" />
     43      </attached>
     44    </StaticEntity-->
     45
     46    <!-- yellow cube for phsics engine testing purposes-->
     47    <!--StaticEntity position="80,0,0">
    4848      <attached>
    4949        <Model position="0,0,0" scale=1 mesh="cube.mesh" />
    5050      </attached>
    51         </StaticEntity-->
     51    </StaticEntity-->
    5252
    5353    <MovableEntity
  • code/trunk/data/levels/old/presentation_physics.oxw

    r5781 r6417  
    3030        <PlaneCollisionShape planeNormal="0,1,0" planeOffset=0 />
    3131      </collisionShapes>
    32         </StaticEntity>
     32    </StaticEntity>
    3333
    34         <MovableEntity
     34    <MovableEntity
    3535     position        = "0,250,500"
    3636     rotationaxis    = "1, 1, 1"
     
    6464        <BoxCollisionShape position="0,0.1,-19"  halfExtents="1.4, 1, 2" />
    6565      </collisionShapes>
    66         </MovableEntity>
     66    </MovableEntity>
    6767
    6868    <?lua
  • code/trunk/data/levels/old/princessaeryn.oxw

    r5929 r6417  
    66
    77<?lua
    8         dofile("includes/CuboidSpaceStation.lua")
     8    dofile("includes/CuboidSpaceStation.lua")
    99?>
    1010
    1111<NotificationQueue
    12         name  = "notification"
    13         position = "1.0, 1.0"
    14         targets = "questsystem"
     12 name  = "notification"
     13 position = "1.0, 1.0"
     14 targets = "questsystem"
    1515/>
    1616
  • code/trunk/data/levels/old/questsystem.oxw

    r5781 r6417  
    66
    77<NotificationQueue
    8         name  = "notification"
    9         position = "1.0, 1.0"
    10         targets = "all"
     8 name  = "notification"
     9 position = "1.0, 1.0"
     10 targets = "all"
    1111/>
    1212
     
    2929        </GlobalQuest>
    3030
    31                                 <ParticleSpawner position="0,0,100" source="Orxonox/BigExplosion1part3" lifetime=2.0 loop=0 autostart=0>
    32                                   <events>
    33                                     <spawn>
    34                                       <EventTrigger delay=1>
    35                                         <events>
    36                                           <trigger>
    37                                             <SpawnPoint position="0,0,100" spawnclass=SpaceShip pawndesign=spaceshipassff />
    38                                           </trigger>
    39                                         </events>
    40                                       </EventTrigger>
    41                                     </spawn>
    42                                   </events>
    43                                 </ParticleSpawner>
     31        <ParticleSpawner position="0,0,100" source="Orxonox/BigExplosion1part3" lifetime=2.0 loop=0 autostart=0>
     32            <events>
     33                <spawn>
     34                    <EventTrigger delay=1>
     35                        <events>
     36                            <trigger>
     37                                <SpawnPoint position="0,0,100" spawnclass=SpaceShip pawndesign=spaceshipassff />
     38                            </trigger>
     39                        </events>
     40                    </EventTrigger>
     41                </spawn>
     42            </events>
     43        </ParticleSpawner>
    4444
    4545        <QuestEffectBeacon position="0,0,100" times=-1>
  • code/trunk/data/levels/old/sample4.oxw

    r5929 r6417  
    2323        <Model position="0,0,0" scale=10 mesh="satellite.mesh" />
    2424        <MovableEntity position="-4,0,0" velocity="0,0,0" rotationaxis="0,0,1" rotationrate=50>
    25           <attached>
     25          <attached>
    2626            <Model position="4,0,0" scale=10 mesh="satellitedish.mesh"/>
    2727          </attached>
    28         </MovableEntity>
     28        </MovableEntity>
    2929        <ParticleEmitter pitch=-135 roll=30 position="-14, 3.5,-2.5" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
    3030        <ParticleEmitter pitch=135 roll=30 position="-14, 3.5,-9" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
  • code/trunk/data/levels/old/spaceshiptemplates_physics.oxw

    r5781 r6417  
    1010   auxilaryThrust    = 30;
    1111   rotationThrust    = 10;
    12    
     12
    1313   collisionType     = "dynamic"
    1414   mass              = 100
  • code/trunk/data/levels/old/tutorial_hs08.oxw

    r5781 r6417  
    1919<!-- Embedded lua code (creates random asteroids) -->
    2020<?lua
    21 for i = 1, 226, 1 
     21for i = 1, 226, 1
    2222do ?>
    2323  <Model position="<?lua print(math.random() * 40000 - 20000)?>, <?lua print(math.random() * 40000 - 20000) ?>, <?lua print(math.random() * 40000 - 20000) ?>" scale="<?lua print(math.random() * 250 + 20) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" rotationAxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationRate="<?lua print(math.random() * 30 + 15) ?>" />
    24 <?lua 
     24<?lua
    2525end
    2626?>
  • code/trunk/data/levels/presentation.oxw

    r5929 r6417  
    2020
    2121
    22         <!-- axes in ogre's origin of coordinate system for phsics engine testing purposes-->
    23         <!--StaticEntity position="0,0,0">
    24                 <attached>
    25                         <Model position="0,0,0" scale=1 mesh="axes.mesh" />
    26                 </attached>
    27         </StaticEntity -->
     22    <!-- axes in ogre's origin of coordinate system for phsics engine testing purposes-->
     23    <!--StaticEntity position="0,0,0">
     24      <attached>
     25        <Model position="0,0,0" scale=1 mesh="axes.mesh" />
     26      </attached>
     27    </StaticEntity -->
    2828
    29         <!-- red sphere for phsics engine testing purposes-->
    30         <!--StaticEntity position="40,0,0">
    31                 <attached>
    32                         <Model position="0,0,0" scale=1 mesh="sphere.mesh" />
    33                 </attached>
    34         </StaticEntity-->
     29    <!-- red sphere for phsics engine testing purposes-->
     30    <!--StaticEntity position="40,0,0">
     31      <attached>
     32        <Model position="0,0,0" scale=1 mesh="sphere.mesh" />
     33      </attached>
     34    </StaticEntity-->
    3535
    36         <!-- yellow cube for phsics engine testing purposes-->
    37         <!--StaticEntity position="80,0,0">
    38                 <attached>
    39                         <Model position="0,0,0" scale=1 mesh="cube.mesh" />
    40                 </attached>
    41         </StaticEntity-->
     36    <!-- yellow cube for phsics engine testing purposes-->
     37    <!--StaticEntity position="80,0,0">
     38      <attached>
     39        <Model position="0,0,0" scale=1 mesh="cube.mesh" />
     40      </attached>
     41    </StaticEntity-->
    4242
    43         <!-- Carrier with guns not implemented yet -->
    44         <MovableEntity position="-2000,-1000,-2000" pitch="-90" roll="90">
     43    <!-- Carrier with guns not implemented yet -->
     44    <MovableEntity position="-2000,-1000,-2000" pitch="-90" roll="90">
    4545      <attached>
    4646        <Model position="0,0,0" scale=10 mesh="Carrier.mesh" />
    47                 <Model position="0,30,20" scale=10 mesh="pirate.mesh" roll="180" />
     47        <Model position="0,30,20" scale=10 mesh="pirate.mesh" roll="180" />
    4848        <Model position="-80,-30,20" scale=10 mesh="pirate.mesh" roll="180" />
    4949      </attached>
     
    5454        <Model position="0,0,0" scale=10 mesh="satellite.mesh" />
    5555        <MovableEntity position="-4,0,0" velocity="0,0,0" rotationaxis="0,0,1" rotationrate=50>
    56           <attached>
     56          <attached>
    5757            <Model position="4,0,0" scale=10 mesh="satellitedish.mesh"/>
    5858          </attached>
    59         </MovableEntity>
     59        </MovableEntity>
    6060        <ParticleEmitter pitch=-135 roll=30 position="-14, 3.5,-2.5" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
    6161        <ParticleEmitter pitch=135 roll=30 position="-14, 3.5,-9" source="Orxonox/thruster3" lifetime=2.0 loop=1 startdelay=3.0 />
  • code/trunk/data/levels/presentation09.oxw

    r5781 r6417  
    2424max = 20
    2525for i = 1, max, 1
    26 do 
     26do
    2727    x = math.sin(i/max*6)*40000
    2828    y = math.cos(i/max*6)*40000
     
    3030    ?>
    3131<?lua
    32 for k = 1, 25, 1 
     32for k = 1, 25, 1
    3333do
    3434j = math.random()
    3535?>
    36    
    37     <MovableEntity position="<?lua print(x + math.random() * 10000-2500) ?>,<?lua print(y + math.random() * 5000-2500) ?>,<?lua print(z + math.random() * 1000-500) ?>" <?lua if i == 5 then ?> collisionType=dynamic linearDamping=0.8 angularDamping=0 mass=<?lua print(j * 50) ?> <?lua end ?> scale=<?lua print(j * 5) ?> rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>"> 
     36
     37    <MovableEntity position="<?lua print(x + math.random() * 10000-2500) ?>,<?lua print(y + math.random() * 5000-2500) ?>,<?lua print(z + math.random() * 1000-500) ?>" <?lua if i == 5 then ?> collisionType=dynamic linearDamping=0.8 angularDamping=0 mass=<?lua print(j * 50) ?> <?lua end ?> scale=<?lua print(j * 5) ?> rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
    3838      <attached>
    3939        <Model position="0,0,0" scale=<?lua print(j * 10) ?> mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
     
    4343      </collisionShapes> <?lua end ?>
    4444    </MovableEntity>
    45 <?lua 
     45<?lua
    4646end
    4747?>
    4848<?lua end ?>
    4949    <Planet position="0,0,0" scale=10000 pitch=-90 mesh="iceplanet.mesh" atmosphere="atmosphere1" rotationaxis="1,1,0" rotationrate="1" atmospheresize=224.0f imagesize=1024.0f />
    50    
     50
    5151  </Scene>
    5252</Level>
  • code/trunk/data/levels/presentation09b.oxw

    r5929 r6417  
    8686      </controller>
    8787    </SpaceShip>
    88    
     88
    8989    <PickupSpawner item="JumpItem" triggerDistance="20" respawnTime="10000" position="-3800, 2500, 1500">
    9090        <attached>
     
    9393        </attached>
    9494    </PickupSpawner>
    95    
     95
    9696    <PickupSpawner item="HealthUsableItem" triggerDistance="20" respawnTime="10000" position="-4150,2750,1550">
    9797        <attached>
     
    100100        </attached>
    101101    </PickupSpawner>
    102    
     102
    103103    <PickupSpawner item="HealthImmediateItem" triggerDistance="20" respawnTime="3" position="2300, 4300, 2400">
    104104        <attached>
     
    121121
    122122<?lua
    123 for i = 1, 10, 1 
     123for i = 1, 10, 1
    124124do
    125125?>
     
    136136      </controller>
    137137    </SpaceShip>
    138 <?lua 
    139 end
    140 ?>
    141 
    142 <?lua
    143 for i = 1, 12, 1 
     138<?lua
     139end
     140?>
     141
     142<?lua
     143for i = 1, 12, 1
    144144do
    145145?>
     
    156156      </controller>
    157157    </SpaceShip>
    158 <?lua 
     158<?lua
    159159end
    160160?>
     
    173173
    174174<?lua
    175 for i = 1, 12, 1 
     175for i = 1, 12, 1
    176176do
    177177?>
     
    190190      </controller>
    191191    </SpaceShip>
    192 <?lua 
     192<?lua
    193193end
    194194?>
     
    320320
    321321<?lua
    322 for i = 1, 10, 1 
     322for i = 1, 10, 1
    323323do
    324324?>
     
    335335      </controller>
    336336    </SpaceShip>
    337 <?lua 
    338 end
    339 ?>
    340 
    341 <?lua
    342 for i = 1, 200, 1 
     337<?lua
     338end
     339?>
     340
     341<?lua
     342for i = 1, 200, 1
    343343do
    344344x = math.random() * 100  + (i-70) * 100
     
    347347s = math.random() * 60 + 30
    348348?>
    349    
    350     <MovableEntity position="<?lua print(x) ?>,<?lua print(y) ?>,<?lua print(z) ?>" linearDamping=0.8 angularDamping=0.8 rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 - 15) ?>"> 
     349
     350    <MovableEntity position="<?lua print(x) ?>,<?lua print(y) ?>,<?lua print(z) ?>" linearDamping=0.8 angularDamping=0.8 rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 - 15) ?>">
    351351      <attached>
    352352        <Model position="0,0,0" scale=<?lua print(s) ?> mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
    353353      </attached>
    354354    </MovableEntity>
    355 <?lua 
     355<?lua
    356356end
    357357?>
     
    363363    return table.getn(elements)
    364364end
    365 for i = 1, 150, 1 
     365for i = 1, 150, 1
    366366do
    367367x = math.random() * 750 - 4500
     
    370370e = math.floor(math.random()*elements.length()+1)
    371371?>
    372    
    373     <MovableEntity position="<?lua print(x) ?>,<?lua print(y) ?>,<?lua print(z) ?>" linearDamping=0.8 angularDamping=0.8 rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 - 15) ?>"> 
     372
     373    <MovableEntity position="<?lua print(x) ?>,<?lua print(y) ?>,<?lua print(z) ?>" linearDamping=0.8 angularDamping=0.8 rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 - 15) ?>">
    374374      <attached>
    375375        <Model position="0,0,0" scale="<?lua print(sizes[e]) ?>" mesh="<?lua print( elements[e]) ?>" />
    376376      </attached>
    377377    </MovableEntity>
    378 <?lua 
    379 end
    380 ?>
    381    
     378<?lua
     379end
     380?>
     381
    382382  </Scene>
    383383</Level>
  • code/trunk/data/levels/presentation_dm.oxw

    r5781 r6417  
    1818
    1919<?lua
    20 for i = 1, 10, 1 
     20for i = 1, 10, 1
    2121do ?>
    2222    <SpawnPoint position="<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
    23 <?lua 
     23<?lua
    2424end
    2525?>
     
    3535
    3636<?lua
    37 for i = 1, 100, 1 
     37for i = 1, 100, 1
    3838do
    3939j = math.random()
    4040?>
    41    
    42     <MovableEntity position="<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000 - 2000) ?>" collisionType=dynamic linearDamping=0.8 angularDamping=0 mass=<?lua print(j * 50) ?> scale=<?lua print(j * 5) ?> rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>"> 
     41
     42    <MovableEntity position="<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000-2000) ?>,<?lua print(math.random() * 5000 - 2000) ?>" collisionType=dynamic linearDamping=0.8 angularDamping=0 mass=<?lua print(j * 50) ?> scale=<?lua print(j * 5) ?> rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
    4343      <attached>
    4444        <Model position="0,0,0" scale=<?lua print(j * 10) ?> mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
     
    4848      </collisionShapes>
    4949    </MovableEntity>
    50 <?lua 
     50<?lua
    5151end
    5252?>
  • code/trunk/data/levels/princessaeryn.oxw

    r5929 r6417  
    66
    77<?lua
    8         dofile("includes/CuboidSpaceStation.lua")
     8    dofile("includes/CuboidSpaceStation.lua")
    99?>
    1010
  • code/trunk/data/levels/questsystem2.oxw

    • Property svn:eol-style set to native
    r5976 r6417  
    3737                    <QuestDescription title="The super Hint.3" description="Be proud of yourself.3" />
    3838                </QuestHint>
    39             </hints>   
     39            </hints>
    4040            <subquests>
    4141                <GlobalQuest id="e17f5245-f95b-44a8-b6cf-402274435ed4">
     
    215215max = 20
    216216for i = 1, max, 1
    217 do 
     217do
    218218    x = math.sin(i/max*6)*40000
    219219    y = math.cos(i/max*6)*40000
     
    221221    ?>
    222222<?lua
    223 for k = 1, 25, 1 
     223for k = 1, 25, 1
    224224do
    225225j = math.random()
    226226?>
    227    
    228     <MovableEntity position="<?lua print(x + math.random() * 10000-2500) ?>,<?lua print(y + math.random() * 5000-2500) ?>,<?lua print(z + math.random() * 1000-500) ?>" <?lua if i == 5 then ?> collisionType=dynamic linearDamping=0.8 angularDamping=0 mass=<?lua print(j * 50) ?> <?lua end ?> scale=<?lua print(j * 5) ?> rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>"> 
     227
     228    <MovableEntity position="<?lua print(x + math.random() * 10000-2500) ?>,<?lua print(y + math.random() * 5000-2500) ?>,<?lua print(z + math.random() * 1000-500) ?>" <?lua if i == 5 then ?> collisionType=dynamic linearDamping=0.8 angularDamping=0 mass=<?lua print(j * 50) ?> <?lua end ?> scale=<?lua print(j * 5) ?> rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
    229229      <attached>
    230230        <Model position="0,0,0" scale=<?lua print(j * 10) ?> mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
     
    234234      </collisionShapes> <?lua end ?>
    235235    </MovableEntity>
    236 <?lua 
     236<?lua
    237237end
    238238?>
    239239<?lua end ?>
    240240    <Planet position="0,0,0" scale=10000 pitch=-90 mesh="iceplanet.mesh" atmosphere="atmosphere1" rotationaxis="1,1,0" rotationrate="1" atmospheresize=224.0f imagesize=1024.0f />
    241    
     241
    242242  </Scene>
    243243</Level>
  • code/trunk/data/levels/teambasematchlevel.oxw

    r5781 r6417  
    4141        <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "100,0,0"/>
    4242<?lua
    43 for i = 1, 10, 1 
     43for i = 1, 10, 1
    4444do ?>
    4545        <ParticleSpawner position="<?lua print(math.random() * 400 - 200) ?>,<?lua print(math.random() * 200 - 100) ?>,<?lua print(math.random() * 200 - 100) ?>" startdelay=<?lua print(math.random()) ?> source="Orxonox/BigExplosion1part1" lifetime=2.0 loop=0 autostart=0>
    4646          <events><spawn><EventListener event="base 1" /></spawn></events>
    4747        </ParticleSpawner>
    48 <?lua 
     48<?lua
    4949end
    5050?>
     
    7878        <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "100,0,0"/>
    7979<?lua
    80 for i = 1, 10, 1 
     80for i = 1, 10, 1
    8181do ?>
    8282        <ParticleSpawner position="<?lua print(math.random() * 400 - 200) ?>,<?lua print(math.random() * 200 - 100) ?>,<?lua print(math.random() * 200 - 100) ?>" startdelay=<?lua print(math.random()) ?> source="Orxonox/BigExplosion1part1" lifetime=2.0 loop=0 autostart=0>
    8383          <events><spawn><EventListener event="base 2" /></spawn></events>
    8484        </ParticleSpawner>
    85 <?lua 
     85<?lua
    8686end
    8787?>
     
    115115        <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "100,0,0"/>
    116116<?lua
    117 for i = 1, 10, 1 
     117for i = 1, 10, 1
    118118do ?>
    119119        <ParticleSpawner position="<?lua print(math.random() * 400 - 200) ?>,<?lua print(math.random() * 200 - 100) ?>,<?lua print(math.random() * 200 - 100) ?>" startdelay=<?lua print(math.random()) ?> source="Orxonox/BigExplosion1part1" lifetime=2.0 loop=0 autostart=0>
    120120          <events><spawn><EventListener event="base 3" /></spawn></events>
    121121        </ParticleSpawner>
    122 <?lua 
     122<?lua
    123123end
    124124?>
     
    151151        <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "100,0,0"/>
    152152<?lua
    153 for i = 1, 10, 1 
     153for i = 1, 10, 1
    154154do ?>
    155155        <ParticleSpawner position="<?lua print(math.random() * 400 - 200) ?>,<?lua print(math.random() * 200 - 100) ?>,<?lua print(math.random() * 200 - 100) ?>" startdelay=<?lua print(math.random()) ?> source="Orxonox/BigExplosion1part1" lifetime=2.0 loop=0 autostart=0>
    156156          <events><spawn><EventListener event="base 4" /></spawn></events>
    157157        </ParticleSpawner>
    158 <?lua 
     158<?lua
    159159end
    160160?>
     
    188188        <Billboard scale=7 material="Examples/Flare" colour="0.5,0.5,0.5" position = "100,0,0"/>
    189189<?lua
    190 for i = 1, 10, 1 
     190for i = 1, 10, 1
    191191do ?>
    192192        <ParticleSpawner position="<?lua print(math.random() * 400 - 200) ?>,<?lua print(math.random() * 200 - 100) ?>,<?lua print(math.random() * 200 - 100) ?>" startdelay=<?lua print(math.random()) ?> source="Orxonox/BigExplosion1part1" lifetime=2.0 loop=0 autostart=0>
    193193          <events><spawn><EventListener event="base 5" /></spawn></events>
    194194        </ParticleSpawner>
    195 <?lua 
     195<?lua
    196196end
    197197?>
  • code/trunk/data/levels/templates/spaceship_assff.oxt

    r5781 r6417  
    6464   speedupdown    =  50
    6565
     66   defEngineSndNormal = "sounds/Engine_low.ogg"
     67   defEngineSndBoost = "sounds/Engine_high.ogg"
     68
    6669   accelerationfront     = 500
    6770   accelerationbrake     = 500
     
    7073   accelerationupdown    =  125
    7174  >
    72     <active>
     75    <EffectContainer condition="idle">
     76      <WorldSound mainstate="activity" source="sounds/Engine_idle.ogg" loop=1 active=false/>
     77    </EffectContainer>
     78    <EffectContainer condition="not idle">
    7379      <FadingBillboard mainstate=activity active=false scale=0.1 position="0, 0, 9" colour="0.2, 0.65, 1.0, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
    7480<!--
     
    7682      <Light mainstate=visibility position="-8, 0, 8" diffuse="0.3, 0.6, 1.0" specular="0.3, 0.6, 1.0" attenuation="600, 1.0, 0.007, 0.0002" type=point />
    7783-->
    78     </active>
    79     <forward>
     84    </EffectContainer>
     85    <EffectContainer condition="normal or brake">
     86
     87    </EffectContainer>
     88    <EffectContainer condition="normal or boost">
    8089      <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 7.6, 0, 6" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
    8190      <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-7.6, 0, 6" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
    82     </forward>
    83     <boost>
     91    </EffectContainer>
     92    <EffectContainer condition="boost">
    8493      <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 7.6, 0, 6" colour="0.6, 0.75, 0.8, 0.7" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
    8594      <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-7.6, 0, 6" colour="0.6, 0.75, 0.8, 0.7" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
    86     </boost>
    87     <brake>
     95    </EffectContainer>
     96    <EffectContainer condition="brake">
    8897      <FadingBillboard mainstate=activity active=false scale=0.3 position=" 8, 0, 6" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
    8998      <FadingBillboard mainstate=activity active=false scale=0.3 position="-8, 0, 6" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
    9099      <FadingBillboard mainstate=activity active=false scale=0.15 position=" 8, 0, 6" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
    91100      <FadingBillboard mainstate=activity active=false scale=0.15 position="-8, 0, 6" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
    92     </brake>
     101    </EffectContainer>
    93102  </MultiStateEngine>
    94103</Template>
  • code/trunk/data/levels/templates/spaceship_ghost.oxt

    • Property svn:eol-style set to native
    r5989 r6417  
    1212   initialhealth     = 100
    1313
    14    primaryThrust     = 100;
     14   primaryThrust     = 600;
    1515   auxilaryThrust    = 30;
    1616   rotationThrust    = 25;
     
    3333      <BoxCollisionShape position="0,0.1,-19"  halfExtents="1.4, 1, 2" />
    3434    </collisionShapes>
    35 
     35<?lua
     36  include("includes/weaponsettings_ghost.oxi")
     37?>
    3638  </SpaceShip>
    3739</Template>
     
    4446      <CameraPosition position="0,50,200" drag=true mouselook=true />
    4547    </camerapositions>
    46 
    47 <?lua
    48   include("includes/weaponsettings_ghost.oxi")
    49 ?>
    50 
    5148  </SpaceShip>
    5249</Template>
     
    5653   boostfactor    = 2
    5754
    58    speedfront     = 150
     55   speedfront     = 600
    5956   speedback      =  50
    6057   speedleftright =  50
    6158   speedupdown    =  50
    6259
    63    accelerationfront     = 300
     60   accelerationfront     = 700
    6461   accelerationbrake     = 300
    6562   accelerationback      =  100
     
    6764   accelerationupdown    =  100
    6865  >
    69 
    70 
    71     <forward>
    72       <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 6.06, 3.66, 9.6" colour="1, 1, 1, 0.4" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
    73       <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-6.06, 3.66, 9.6" colour="1, 1, 1, 0.4" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
    74       <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 6.06, 5.66, 9.6" colour="1, 1, 1, 0.4" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
    75       <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-6.06, 5.66, 9.6" colour="1, 1, 1, 0.4" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
    76       <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 6.86, 4.66, 9.6" colour="1, 1, 1, 0.4" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
    77       <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-6.86, 4.66, 9.6" colour="1, 1, 1, 0.4" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
    78     </forward>
    79     <boost>
    80       <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 6.06, 5.66, 11.6" colour="0.5, 0.85, 0.5, 0.1" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
    81       <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-6.06, 5.66, 11.6" colour="0.5, 0.85, 0.5, 0.1" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
    82       <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 6.06, 3.66, 11.6" colour="0.5, 0.85, 0.5, 0.1" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
    83       <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-6.06, 3.66, 11.6" colour="0.5, 0.85, 0.5, 0.1" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
    84       <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 6.86, 4.66, 11.6" colour="0.5, 0.85, 0.5, 0.1" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
    85       <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-6.86, 4.66, 11.6" colour="0.5, 0.85, 0.5, 0.1" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
    86     </boost>
    87   </MultiStateEngine>
     66    <EffectContainer condition="normal or boost">
     67      <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 7.6, 3, 6" colour="0.0, 0.0, 0.0, 0.5" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
     68      <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-7.6, 3, 6" colour="0.0, 0.0, 0.0, 0.5" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
     69    </EffectContainer>
     70    <EffectContainer condition="boost">
     71      <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 7.6, 3, 6" colour="0.0, 0.0, 0.0, 0.7" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
     72      <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-7.6, 3, 6" colour="0.0, 0.0, 0.0, 0.7" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
     73    </EffectContainer>
     74    <EffectContainer condition="not idle">
     75      <Backlight mainstate=activity active=false scale=0.4 position="7.6, 3, 6" colour="1, 1, 1, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
     76      <Backlight mainstate=activity active=false scale=0.4 position="-7.6, 3, 6" colour="1, 1, 1, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
     77    </EffectContainer>
     78    <EffectContainer condition="brake">
     79      <FadingBillboard mainstate=activity active=false scale=0.3 position=" 8, 0, 6" colour="0.2, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
     80      <FadingBillboard mainstate=activity active=false scale=0.3 position="-8, 0, 6" colour="0.2, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
     81    </EffectContainer>
     82</MultiStateEngine>
    8883</Template>
    8984
  • code/trunk/data/levels/test_ghost.oxw

    • Property svn:eol-style set to native
    r5989 r6417  
    2424max = 20
    2525for i = 1, max, 1
    26 do 
     26do
    2727    x = math.sin(i/max*6)*40000
    2828    y = math.cos(i/max*6)*40000
     
    3030    ?>
    3131<?lua
    32 for k = 1, 25, 1 
     32for k = 1, 25, 1
    3333do
    3434j = math.random()
    3535?>
    36    
    37     <MovableEntity position="<?lua print(x + math.random() * 10000-2500) ?>,<?lua print(y + math.random() * 5000-2500) ?>,<?lua print(z + math.random() * 1000-500) ?>" <?lua if i == 5 then ?> collisionType=dynamic linearDamping=0.8 angularDamping=0 mass=<?lua print(j * 50) ?> <?lua end ?> scale=<?lua print(j * 5) ?> rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>"> 
     36
     37    <MovableEntity position="<?lua print(x + math.random() * 10000-2500) ?>,<?lua print(y + math.random() * 5000-2500) ?>,<?lua print(z + math.random() * 1000-500) ?>" <?lua if i == 5 then ?> collisionType=dynamic linearDamping=0.8 angularDamping=0 mass=<?lua print(j * 50) ?> <?lua end ?> scale=<?lua print(j * 5) ?> rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
    3838      <attached>
    3939        <Model position="0,0,0" scale=<?lua print(j * 10) ?> mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
     
    4343      </collisionShapes> <?lua end ?>
    4444    </MovableEntity>
    45 <?lua 
     45<?lua
    4646end
    4747?>
    4848<?lua end ?>
    4949    <Planet position="0,0,0" scale=10000 pitch=-90 mesh="iceplanet.mesh" atmosphere="atmosphere1" rotationaxis="1,1,0" rotationrate="1" atmospheresize=224.0f imagesize=1024.0f />
    50    
     50
    5151  </Scene>
    5252</Level>
  • code/trunk/data/lua/LuaStateInit.lua

    r5695 r6417  
    1515
    1616-- Redirect dofile in order to load with the resource manager
    17 -- Note: The function does not behave exactly like LuaState::doFile because the
    18 --       default argument here for the group is not "General" but
    19 --       "NoResourceGroupProvided". This resolves to the resource group used to
    20 --       do the current file.
    21 doFile = function(filename, resourceGroup)
    22   local bSearchOtherPaths = (resourceGroup == nil) or false
    23   resourceGroup = resourceGroup or "NoResourceGroupProvided"
    24   luaState:doFile(filename, resourceGroup, bSearchOtherPaths)
     17doFile = function(filename)
     18  luaState:doFile(filename)
    2519  -- Required because the C++ function cannot return whatever might be on the stack
    26   return LuaStateReturnValue
     20  return LuaStateReturnValue -- C-injected global variable
    2721end
    2822original_dofile = dofile
     
    3125-- Create includeFile function that preparses the file according
    3226-- to a function provided to the LuaState constructor (in C++)
    33 -- Note: See the same notes as for doFile
    34 include = function(filename, resourceGroup)
    35   local bSearchOtherPaths = (resourceGroup == nil) or false
    36   resourceGroup = resourceGroup or "NoResourceGroupProvided"
    37   luaState:includeFile(filename, resourceGroup, bSearchOtherPaths)
     27include = function(filename)
     28  luaState:includeFile(filename)
    3829  -- Required because the C++ function cannot return whatever might be on the stack
    39   return LuaStateReturnValue
     30  return LuaStateReturnValue -- C-injected global variable
    4031end
    4132
    4233-- Replace require function with almost similar behaviour
    43 -- The difference is that you need to provide a resource group
    44 -- Default value there is the current one (if present) or else "General"
    45 -- But the loaded modules are then stored with only with the name (where name has no .lua extension)
    46 -- CAUTION: That also means that you need to take care of conflicting filenames among groups
    47 -- Furthermore the moduleName parameters is appended with the .lua extension when looking for the file
     34-- The loaded modules are then stored with their names (where name has no .lua extension)
     35-- Furthermore the ".lua" extension is appended to the moduleName parameter when looking for the file
    4836old_require = require
    49 require = function(moduleName, resourceGroup)
    50   local bSearchOtherPaths = (resourceGroup == nil) or false
    51   resourceGroup = resourceGroup or "NoResourceGroupProvided"
    52   if not luaState:fileExists(moduleName .. ".lua", resourceGroup, bSearchOtherPaths) then
     37require = function(moduleName)
     38  if not luaState:fileExists(moduleName .. ".lua") then
    5339    return nil
    5440  end
     
    6046    _REQUIREDNAME_OLD = _REQUIREDNAME
    6147    _REQUIREDNAME = moduleName
    62     luaState:doFile(moduleName .. ".lua", resourceGroup, bSearchOtherPaths)
     48    luaState:doFile(moduleName .. ".lua")
    6349    _LOADED[moduleName] = LuaStateReturnValue or true
    6450    -- restore old value
     
    6753  return _LOADED[moduleName]
    6854end
     55
     56-- Convenience function for console commands
     57orxonox.execute = function(command)
     58  orxonox.CommandExecutor:execute(command)
     59end
  • code/trunk/data/overlays/OrxonoxLoading.overlay

    r5781 r6417  
    1111      material Orxonox/LoadingScreenSample
    1212   }
    13 } 
     13}
  • code/trunk/data/overlays/debug.oxo

    r5781 r6417  
    3535   textsize = 0.03
    3636  />
    37  
     37
    3838</OverlayGroup>
    3939
  • code/trunk/data/overlays/stats.oxo

    r5781 r6417  
    66       name      = "Title"
    77       position  = "0.79, 0.19"
    8        pickpoint = "1, 1"       
     8       pickpoint = "1, 1"
    99       font      = "Monofur"
    1010       caption   = "Scoreboard"
     
    1212       textsize  = 0.04
    1313      /-->
    14      
     14
    1515      <OverlayText
    1616       name      = "descr1"
     
    2525       name      = "descr2"
    2626       position  = "0.6, 0.20"
    27        pickpoint = "0, 1"       
     27       pickpoint = "0, 1"
    2828       font      = "Monofur"
    2929       caption   = "score"
     
    3434       name      = "descr3"
    3535       position  = "0.8, 0.20"
    36        pickpoint = "0, 1"       
     36       pickpoint = "0, 1"
    3737       font      = "Monofur"
    3838       caption   = "deaths"
     
    4040       textsize  = 0.04
    4141      />
    42      
     42
    4343      <!--Stats
    4444       name     = "Statistics"
  • code/trunk/doc/CMakeLists.txt

    r2710 r6417  
    1 # Add a "doc" target with CMake build system. 
     1# Add a "doc" target with CMake build system.
    22# And configure doxy.config.in to doxy.config
    33#
  • code/trunk/doc/api/CMakeLists.txt

    r5695 r6417  
    1 # Add a "doc" target with CMake build system. 
     1# Add a "doc" target with CMake build system.
    22# And configure doxy.config.in to doxy.config
    33#
    44# target "doc" allows building the documentation with doxygen/dot on WIN32 and Linux
    5 # Creates .chm windows help file if MS HTML help workshop 
     5# Creates .chm windows help file if MS HTML help workshop
    66# (available from http://msdn.microsoft.com/workshop/author/htmlhelp)
    77# is installed with its DLLs in PATH.
     
    1212# must be in path.
    1313#
    14 # Note about Visual Studio Projects: 
     14# Note about Visual Studio Projects:
    1515# MSVS hast its own path environment which may differ from the shell.
    1616# See "Menu Tools/Options/Projects/VC++ Directories" in VS 7.1
     
    3232  SET(DOXY_INPUT_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
    3333  SET(DOXY_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
    34  
     34
    3535  # we need latex for doxygen because of the formulas
    3636  # Orxonox doesn't
     
    4545  #  MESSAGE(STATUS "dvips command DVIPS_CONVERTER not found but usually required.")
    4646  #ENDIF (NOT DVIPS_CONVERTER)
    47  
     47
    4848  IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in)
    4949    CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in ${CMAKE_CURRENT_BINARY_DIR}/doxy.config @ONLY)
     
    5454    MESSAGE(FATAL_ERROR "Warning: Could not find dox.config.in in the root directory.")
    5555  ENDIF()
    56  
     56
    5757  ADD_CUSTOM_TARGET(doc ${DOXYGEN_EXECUTABLE} ${DOXY_CONFIG})
    58  
     58
    5959  # create a windows help .chm file using hhc.exe
    6060  # HTMLHelp DLL must be in path!
     
    6262  IF(WIN32)
    6363    FIND_PACKAGE(HTMLHelp)
    64     IF(HTML_HELP_COMPILER)     
     64    IF(HTML_HELP_COMPILER)
    6565      SET(TMP ${DOXY_OUTPUT_DIR}/html/index.hhp)
    6666      STRING(REGEX REPLACE "/" "\\\\" HHP_FILE ${TMP})
     
    7070      SET_TARGET_PROPERTIES(doc doc_chm PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD TRUE)
    7171    ENDIF(HTML_HELP_COMPILER)
    72   ENDIF (WIN32) 
     72  ENDIF (WIN32)
    7373
    7474
  • code/trunk/doc/api/main.dox

    • Property svn:eol-style set to native
  • code/trunk/src/Orxonox.cc

    r5929 r6417  
    6262        std::string strCmdLine;
    6363        for (int i = 1; i < argc; ++i)
    64             strCmdLine += argv[i] + std::string(" ");
     64            strCmdLine = strCmdLine + argv[i] + ' ';
    6565#endif
    6666
  • code/trunk/src/external/ceguilua/CMakeLists.txt

    r5929 r6417  
    4545      BREAK() # _version > CEGUI_VERSION
    4646    ENDIF()
    47  
     47
    4848    ADD_SUBDIRECTORY(ceguilua-${_version}) # Sets parent scope variable _package_files
    4949    FOREACH(_file ${_package_files})
  • code/trunk/src/external/ceguilua/ceguilua-0.5.0/CMakeLists.txt

    r5781 r6417  
    2020  elements/TabButton.pkg elements/TabControl.pkg elements/Thumb.pkg
    2121  elements/Titlebar.pkg elements/Tooltip.pkg
    22  
     22
    2323  falagard/Dimension.pkg falagard/Enums.pkg falagard/FalagardComponentBase.pkg
    2424  falagard/FrameComponent.pkg falagard/ImageryComponent.pkg
  • code/trunk/src/libraries/core/ArgumentCompletionFunctions.cc

    r5929 r6417  
    7272                else
    7373                {
    74                     std::string dir = startdirectory.string();
     74                    const std::string& dir = startdirectory.string();
    7575                    if (dir.size() > 0 && dir[dir.size() - 1] == ':')
    7676                        startdirectory = dir + '/';
     
    8484                {
    8585                    if (boost::filesystem::is_directory(*file))
    86                         dirlist.push_back(ArgumentCompletionListElement((*file).string() + '/', getLowercase((*file).string()) + '/', (*file).BOOST_LEAF_FUNCTION() + '/'));
     86                        dirlist.push_back(ArgumentCompletionListElement(file->string() + '/', getLowercase(file->string()) + '/', file->BOOST_LEAF_FUNCTION() + '/'));
    8787                    else
    88                         filelist.push_back(ArgumentCompletionListElement((*file).string(), getLowercase((*file).string()), (*file).BOOST_LEAF_FUNCTION()));
     88                        filelist.push_back(ArgumentCompletionListElement(file->string(), getLowercase(file->string()), file->BOOST_LEAF_FUNCTION()));
    8989                    ++file;
    9090                }
     
    101101
    102102            for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMapBegin(); it != Identifier::getStringIdentifierMapEnd(); ++it)
    103                 if ((*it).second->hasConfigValues())
    104                     classlist.push_back(ArgumentCompletionListElement((*it).second->getName(), getLowercase((*it).first)));
     103                if (it->second->hasConfigValues())
     104                    classlist.push_back(ArgumentCompletionListElement(it->first, getLowercase(it->first)));
    105105
    106106            return classlist;
     
    110110        {
    111111            ArgumentCompletionList configvalues;
    112             std::map<std::string, Identifier*>::const_iterator identifier = Identifier::getStringIdentifierMap().find(classname);
     112            std::map<std::string, Identifier*>::const_iterator identifier = Identifier::getLowercaseStringIdentifierMap().find(getLowercase(classname));
    113113
    114             if (identifier != Identifier::getStringIdentifierMapEnd() && (*identifier).second->hasConfigValues())
     114            if (identifier != Identifier::getLowercaseStringIdentifierMapEnd() && identifier->second->hasConfigValues())
    115115            {
    116                 for (std::map<std::string, ConfigValueContainer*>::const_iterator it = (*identifier).second->getConfigValueMapBegin(); it != (*identifier).second->getConfigValueMapEnd(); ++it)
    117                     configvalues.push_back(ArgumentCompletionListElement((*it).second->getName(), getLowercase((*it).first)));
     116                for (std::map<std::string, ConfigValueContainer*>::const_iterator it = identifier->second->getConfigValueMapBegin(); it != identifier->second->getConfigValueMapEnd(); ++it)
     117                    configvalues.push_back(ArgumentCompletionListElement(it->first, getLowercase(it->first)));
    118118            }
    119119
     
    127127            if (identifier != Identifier::getLowercaseStringIdentifierMapEnd())
    128128            {
    129                 std::map<std::string, ConfigValueContainer*>::const_iterator variable = (*identifier).second->getLowercaseConfigValueMap().find(getLowercase(varname));
    130                 if (variable != (*identifier).second->getLowercaseConfigValueMapEnd())
     129                std::map<std::string, ConfigValueContainer*>::const_iterator variable = identifier->second->getLowercaseConfigValueMap().find(getLowercase(varname));
     130                if (variable != identifier->second->getLowercaseConfigValueMapEnd())
    131131                {
    132                     std::string valuestring = (*variable).second->toString();
     132                    const std::string& valuestring = variable->second->toString();
    133133                    oldvalue.push_back(ArgumentCompletionListElement(valuestring, getLowercase(valuestring), "Old value: " + valuestring));
    134134                }
  • code/trunk/src/libraries/core/BaseObject.cc

    r5929 r6417  
    3636#include <tinyxml/tinyxml.h>
    3737
    38 #include "util/StringUtils.h"
    3938#include "CoreIncludes.h"
    4039#include "Event.h"
     
    119118        XMLPortObjectTemplate(BaseObject, Template, "templates", addTemplate, getTemplate, xmlelement, mode, Template*);
    120119        XMLPortObject(BaseObject, BaseObject, "eventlisteners", addEventListener, getEventListener, xmlelement, mode);
    121        
     120
    122121        Element* events = 0;
    123122        if (mode == XMLPort::LoadObject || mode == XMLPort::ExpandObject)
     
    139138        XMLPortEventState(BaseObject, BaseObject, "visibility", setVisible, xmlelement, mode);
    140139        XMLPortEventState(BaseObject, BaseObject, "mainstate", setMainState, xmlelement, mode);
    141        
     140
    142141        this->bRegisteredEventStates_ = true;
    143142    }
     
    236235            if (it->second != state)
    237236                continue;
    238            
     237
    239238            if (i == index)
    240239                return it->first;
     
    252251        listener->addEventSource(this, "mainstate");
    253252    }
    254    
     253
    255254    /**
    256255        @brief Returns an event listener with a given index.
     
    278277        if (it != this->eventStates_.end())
    279278        {
    280             COUT(2) << "Warning: Overwriting EventState in class " << this->getIdentifier()->getName() << "." << std::endl;
     279            COUT(2) << "Warning: Overwriting EventState in class " << this->getIdentifier()->getName() << '.' << std::endl;
    281280            delete (it->second);
    282281        }
     
    292291        std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(name);
    293292        if (it != this->eventStates_.end())
    294             return ((*it).second);
     293            return (it->second);
    295294        else
    296295            return 0;
     
    344343    {
    345344        this->registerEventStates();
    346        
     345
    347346        std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(event.statename_);
    348347        if (it != this->eventStates_.end())
    349348            it->second->process(event, this);
    350         else if (event.statename_ != "")
     349        else if (!event.statename_.empty())
    351350            COUT(2) << "Warning: \"" << event.statename_ << "\" is not a valid state in object \"" << this->getName() << "\" of class " << this->getIdentifier()->getName() << "." << std::endl;
    352351        else
     
    356355    /**
    357356        @brief Sets the main state of the object to a given boolean value.
    358        
     357
    359358        Note: The main state of an object can be set with the @ref setMainStateName function.
    360359        It's part of the eventsystem and used for event forwarding (when the target object can't specify a specific state,
     
    386385        this->mainStateFunctor_ = 0;
    387386
    388         if (this->mainStateName_ != "")
     387        if (!this->mainStateName_.empty())
    389388        {
    390389            this->registerEventStates();
    391            
     390
    392391            std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(this->mainStateName_);
    393392            if (it != this->eventStates_.end() && it->second->getFunctor())
     
    402401        }
    403402    }
    404    
     403
    405404    /**
    406405        @brief Calls XMLEventPort with an empty XML-element to register the event states if necessary.
     
    414413        }
    415414    }
    416    
     415
    417416    /**
    418417        @brief Manually loads all event states, even if the class doesn't officially support them. This is needed by some classes like @ref EventDispatcher or @ref EventTarget.
     
    437436            for (std::list<std::string>::iterator it = eventnames.begin(); it != eventnames.end(); ++it)
    438437            {
    439                 std::string statename = (*it);
     438                const std::string& statename = (*it);
    440439
    441440                // if the event state is already known, continue with the next state
     
    447446                if (!container)
    448447                {
    449                     ExecutorMember<BaseObject>* setfunctor = createExecutor(createFunctor(&BaseObject::addEventSource), std::string( "BaseObject" ) + "::" + "addEventSource" + "(" + statename + ")");
    450                     ExecutorMember<BaseObject>* getfunctor = createExecutor(createFunctor(&BaseObject::getEventSource), std::string( "BaseObject" ) + "::" + "getEventSource" + "(" + statename + ")");
     448                    ExecutorMember<BaseObject>* setfunctor = createExecutor(createFunctor(&BaseObject::addEventSource), std::string( "BaseObject" ) + "::" + "addEventSource" + '(' + statename + ')');
     449                    ExecutorMember<BaseObject>* getfunctor = createExecutor(createFunctor(&BaseObject::getEventSource), std::string( "BaseObject" ) + "::" + "getEventSource" + '(' + statename + ')');
    451450                    setfunctor->setDefaultValue(1, statename);
    452451                    getfunctor->setDefaultValue(1, statename);
  • code/trunk/src/libraries/core/BaseObject.h

    r5929 r6417  
    157157            void removeEventSource(BaseObject* source);
    158158            BaseObject* getEventSource(unsigned int index, const std::string& state) const;
    159            
     159
    160160            void addEventListener(BaseObject* listener);
    161161            BaseObject* getEventListener(unsigned int index) const;
     
    172172            /** @brief Returns the indentation of the debug output in the Loader. @return The indentation */
    173173            inline const std::string& getLoaderIndentation() const { return this->loaderIndentation_; }
    174            
     174
    175175            static void loadAllEventStates(Element& xmlelement, XMLPort::Mode mode, BaseObject* object, Identifier* identifier);
    176176
     
    210210            Gametype*              oldGametype_;
    211211            std::set<Template*>    templates_;
    212            
     212
    213213            std::map<BaseObject*, std::string>  eventSources_;           //!< List of objects which send events to this object, mapped to the state which they affect
    214214            std::set<BaseObject*>               eventListeners_;         //!< List of objects which listen to the events of this object
  • code/trunk/src/libraries/core/CMakeLists.txt

    r6105 r6417  
    8686  TOLUA_FILES
    8787    CommandExecutor.h
     88    ConfigFileManager.h
     89    Game.h
     90    GameMode.h
     91    GUIManager.h
    8892    Loader.h
    8993    LuaState.h
     94    PathConfig.h
     95    input/InputManager.h
     96    input/KeyBinder.h
     97    input/KeyBinderManager.h
    9098  DEFINE_SYMBOL
    9199    "CORE_SHARED_BUILD"
  • code/trunk/src/libraries/core/ClassTreeMask.cc

    r5929 r6417  
    291291    void ClassTreeMask::add(const Identifier* subclass, bool bInclude, bool overwrite, bool clean)
    292292    {
     293        if (!subclass)
     294            return;
    293295        // Check if the given subclass is a child of our root-class
    294296        if (subclass->isA(this->root_->getClass()))
     
    320322    void ClassTreeMask::add(ClassTreeMaskNode* node, const Identifier* subclass, bool bInclude, bool overwrite)
    321323    {
     324        if (!subclass)
     325            return;
    322326        // Check if the current node contains exactly the subclass we want to add
    323327        if (subclass == node->getClass())
     
    395399    void ClassTreeMask::addSingle(const Identifier* subclass, bool bInclude, bool clean)
    396400    {
     401        if (!subclass)
     402            return;
    397403        for (std::set<const Identifier*>::const_iterator it = subclass->getDirectChildrenBegin(); it != subclass->getDirectChildrenEnd(); ++it)
    398404            this->add(*it, this->isIncluded(*it), false, false);
     
    428434    bool ClassTreeMask::isIncluded(ClassTreeMaskNode* node, const Identifier* subclass) const
    429435    {
     436        if (!subclass)
     437            return false;
    430438        // Check if the searched subclass is of the same type as the class in the current node or a derivative
    431439        if (subclass->isA(node->getClass()))
     
    816824            // Calculate the prefix: + means included, - means excluded
    817825            if (it->isIncluded())
    818                 out << "+";
     826                out << '+';
    819827            else
    820                 out << "-";
     828                out << '-';
    821829
    822830            // Put the name of the corresponding class on the stream
    823             out << it->getClass()->getName() << " ";
     831            out << it->getClass()->getName() << ' ';
    824832        }
    825833
     
    850858        // If there is a first subclass, move the object-iterator to the first object of this class. Else go to the end
    851859        if (this->subclassIterator_ != this->subclasses_.end())
    852             this->objectIterator_ = (*this->subclassIterator_).first->getObjects()->begin();
     860            this->objectIterator_ = this->subclassIterator_->first->getObjects()->begin();
    853861        else
    854862            this->objectIterator_ = ObjectList<BaseObject>::end();
    855863
    856864        // Check if the iterator points on a valid object. If not, go to the next object by calling ++
    857         if (!this->objectIterator_ || ((*this->subclassIterator_).second && !this->objectIterator_->isExactlyA((*this->subclassIterator_).first)))
     865        if (!this->objectIterator_ || (this->subclassIterator_->second && !this->objectIterator_->isExactlyA(this->subclassIterator_->first)))
    858866            this->operator++();
    859867
     
    882890                    // Check if there really is a next class. If yes, move the object-iterator to the first object
    883891                    if (this->subclassIterator_ != this->subclasses_.end())
    884                         this->objectIterator_ = (*this->subclassIterator_).first->getObjects()->begin();
     892                        this->objectIterator_ = this->subclassIterator_->first->getObjects()->begin();
    885893                    else
    886894                        return (*this);
     
    888896
    889897            // Repeat this until we reach a valid object or the end
    890             } while ((*this->subclassIterator_).second && !this->objectIterator_->isExactlyA((*this->subclassIterator_).first));
     898            } while (this->subclassIterator_->second && !this->objectIterator_->isExactlyA(this->subclassIterator_->first));
    891899        }
    892900        return (*this);
  • code/trunk/src/libraries/core/CommandEvaluation.cc

    r5781 r6417  
    5050        this->commandTokens_.split(command, " ", SubString::WhiteSpaces, false, '\\', false, '"', false, '(', ')', false, '\0');
    5151
    52         this->additionalParameter_ = "";
     52        this->additionalParameter_.clear();
    5353
    5454        this->bEvaluatedParams_ = false;
     
    6060        this->functionclass_ = 0;
    6161        this->function_ = 0;
    62         this->possibleArgument_ = "";
    63         this->argument_ = "";
    64 
    65         this->errorMessage_ = "";
     62        this->possibleArgument_.clear();
     63        this->argument_.clear();
     64
     65        this->errorMessage_.clear();
    6666        this->state_ = CommandState::Empty;
    6767    }
     
    7979        if (this->bEvaluatedParams_ && this->function_)
    8080        {
    81             COUT(6) << "CE_execute (evaluation): " << this->function_->getName() << " " << this->param_[0] << " " << this->param_[1] << " " << this->param_[2] << " " << this->param_[3] << " " << this->param_[4] << std::endl;
     81            COUT(6) << "CE_execute (evaluation): " << this->function_->getName() << ' ' << this->param_[0] << ' ' << this->param_[1] << ' ' << this->param_[2] << ' ' << this->param_[3] << ' ' << this->param_[4] << std::endl;
    8282            (*this->function_)(this->param_[0], this->param_[1], this->param_[2], this->param_[3], this->param_[4]);
    8383            return true;
     
    9898    }
    9999
    100     std::string CommandEvaluation::complete()
     100    const std::string& CommandEvaluation::complete()
    101101    {
    102102        if (!this->bNewCommand_)
     
    114114                            return (this->command_ = this->function_->getName());
    115115                        else
    116                             return (this->command_ = this->function_->getName() + " ");
     116                            return (this->command_ = this->function_->getName() + ' ');
    117117                    }
    118118                    else if (this->functionclass_)
    119                         return (this->command_ = this->functionclass_->getName() + " ");
     119                        return (this->command_ = this->functionclass_->getName() + ' ');
    120120                    break;
    121121                case CommandState::Function:
     
    123123                    {
    124124                        if (this->function_->getParamCount() == 0)
    125                             return (this->command_ = this->functionclass_->getName() + " " + this->function_->getName());
     125                            return (this->command_ = this->functionclass_->getName() + ' ' + this->function_->getName());
    126126                        else
    127                             return (this->command_ = this->functionclass_->getName() + " " + this->function_->getName() + " ");
     127                            return (this->command_ = this->functionclass_->getName() + ' ' + this->function_->getName() + ' ');
    128128                    }
    129129                    break;
     
    131131                case CommandState::Params:
    132132                {
    133                     if (this->argument_ == "" && this->possibleArgument_ == "")
     133                    if (this->argument_.empty() && this->possibleArgument_.empty())
    134134                        break;
    135135
     
    137137                    if (this->command_[this->command_.size() - 1] != ' ')
    138138                        maxIndex -= 1;
    139                     std::string whitespace = "";
    140 
    141                     if (this->possibleArgument_ != "")
     139                    std::string whitespace;
     140
     141                    if (!this->possibleArgument_.empty())
    142142                    {
    143143                        this->argument_ = this->possibleArgument_;
     
    146146                    }
    147147
    148                     return (this->command_ = this->commandTokens_.subSet(0, maxIndex).join() + " " + this->argument_ + whitespace);
     148                    return (this->command_ = this->commandTokens_.subSet(0, maxIndex).join() + ' ' + this->argument_ + whitespace);
    149149                    break;
    150150                }
     
    262262    std::string CommandEvaluation::dump(const std::list<std::pair<const std::string*, const std::string*> >& list)
    263263    {
    264         std::string output = "";
     264        std::string output;
    265265        for (std::list<std::pair<const std::string*, const std::string*> >::const_iterator it = list.begin(); it != list.end(); ++it)
    266266        {
    267267            if (it != list.begin())
    268                 output += " ";
    269 
    270             output += *(*it).second;
     268                output += ' ';
     269
     270            output += *(it->second);
    271271        }
    272272        return output;
     
    275275    std::string CommandEvaluation::dump(const ArgumentCompletionList& list)
    276276    {
    277         std::string output = "";
     277        std::string output;
    278278        for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
    279279        {
    280280            if (it != list.begin())
    281                 output += " ";
    282 
    283             output += (*it).getDisplay();
     281                output += ' ';
     282
     283            output += it->getDisplay();
    284284        }
    285285        return output;
     
    295295        {
    296296            if (i != 0)
    297                 output += " ";
     297                output += ' ';
    298298
    299299            if (command->defaultValueSet(i))
    300                 output += "[";
     300                output += '[';
    301301            else
    302                 output += "{";
     302                output += '{';
    303303
    304304            output += command->getTypenameParam(i);
    305305
    306306            if (command->defaultValueSet(i))
    307                 output += "=" + command->getDefaultValue(i).getString() + "]";
     307                output += '=' + command->getDefaultValue(i).getString() + ']';
    308308            else
    309                 output += "}";
     309                output += '}';
    310310        }
    311311        return output;
  • code/trunk/src/libraries/core/CommandEvaluation.h

    r5781 r6417  
    6666
    6767            bool execute() const;
    68             std::string complete();
     68            const std::string& complete();
    6969            std::string hint() const;
    7070            void evaluateParams();
     
    8282                { this->additionalParameter_ = param; this->bEvaluatedParams_ = false; }
    8383            inline std::string getAdditionalParameter() const
    84                 { return (this->additionalParameter_ != "") ? (" " + this->additionalParameter_) : ""; }
     84                { return (!this->additionalParameter_.empty()) ? (' ' + this->additionalParameter_) : ""; }
    8585
    8686            void setEvaluatedParameter(unsigned int index, MultiType param);
  • code/trunk/src/libraries/core/CommandExecutor.cc

    r5929 r6417  
    5959        if (it != CommandExecutor::getInstance().consoleCommandShortcuts_.end())
    6060        {
    61             COUT(2) << "Warning: Overwriting console-command shortcut with name " << command->getName() << "." << std::endl;
     61            COUT(2) << "Warning: Overwriting console-command shortcut with name " << command->getName() << '.' << std::endl;
    6262        }
    6363
     
    8282        std::map<std::string, ConsoleCommand*>::const_iterator it = CommandExecutor::getInstance().consoleCommandShortcuts_.find(name);
    8383        if (it != CommandExecutor::getInstance().consoleCommandShortcuts_.end())
    84             return (*it).second;
     84            return it->second;
    8585        else
    8686            return 0;
     
    9696        std::map<std::string, ConsoleCommand*>::const_iterator it = CommandExecutor::getInstance().consoleCommandShortcuts_LC_.find(name);
    9797        if (it != CommandExecutor::getInstance().consoleCommandShortcuts_LC_.end())
    98             return (*it).second;
     98            return it->second;
    9999        else
    100100            return 0;
     
    215215                        CommandExecutor::getEvaluation().state_ = CommandState::Error;
    216216                        AddLanguageEntry("commandexecutorunknownfirstargument", "is not a shortcut nor a classname");
    217                         CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getArgument(0) + " " + GetLocalisation("commandexecutorunknownfirstargument") + ".";
     217                        CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getArgument(0) + ' ' + GetLocalisation("commandexecutorunknownfirstargument") + '.';
    218218                        return;
    219219                    }
     
    231231                    {
    232232                        // It's a shortcut
    233                         std::string functionname = *(*CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()).first;
     233                        const std::string& functionname = *CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()->first;
    234234                        CommandExecutor::getEvaluation().function_ = CommandExecutor::getPossibleCommand(functionname);
    235235                        if (getLowercase(functionname) != getLowercase(CommandExecutor::getArgument(0)))
     
    243243                        if (CommandExecutor::getEvaluation().function_->getParamCount() > 0)
    244244                        {
    245                             CommandExecutor::getEvaluation().command_ += " ";
     245                            CommandExecutor::getEvaluation().command_ += ' ';
    246246                            CommandExecutor::getEvaluation().bCommandChanged_ = true;
    247247                        }
     
    251251                    {
    252252                        // It's a classname
    253                         std::string classname = *(*CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.begin()).first;
     253                        const std::string& classname = *CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.begin()->first;
    254254                        CommandExecutor::getEvaluation().functionclass_ = CommandExecutor::getPossibleIdentifier(classname);
    255255                        if (getLowercase(classname) != getLowercase(CommandExecutor::getArgument(0)))
     
    260260                        CommandExecutor::getEvaluation().state_ = CommandState::Function;
    261261                        CommandExecutor::getEvaluation().function_ = 0;
    262                         CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + " ";
     262                        CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + ' ';
    263263                        // Move on to next case
    264264                    }
     
    268268                        CommandExecutor::getEvaluation().state_ = CommandState::Error;
    269269                        AddLanguageEntry("commandexecutorunknownfirstargumentstart", "There is no command or classname starting with");
    270                         CommandExecutor::getEvaluation().errorMessage_ = "Error: " + GetLocalisation("commandexecutorunknownfirstargumentstart") + " " + CommandExecutor::getArgument(0) + ".";
     270                        CommandExecutor::getEvaluation().errorMessage_ = "Error: " + GetLocalisation("commandexecutorunknownfirstargumentstart") + ' ' + CommandExecutor::getArgument(0) + '.';
    271271                        return;
    272272                    }
     
    319319                        {
    320320                            // It's a function
    321                             std::string functionname = *(*CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()).first;
     321                            const std::string& functionname = *CommandExecutor::getEvaluation().listOfPossibleFunctions_.begin()->first;
    322322                            CommandExecutor::getEvaluation().function_ = CommandExecutor::getPossibleCommand(functionname, CommandExecutor::getEvaluation().functionclass_);
    323323                            if (getLowercase(functionname) != getLowercase(CommandExecutor::getArgument(1)))
     
    327327                            }
    328328                            CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
    329                             CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + " " + CommandExecutor::getEvaluation().function_->getName();
     329                            CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + ' ' + CommandExecutor::getEvaluation().function_->getName();
    330330                            if (CommandExecutor::getEvaluation().function_->getParamCount() > 0)
    331331                            {
    332                                 CommandExecutor::getEvaluation().command_ += " ";
     332                                CommandExecutor::getEvaluation().command_ += ' ';
    333333                                CommandExecutor::getEvaluation().bCommandChanged_ = true;
    334334                            }
     
    340340                            CommandExecutor::getEvaluation().state_ = CommandState::Error;
    341341                            AddLanguageEntry("commandexecutorunknownsecondargumentstart", "has no function starting with");
    342                             CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getEvaluation().functionclass_->getName() + " " + GetLocalisation("commandexecutorunknownsecondargumentstart") + " " + CommandExecutor::getArgument(1) + ".";
     342                            CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getEvaluation().functionclass_->getName() + ' ' + GetLocalisation("commandexecutorunknownsecondargumentstart") + ' ' + CommandExecutor::getArgument(1) + '.';
    343343                            return;
    344344                        }
     
    346346                        {
    347347                            // There are several possibilities
    348                             CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + " " + CommandExecutor::getCommonBegin(CommandExecutor::getEvaluation().listOfPossibleFunctions_);
     348                            CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + ' ' + CommandExecutor::getCommonBegin(CommandExecutor::getEvaluation().listOfPossibleFunctions_);
    349349                            CommandExecutor::getEvaluation().function_ = CommandExecutor::getPossibleCommand(CommandExecutor::getArgument(1), CommandExecutor::getEvaluation().functionclass_);
    350350                            CommandExecutor::getEvaluation().bCommandChanged_ = true;
     
    386386                {
    387387                    // There is exactly one possible argument
    388                     CommandExecutor::getEvaluation().argument_ = (*CommandExecutor::getEvaluation().listOfPossibleArguments_.begin()).getString();
    389                     CommandExecutor::getEvaluation().possibleArgument_ = (*CommandExecutor::getEvaluation().listOfPossibleArguments_.begin()).getString();
     388                    CommandExecutor::getEvaluation().argument_ = CommandExecutor::getEvaluation().listOfPossibleArguments_.begin()->getString();
     389                    CommandExecutor::getEvaluation().possibleArgument_ = CommandExecutor::getEvaluation().listOfPossibleArguments_.begin()->getString();
    390390                    CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
    391391                    return;
     
    451451    }
    452452
    453     std::string CommandExecutor::getArgument(unsigned int index)
     453    const std::string& CommandExecutor::getArgument(unsigned int index)
    454454    {
    455455        if (index < (CommandExecutor::getEvaluation().commandTokens_.size()))
    456456            return CommandExecutor::getEvaluation().commandTokens_[index];
    457457        else
    458             return "";
    459     }
    460 
    461     std::string CommandExecutor::getLastArgument()
     458            return BLANKSTRING;
     459    }
     460
     461    const std::string& CommandExecutor::getLastArgument()
    462462    {
    463463        return CommandExecutor::getArgument(CommandExecutor::argumentsGiven() - 1);
     
    467467    {
    468468        CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.clear();
    469         std::string lowercase = getLowercase(fragment);
     469        const std::string& lowercase = getLowercase(fragment);
    470470        for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseStringIdentifierMapBegin(); it != Identifier::getLowercaseStringIdentifierMapEnd(); ++it)
    471             if ((*it).second->hasConsoleCommands())
    472                 if ((*it).first.find(lowercase) == 0 || fragment == "")
    473                     CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));
     471            if (it->second->hasConsoleCommands())
     472                if (it->first.find(lowercase) == 0 || fragment.empty())
     473                    CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.push_back(std::pair<const std::string*, const std::string*>(&it->first, &it->second->getName()));
    474474    }
    475475
     
    477477    {
    478478        CommandExecutor::getEvaluation().listOfPossibleFunctions_.clear();
    479         std::string lowercase = getLowercase(fragment);
     479        const std::string& lowercase = getLowercase(fragment);
    480480        if (!identifier)
    481481        {
    482482            for (std::map<std::string, ConsoleCommand*>::const_iterator it = CommandExecutor::getLowercaseConsoleCommandShortcutMapBegin(); it != CommandExecutor::getLowercaseConsoleCommandShortcutMapEnd(); ++it)
    483                 if ((*it).first.find(lowercase) == 0 || fragment == "")
    484                     CommandExecutor::getEvaluation().listOfPossibleFunctions_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));
     483                if (it->first.find(lowercase) == 0 || fragment.empty())
     484                    CommandExecutor::getEvaluation().listOfPossibleFunctions_.push_back(std::pair<const std::string*, const std::string*>(&it->first, &it->second->getName()));
    485485        }
    486486        else
    487487        {
    488488            for (std::map<std::string, ConsoleCommand*>::const_iterator it = identifier->getLowercaseConsoleCommandMapBegin(); it != identifier->getLowercaseConsoleCommandMapEnd(); ++it)
    489                 if ((*it).first.find(lowercase) == 0 || fragment == "")
    490                     CommandExecutor::getEvaluation().listOfPossibleFunctions_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second->getName()));
     489                if (it->first.find(lowercase) == 0 || fragment.empty())
     490                    CommandExecutor::getEvaluation().listOfPossibleFunctions_.push_back(std::pair<const std::string*, const std::string*>(&it->first, &it->second->getName()));
    491491        }
    492492    }
     
    497497
    498498        CommandExecutor::getEvaluation().listOfPossibleArguments_.clear();
    499         std::string lowercase = getLowercase(fragment);
     499        const std::string& lowercase = getLowercase(fragment);
    500500        for (ArgumentCompletionList::const_iterator it = command->getArgumentCompletionListBegin(); it != command->getArgumentCompletionListEnd(); ++it)
    501501        {
    502             if ((*it).lowercaseComparison())
    503             {
    504                 if ((*it).getComparable().find(lowercase) == 0 || fragment == "")
     502            if (it->lowercaseComparison())
     503            {
     504                if (it->getComparable().find(lowercase) == 0 || fragment.empty())
    505505                    CommandExecutor::getEvaluation().listOfPossibleArguments_.push_back(*it);
    506506            }
    507507            else
    508508            {
    509                 if ((*it).getComparable().find(fragment) == 0 || fragment == "")
     509                if (it->getComparable().find(fragment) == 0 || fragment.empty())
    510510                    CommandExecutor::getEvaluation().listOfPossibleArguments_.push_back(*it);
    511511            }
     
    515515    Identifier* CommandExecutor::getPossibleIdentifier(const std::string& name)
    516516    {
    517         std::string lowercase = getLowercase(name);
     517        const std::string& lowercase = getLowercase(name);
    518518        std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseStringIdentifierMap().find(lowercase);
    519         if ((it != Identifier::getLowercaseStringIdentifierMapEnd()) && (*it).second->hasConsoleCommands())
    520             return (*it).second;
     519        if ((it != Identifier::getLowercaseStringIdentifierMapEnd()) && it->second->hasConsoleCommands())
     520            return it->second;
    521521
    522522        return 0;
     
    525525    ConsoleCommand* CommandExecutor::getPossibleCommand(const std::string& name, Identifier* identifier)
    526526    {
    527         std::string lowercase = getLowercase(name);
     527        const std::string& lowercase = getLowercase(name);
    528528        if (!identifier)
    529529        {
    530530            std::map<std::string, ConsoleCommand*>::const_iterator it = CommandExecutor::getLowercaseConsoleCommandShortcutMap().find(lowercase);
    531531            if (it != CommandExecutor::getLowercaseConsoleCommandShortcutMapEnd())
    532                 return (*it).second;
     532                return it->second;
    533533        }
    534534        else
     
    536536            std::map<std::string, ConsoleCommand*>::const_iterator it = identifier->getLowercaseConsoleCommandMap().find(lowercase);
    537537            if (it != identifier->getLowercaseConsoleCommandMapEnd())
    538                 return (*it).second;
     538                return it->second;
    539539        }
    540540        return 0;
    541541    }
    542542
    543     std::string CommandExecutor::getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param)
     543    const std::string& CommandExecutor::getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param)
    544544    {
    545545        CommandExecutor::createArgumentCompletionList(command, param);
    546546
    547         std::string lowercase = getLowercase(name);
     547        const std::string& lowercase = getLowercase(name);
    548548        for (ArgumentCompletionList::const_iterator it = command->getArgumentCompletionListBegin(); it != command->getArgumentCompletionListEnd(); ++it)
    549549        {
    550             if ((*it).lowercaseComparison())
    551             {
    552                 if ((*it).getComparable() == lowercase)
    553                     return (*it).getString();
     550            if (it->lowercaseComparison())
     551            {
     552                if (it->getComparable() == lowercase)
     553                    return it->getString();
    554554            }
    555555            else
    556556            {
    557                 if ((*it).getComparable() == name)
    558                     return (*it).getString();
    559             }
    560         }
    561 
    562         return "";
     557                if (it->getComparable() == name)
     558                    return it->getString();
     559            }
     560        }
     561
     562        return BLANKSTRING;
    563563    }
    564564
     
    589589        else if (list.size() == 1)
    590590        {
    591             return ((*(*list.begin()).first) + " ");
    592         }
    593         else
    594         {
    595             std::string output = "";
     591            return ((*list.begin()->first) + ' ');
     592        }
     593        else
     594        {
     595            std::string output;
    596596            for (unsigned int i = 0; true; i++)
    597597            {
     
    599599                for (std::list<std::pair<const std::string*, const std::string*> >::const_iterator it = list.begin(); it != list.end(); ++it)
    600600                {
    601                     if ((*(*it).first).size() > i)
     601                    if (it->first->size() > i)
    602602                    {
    603603                        if (it == list.begin())
    604604                        {
    605                             temp = (*(*it).first)[i];
     605                            temp = (*it->first)[i];
    606606                        }
    607607                        else
    608608                        {
    609                             if (temp != (*(*it).first)[i])
     609                            if (temp != (*it->first)[i])
    610610                                return output;
    611611                        }
     
    630630        else if (list.size() == 1)
    631631        {
    632             return ((*list.begin()).getComparable() + " ");
    633         }
    634         else
    635         {
    636             std::string output = "";
     632            return (list.begin()->getComparable() + ' ');
     633        }
     634        else
     635        {
     636            std::string output;
    637637            for (unsigned int i = 0; true; i++)
    638638            {
     639                char tempComparable = 0;
    639640                char temp = 0;
    640641                for (ArgumentCompletionList::const_iterator it = list.begin(); it != list.end(); ++it)
    641642                {
    642                     std::string argument = (*it).getComparable();
     643                    const std::string& argumentComparable = it->getComparable();
     644                    const std::string& argument = it->getString();
    643645                    if (argument.size() > i)
    644646                    {
    645647                        if (it == list.begin())
    646648                        {
     649                            tempComparable = argumentComparable[i];
    647650                            temp = argument[i];
    648651                        }
    649652                        else
    650653                        {
    651                             if (temp != argument[i])
     654                            if (tempComparable != argumentComparable[i])
    652655                                return output;
     656                            else if (temp != argument[i])
     657                                temp = tempComparable;
    653658                        }
    654659                    }
  • code/trunk/src/libraries/core/CommandExecutor.h

    r5781 r6417  
    9090            static unsigned int argumentsGiven();
    9191            static bool enoughArgumentsGiven(ConsoleCommand* command);
    92             static std::string getArgument(unsigned int index);
    93             static std::string getLastArgument();
     92            static const std::string& getArgument(unsigned int index);
     93            static const std::string& getLastArgument();
    9494
    9595            static void createListOfPossibleIdentifiers(const std::string& fragment);
     
    9999            static Identifier* getPossibleIdentifier(const std::string& name);
    100100            static ConsoleCommand* getPossibleCommand(const std::string& name, Identifier* identifier = 0);
    101             static std::string getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param);
     101            static const std::string& getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param);
    102102
    103103            static void createArgumentCompletionList(ConsoleCommand* command, unsigned int param);
  • code/trunk/src/libraries/core/CommandLineParser.cc

    r6021 r6417  
    6363                this->value_ = temp;
    6464            }
    65             else if (value == "")
     65            else if (value.empty())
    6666            {
    6767                this->bHasDefaultValue_ = false;
     
    140140                    OrxAssert(cmdLineArgsShortcut_.find(it->second->getShortcut()) == cmdLineArgsShortcut_.end(),
    141141                        "Cannot have two command line shortcut with the same name.");
    142                     if (it->second->getShortcut() != "")
     142                    if (!it->second->getShortcut().empty())
    143143                        cmdLineArgsShortcut_[it->second->getShortcut()] = it->second;
    144144                }
     
    165165                        {
    166166                            // negative number as a value
    167                             value += arguments[i] + " ";
     167                            value += arguments[i] + ' ';
    168168                        }
    169169                        else
     
    173173                            // save old data first
    174174                            value = removeTrailingWhitespaces(value);
    175                             if (name != "")
     175                            if (!name.empty())
    176176                            {
    177177                                checkFullArgument(name, value, bParsingFile);
    178                                 name = "";
    179                                 assert(shortcut == "");
     178                                name.clear();
     179                                assert(shortcut.empty());
    180180                            }
    181                             else if (shortcut != "")
     181                            else if (!shortcut.empty())
    182182                            {
    183183                                checkShortcut(shortcut, value, bParsingFile);
    184                                 shortcut = "";
    185                                 assert(name == "");
     184                                shortcut.clear();
     185                                assert(name.empty());
    186186                            }
    187187
     
    198198
    199199                            // reset value string
    200                             value = "";
     200                            value.clear();
    201201                        }
    202202                    }
     
    205205                        // value string
    206206
    207                         if (name == "" && shortcut == "")
     207                        if (name.empty() && shortcut.empty())
    208208                        {
    209209                            ThrowException(Argument, "Expected \"-\" or \"-\" in command line arguments.\n");
     
    218218            // parse last argument
    219219            value = removeTrailingWhitespaces(value);
    220             if (name != "")
     220            if (!name.empty())
    221221            {
    222222                checkFullArgument(name, value, bParsingFile);
    223                 assert(shortcut == "");
    224             }
    225             else if (shortcut != "")
     223                assert(shortcut.empty());
     224            }
     225            else if (!shortcut.empty())
    226226            {
    227227                checkShortcut(shortcut, value, bParsingFile);
    228                 assert(name == "");
     228                assert(name.empty());
    229229            }
    230230        }
     
    291291            it != inst.cmdLineArgs_.end(); ++it)
    292292        {
    293             if (it->second->getShortcut() != "")
     293            if (!it->second->getShortcut().empty())
    294294                infoStr << " [-" << it->second->getShortcut() << "] ";
    295295            else
    296296                infoStr << "      ";
    297             infoStr << "--" << it->second->getName() << " ";
     297            infoStr << "--" << it->second->getName() << ' ';
    298298            if (it->second->getValue().getType() != MT_Type::Bool)
    299299                infoStr << "ARG ";
     
    347347    void CommandLineParser::_parseFile()
    348348    {
    349         std::string filename = CommandLineParser::getValue("optionsFile").getString();
     349        const std::string& filename = CommandLineParser::getValue("optionsFile").getString();
    350350
    351351        // look for additional arguments in given file or start.ini as default
  • code/trunk/src/libraries/core/ConfigFileManager.cc

    r5929 r6417  
    5151        if (identifier != Identifier::getLowercaseStringIdentifierMapEnd())
    5252        {
    53             std::map<std::string, ConfigValueContainer*>::const_iterator variable = (*identifier).second->getLowercaseConfigValueMap().find(getLowercase(varname));
    54             if (variable != (*identifier).second->getLowercaseConfigValueMapEnd())
    55                 return (*variable).second->set(value);
     53            std::map<std::string, ConfigValueContainer*>::const_iterator variable = identifier->second->getLowercaseConfigValueMap().find(getLowercase(varname));
     54            if (variable != identifier->second->getLowercaseConfigValueMapEnd())
     55                return variable->second->set(value);
    5656        }
    5757        return false;
     58    }
     59
     60    std::string getConfig(const std::string& classname, const std::string& varname)
     61    {
     62        return ConfigFileManager::getInstance().getValue(ConfigFileType::Settings, classname, varname, "", true);
    5863    }
    5964
     
    6368        if (identifier != Identifier::getLowercaseStringIdentifierMapEnd())
    6469        {
    65             std::map<std::string, ConfigValueContainer*>::const_iterator variable = (*identifier).second->getLowercaseConfigValueMap().find(getLowercase(varname));
    66             if (variable != (*identifier).second->getLowercaseConfigValueMapEnd())
    67                 return (*variable).second->tset(value);
     70            std::map<std::string, ConfigValueContainer*>::const_iterator variable = identifier->second->getLowercaseConfigValueMap().find(getLowercase(varname));
     71            if (variable != identifier->second->getLowercaseConfigValueMapEnd())
     72                return variable->second->tset(value);
    6873        }
    6974        return false;
     
    9499            this->value_ = value;
    95100        else
    96             this->value_ = "\"" + addSlashes(stripEnclosingQuotes(value)) + "\"";
     101            this->value_ = '"' + addSlashes(stripEnclosingQuotes(value)) + '"';
    97102    }
    98103
     
    107112    std::string ConfigFileEntryValue::getFileEntry() const
    108113    {
    109         if (this->additionalComment_ == "" || this->additionalComment_.size() == 0)
    110             return (this->name_ + "=" + this->value_);
    111         else
    112             return (this->name_ + "=" + this->value_ + " " + this->additionalComment_);
     114        if (this->additionalComment_.empty())
     115            return (this->name_ + '=' + this->value_);
     116        else
     117            return (this->name_ + '=' + this->value_ + " " + this->additionalComment_);
    113118    }
    114119
     
    119124    std::string ConfigFileEntryVectorValue::getFileEntry() const
    120125    {
    121         if (this->additionalComment_ == "" || this->additionalComment_.size() == 0)
    122             return (this->name_ + "[" + multi_cast<std::string>(this->index_) + "]" + "=" + this->value_);
    123         else
    124             return (this->name_ + "[" + multi_cast<std::string>(this->index_) + "]=" + this->value_ + " " + this->additionalComment_);
     126        if (this->additionalComment_.empty())
     127            return (this->name_ + '[' + multi_cast<std::string>(this->index_) + ']' + '=' + this->value_);
     128        else
     129            return (this->name_ + '[' + multi_cast<std::string>(this->index_) + "]=" + this->value_ + ' ' + this->additionalComment_);
    125130    }
    126131
     
    166171    std::string ConfigFileSection::getFileEntry() const
    167172    {
    168         if (this->additionalComment_ == "" || this->additionalComment_.size() == 0)
    169             return ("[" + this->name_ + "]");
    170         else
    171             return ("[" + this->name_ + "] " + this->additionalComment_);
     173        if (this->additionalComment_.empty())
     174            return ('[' + this->name_ + ']');
     175        else
     176            return ('[' + this->name_ + "] " + this->additionalComment_);
    172177    }
    173178
     
    246251                std::getline(file, line);
    247252
    248                 std::string temp = getStripped(line);
     253                const std::string& temp = getStripped(line);
    249254                if (!isEmpty(temp) && !isComment(temp))
    250255                {
     
    256261                    {
    257262                        // New section
    258                         std::string comment = line.substr(pos2 + 1);
     263                        const std::string& comment = line.substr(pos2 + 1);
    259264                        if (isComment(comment))
    260265                            newsection = new ConfigFileSection(line.substr(pos1 + 1, pos2 - pos1 - 1), comment);
     
    288293                                commentposition = getNextCommentPosition(line, commentposition + 1);
    289294                            }
    290                             std::string value = "", comment = "";
     295                            std::string value, comment;
    291296                            if (commentposition == std::string::npos)
    292297                            {
     
    377382        {
    378383            std::map<std::string, Identifier*>::const_iterator it2 = Identifier::getStringIdentifierMap().find((*it1)->getName());
    379             if (it2 != Identifier::getStringIdentifierMapEnd() && (*it2).second->hasConfigValues())
     384            if (it2 != Identifier::getStringIdentifierMapEnd() && it2->second->hasConfigValues())
    380385            {
    381386                // The section exists, delete comment
     
    384389                for (std::list<ConfigFileEntry*>::iterator it3 = (*it1)->entries_.begin(); it3 != (*it1)->entries_.end(); )
    385390                {
    386                     std::map<std::string, ConfigValueContainer*>::const_iterator it4 = (*it2).second->getConfigValueMap().find((*it3)->getName());
    387                     if (it4 != (*it2).second->getConfigValueMapEnd())
     391                    std::map<std::string, ConfigValueContainer*>::const_iterator it4 = it2->second->getConfigValueMap().find((*it3)->getName());
     392                    if (it4 != it2->second->getConfigValueMapEnd())
    388393                    {
    389394                        // The config-value exists, delete comment
     
    459464                if (it->second->hasConfigValues())
    460465                {
    461                     for (std::map<std::string, ConfigValueContainer*>::const_iterator it2 = (*it).second->getConfigValueMapBegin(); it2 != (*it).second->getConfigValueMapEnd(); ++it2)
     466                    for (std::map<std::string, ConfigValueContainer*>::const_iterator it2 = it->second->getConfigValueMapBegin(); it2 != it->second->getConfigValueMapEnd(); ++it2)
    462467                        it2->second->update();
    463468
  • code/trunk/src/libraries/core/ConfigFileManager.h

    r6105 r6417  
    4040#include "util/Singleton.h"
    4141
     42// tolua_begin
    4243namespace orxonox
    4344{
     45    // tolua_end
    4446    // Use int as config file type to have an arbitrary number of files
    4547    struct ConfigFileType : OrxEnum<ConfigFileType>
     
    5052        static const int Settings            = 1;
    5153        static const int JoyStickCalibration = 2;
     54        static const int CommandHistory      = 3;
    5255
    5356        static const int numberOfReservedTypes = 1024;
    5457    };
    5558
    56     _CoreExport bool config(const std::string& classname, const std::string& varname, const std::string& value);
     59    _CoreExport bool config(const std::string& classname, const std::string& varname, const std::string& value); // tolua_export
     60    _CoreExport std::string getConfig(const std::string& classname, const std::string& varname); // tolua_export
    5761    _CoreExport bool tconfig(const std::string& classname, const std::string& varname, const std::string& value);
    5862    _CoreExport void reloadConfig();
     
    8589    {
    8690        public:
    87             inline ConfigFileEntryValue(const std::string& name, const std::string& value = "", bool bString = false, const std::string& additionalComment = "") : name_(name), value_(value), bString_(bString), additionalComment_(additionalComment) {}
     91            inline ConfigFileEntryValue(const std::string& name, const std::string& value = "", bool bString = false, const std::string& additionalComment = "")
     92                : name_(name)
     93                , value_(value)
     94                , bString_(bString)
     95                , additionalComment_(additionalComment)
     96                {}
    8897            inline virtual ~ConfigFileEntryValue() {}
    8998
     
    169178
    170179        public:
    171             inline ConfigFileSection(const std::string& name, const std::string& additionalComment = "") : name_(name), additionalComment_(additionalComment), bUpdated_(false) {}
     180            inline ConfigFileSection(const std::string& name, const std::string& additionalComment = "")
     181                : name_(name)
     182                , additionalComment_(additionalComment)
     183                , bUpdated_(false)
     184                {}
    172185            ~ConfigFileSection();
    173186
     
    240253                { this->getSection(section)->setValue(name, value, bString); this->save(); }
    241254            inline std::string getValue(const std::string& section, const std::string& name, const std::string& fallback, bool bString)
    242                 { std::string output = this->getSection(section)->getValue(name, fallback, bString); this->saveIfUpdated(); return output; }
     255                { const std::string& output = this->getSection(section)->getValue(name, fallback, bString); this->saveIfUpdated(); return output; }
    243256
    244257            inline void setValue(const std::string& section, const std::string& name, unsigned int index, const std::string& value, bool bString)
    245258                { this->getSection(section)->setValue(name, index, value, bString); this->save(); }
    246259            inline std::string getValue(const std::string& section, const std::string& name, unsigned int index, const std::string& fallback, bool bString)
    247                 { std::string output = this->getSection(section)->getValue(name, index, fallback, bString); this->saveIfUpdated(); return output; }
     260                { const std::string& output = this->getSection(section)->getValue(name, index, fallback, bString); this->saveIfUpdated(); return output; }
    248261
    249262            inline void deleteVectorEntries(const std::string& section, const std::string& name, unsigned int startindex = 0)
     
    319332            static ConfigFileManager* singletonPtr_s;
    320333    };
    321 }
     334} // tolua_export
    322335
    323336#endif /* _ConfigFileManager_H__ */
  • code/trunk/src/libraries/core/ConfigValueContainer.h

    r5738 r6417  
    121121                @param defvalue The default-value
    122122            */
    123             template <class V>
    124             ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& sectionname, const std::string& varname, const std::vector<V>& defvalue)
     123            template <class D, class V>
     124            ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& sectionname, const std::string& varname, const std::vector<D>& defvalue, const std::vector<V>& value)
    125125            {
    126126                this->init(type, identifier, sectionname, varname);
     
    146146                if ((this->callback_ && object) || this->bContainerIsNew_)
    147147                {
    148                     if (this->bContainerIsNew_)
    149                         this->bContainerIsNew_ = false;
    150 
    151148                    T temp = *value;
    152149                    this->value_.getValue(value);
    153                     if ((*value) != temp)
    154                     {
     150                    if (this->bContainerIsNew_ || (*value) != temp)
     151                    {
     152                        this->bContainerIsNew_ = false;
    155153                        if (this->callback_ && object)
    156154                            this->callback_->call(object);
  • code/trunk/src/libraries/core/ConfigValueIncludes.h

    r6105 r6417  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      ...
     25 *      Reto Grieder (functions)
    2626 *
    2727 */
    2828
    2929/**
    30     @file
    31     @brief Definition of macros for config-values.
     30@file
     31@brief
     32    Definition of macros and functions for config-values.
    3233*/
    3334
     
    4142#include "ConfigFileManager.h"
    4243
     44namespace orxonox
     45{
     46    /** Sets a runtime configurable value.
     47        If the container for the value doesn't yet exist, a new one is created.
     48        Also, the @a variable argument will be modified and set to the new value (default or from ini file).
     49    @param object
     50        Class instance that the config value should belong to (usually just 'this')
     51    @param variable
     52        Pointer to the variable where the value should be written to
     53    @param type
     54        Type of the config file, usually ConfigFileType::Settings
     55    @param sectionName
     56        Name of the section in the ini file (e.g. [MySection])
     57    @param entryName
     58        Name of the entry in the ini file (e.g. [MySection] myValue)
     59    @param defaultValue
     60        Value to be used if it cannot be read from the ini file
     61    */
     62    template <class T, class D, class V>
     63    inline ConfigValueContainer& setConfigValueGeneric(T* object, V* variable, ConfigFileType type, const std::string& sectionName, const std::string& entryName, const D& defaultValue)
     64    {
     65        ConfigValueContainer* container = object->getIdentifier()->getConfigValueContainer(entryName);
     66        if (!container)
     67        {
     68            container = new ConfigValueContainer(type, object->getIdentifier(), sectionName, entryName, defaultValue, *variable);
     69            object->getIdentifier()->addConfigValueContainer(entryName, container);
     70        }
     71        return container->getValue(variable, object);
     72    }
     73}
    4374
    44 /**
    45     @brief Assigns the value, defined in the config-file, to the variable (or the default-value, if there is no entry in the file).
    46     @param varname The name of the variable
    47     @param defvalue The default-value of the variable
     75/** Sets a runtime configurable value (simplified macro version of setConfigValueGeneric)
     76    If the container for the value doesn't yet exist, a new one is created.
     77    Also, the @a varname argument will be modified and set to the new value (default or from ini file).
     78@param varname
     79    Variable name as C++ identifier. It will be used as entry name and as variable pointer
     80@param defaultValue
     81    Value to be used if it cannot be read from the ini file
    4882*/
    49 #define SetConfigValueGeneric(type, varname, entryname, sectionname, defvalue) \
    50     static orxonox::Identifier* identifier##varname = this->getIdentifier(); \
    51     orxonox::ConfigValueContainer* container##varname = identifier##varname->getConfigValueContainer(entryname); \
    52     if (!container##varname) \
    53     { \
    54         container##varname = new orxonox::ConfigValueContainer(type, identifier##varname, sectionname, entryname, defvalue, varname); \
    55         identifier##varname->addConfigValueContainer(entryname, container##varname); \
    56     } \
    57     container##varname->getValue(&varname, this)
     83#define SetConfigValue(varname, defaultValue) \
     84    orxonox::setConfigValueGeneric(this, &varname, ConfigFileType::Settings, this->getIdentifier()->getName(), #varname, defaultValue)
    5885
    59 #define SetConfigValue(varname, defvalue) SetConfigValueGeneric(ConfigFileType::Settings, varname, #varname, identifier##varname->getName(), defvalue)
     86/** Sets a runtime configurable value (simplified macro version of setConfigValueGeneric)
     87    If the container for the value doesn't yet exist, a new one is created.
     88    Also, the @a varname argument will be modified and set to the new value (default or from ini file).
     89@param variable
     90    Variable name as C++ identifier.
     91@param entryName
     92    Name of the entry in the ini file (e.g. [MySection] myValue)
     93@param defaultValue
     94    Value to be used if it cannot be read from the ini file
     95*/
     96#define SetConfigValueAlias(variable, entryName, defaultValue) \
     97    orxonox::setConfigValueGeneric(this, &variable, ConfigFileType::Settings, this->getIdentifier()->getName(), entryName, defaultValue)
    6098
    6199
    62 /**
    63     @brief Assigns the vector-values, defined in the config-file, to the vector (or the default-value, if there are no entries in the file).
    64     @param varname The name of the std::vector
    65     @param defvalue The default-value
     100namespace orxonox
     101{
     102    /** Resets a runtime configurable value to its default.
     103        If the container for the value doesn't yet exist, a warning is displayed.
     104        Also, the @a variable argument will be modified and set to the default value.
     105    @param object
     106        Class instance that the config value should belong to (usually just 'this')
     107    @param variable
     108        Pointer to the variable where the value should be written to
     109    @param entryName
     110        Name of the entry in the ini file (e.g. [MySection] myValue)
     111    */
     112    template <class T, class V>
     113    inline void resetConfigValueGeneric(T* object, V* variable, const std::string& entryName)
     114    {
     115        ConfigValueContainer* container = object->getIdentifier()->getConfigValueContainer(entryName);
     116        if (container)
     117        {
     118            container->reset();
     119            container->getValue(variable, object);
     120        }
     121        else
     122        {
     123            COUT(2) << "Warning: Couldn't reset config-value '" << entryName << "' in class '"
     124                    << object->getIdentifier()->getName() << "', corresponding container doesn't exist." << std::endl;
     125        }
     126    }
     127}
     128
     129/** Resets a runtime configurable value to its default (simplified macro version of modifyConfigValueGeneric)
     130    If the container for the value doesn't yet exist, a warning is displayed.
     131    Also, the @a varname argument will be modified and set to the default value.
     132@param varname
     133    Variable name as C++ identifier. It will be used as entry name and as variable pointer
    66134*/
    67 #define SetConfigValueVectorGeneric(type, varname, defvalue) \
    68     static orxonox::Identifier* identifier##varname = this->getIdentifier(); \
    69     orxonox::ConfigValueContainer* container##varname = identifier##varname->getConfigValueContainer(#varname); \
    70     if (!container##varname) \
    71     { \
    72         container##varname = new orxonox::ConfigValueContainer(type, identifier##varname, identifier##varname->getName(), #varname, defvalue); \
    73         identifier##varname->addConfigValueContainer(#varname, container##varname); \
    74     } \
    75     container##varname->getValue(&varname, this)
    76 
    77 #define SetConfigValueVector(varname, defvalue) SetConfigValueVectorGeneric(ConfigFileType::Settings, varname, defvalue)
     135#define ResetConfigValue(varname) \
     136    orxonox::resetConfigValueGeneric(this, &varname, #varname)
    78137
    79138
    80 /**
    81     @brief Sets the variable and the config-file entry back to the previously defined default-value.
    82     @param varname The name of the variable
     139/** Modifies a runtime configurable value by using a modifier and some arguments.
     140    If the container for the value doesn't yet exist, a warning is displayed.
     141    Also, the @a variable argument will be modified and set to the current value.
     142@param object
     143    Class instance that the config value should belong to (usually just 'this')
     144@param variable
     145    Pointer to the variable where the value should be written to
     146@param entryName
     147    Name of the entry in the ini file (e.g. [MySection] myValue)
     148@param modifier
     149    On of these functions: set, tset, add, remove, reset, update
     150@param ...
     151    Arguments for the modifier function
    83152*/
    84 #define ResetConfigValue(varname) \
    85     orxonox::ConfigValueContainer* container##varname##reset = this->getIdentifier()->getConfigValueContainer(#varname); \
    86     if (container##varname##reset) \
     153#define ModifyConfigValueGeneric(object, variable, entryName, modifier, ...) \
     154    if (orxonox::ConfigValueContainer* container = object->getIdentifier()->getConfigValueContainer(entryName)) \
    87155    { \
    88         container##varname##reset->reset(); \
    89         container##varname##reset->getValue(&varname, this); \
     156        container->modifier(__VA_ARGS__); \
     157        container->getValue(variable, object); \
    90158    } \
    91159    else \
    92160    { \
    93         COUT(2) << "Warning: Couldn't reset config-value '" << #varname << "', corresponding container doesn't exist." << std::endl; \
     161        COUT(2) << "Warning: Couln't modify config-value '" << entryName << "' in class '" \
     162                << object->getIdentifier()->getName() << "', corresponding container doesn't exist." << std::endl; \
    94163    }
    95164
    96 
    97 /**
    98     @brief Modifies a config-value by using a modifier and some arguments.
    99     @param varname The name of the config-value
    100     @param modifier The name of the modifier: set, tset, add, remove, reset, update
     165/** Modifies a runtime configurable value by using a modifier and some arguments.
     166    If the container for the value doesn't yet exist, a warning is displayed.
     167    Also, the @a varname argument will be modified and set to the current value.
     168@param varname
     169    Variable name as C++ identifier. It will be used as entry name and as variable pointer
     170@param modifier
     171    On of these functions: set, tset, add, remove, reset, update
     172@param ...
     173    Arguments for the modifier function
    101174*/
    102175#define ModifyConfigValue(varname, modifier, ...) \
    103     orxonox::ConfigValueContainer* container##varname##modify##modifier = this->getIdentifier()->getConfigValueContainer(#varname); \
    104     if (container##varname##modify##modifier) \
    105     { \
    106         container##varname##modify##modifier->modifier(__VA_ARGS__); \
    107         container##varname##modify##modifier->getValue(&varname, this); \
    108     } \
    109     else \
    110     { \
    111         COUT(2) << "Warning: Couln't modify config-value '" << #varname << "', corresponding container doesn't exist." << std::endl; \
    112     }
     176    ModifyConfigValueGeneric(this, &varname, #varname, modifier, __VA_ARGS__)
    113177
    114178#endif /* _ConfigValueIncludes_H__ */
  • code/trunk/src/libraries/core/ConsoleCommandCompilation.cc

    r6105 r6417  
    3535#include "util/Debug.h"
    3636#include "util/ExprParser.h"
     37#include "util/StringUtils.h"
    3738#include "ConsoleCommand.h"
    3839
     
    142143        }
    143144
    144         std::string output = "";
     145        std::string output;
    145146        while (file.good() && !file.eof())
    146147        {
     
    158159    float calculate(const std::string& calculation)
    159160    {
    160         ExprParser expr(calculation);
     161        ExprParser expr;
     162        expr.parse(calculation);
    161163        if (expr.getSuccess())
    162164        {
     
    165167                COUT(3) << "Greetings from the restaurant at the end of the universe." << std::endl;
    166168            }
    167             if (expr.getRemains() != "")
     169            if (!expr.getRemains().empty())
    168170            {
    169                 COUT(2) << "Warning: Expression could not be parsed to the end! Remains: '" << expr.getRemains() << "'" << std::endl;
     171                COUT(2) << "Warning: Expression could not be parsed to the end! Remains: '" << expr.getRemains() << '\'' << std::endl;
    170172            }
    171173            return static_cast<float>(expr.getResult());
  • code/trunk/src/libraries/core/Core.cc

    r6105 r6417  
    5151#include "util/Debug.h"
    5252#include "util/Exception.h"
     53#include "util/Scope.h"
    5354#include "util/SignalHandler.h"
    5455#include "PathConfig.h"
     
    7879    SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file");
    7980#ifdef ORXONOX_PLATFORM_WINDOWS
    80     SetCommandLineArgument(limitToCPU, 0).information("Limits the program to one cpu/core (1, 2, 3, etc.). 0 turns it off (default)");
    81 #endif
    82 
    83     /**
    84     @brief
    85         Helper class for the Core singleton: we cannot derive
    86         Core from OrxonoxClass because we need to handle the Identifier
    87         destruction in the Core destructor.
    88     */
    89     class CoreConfiguration : public OrxonoxClass
    90     {
    91     public:
    92         CoreConfiguration()
    93         {
    94         }
    95 
    96         void initialise()
    97         {
    98             RegisterRootObject(CoreConfiguration);
    99             this->setConfigValues();
    100         }
    101 
    102         /**
    103             @brief Function to collect the SetConfigValue-macro calls.
    104         */
    105         void setConfigValues()
    106         {
    107 #ifdef ORXONOX_RELEASE
    108             const unsigned int defaultLevelLogFile = 3;
    109 #else
    110             const unsigned int defaultLevelLogFile = 4;
    111 #endif
    112             SetConfigValueGeneric(ConfigFileType::Settings, softDebugLevelLogFile_, "softDebugLevelLogFile", "OutputHandler", defaultLevelLogFile)
    113                 .description("The maximum level of debug output shown in the log file");
    114             OutputHandler::getInstance().setSoftDebugLevel(OutputHandler::logFileOutputListenerName_s, this->softDebugLevelLogFile_);
    115 
    116             SetConfigValue(language_, Language::getInstance().defaultLanguage_)
    117                 .description("The language of the in game text")
    118                 .callback(this, &CoreConfiguration::languageChanged);
    119             SetConfigValue(bInitializeRandomNumberGenerator_, true)
    120                 .description("If true, all random actions are different each time you start the game")
    121                 .callback(this, &CoreConfiguration::initializeRandomNumberGenerator);
    122         }
    123 
    124         /**
    125             @brief Callback function if the language has changed.
    126         */
    127         void languageChanged()
    128         {
    129             // Read the translation file after the language was configured
    130             Language::getInstance().readTranslatedLanguageFile();
    131         }
    132 
    133         /**
    134             @brief Sets the language in the config-file back to the default.
    135         */
    136         void resetLanguage()
    137         {
    138             ResetConfigValue(language_);
    139         }
    140 
    141         void initializeRandomNumberGenerator()
    142         {
    143             static bool bInitialized = false;
    144             if (!bInitialized && this->bInitializeRandomNumberGenerator_)
    145             {
    146                 srand(static_cast<unsigned int>(time(0)));
    147                 rand();
    148                 bInitialized = true;
    149             }
    150         }
    151 
    152         int softDebugLevelLogFile_;                     //!< The debug level for the log file (belongs to OutputHandler)
    153         std::string language_;                          //!< The language
    154         bool bInitializeRandomNumberGenerator_;         //!< If true, srand(time(0)) is called
    155     };
    156 
     81    SetCommandLineArgument(limitToCPU, 1).information("Limits the program to one CPU/core (1, 2, 3, etc.). Default is the first core (faster than off)");
     82#endif
    15783
    15884    Core::Core(const std::string& cmdLine)
     
    16187        // Cleanup guard for external console commands that don't belong to an Identifier
    16288        , consoleCommandDestroyer_(CommandExecutor::destroyExternalCommands)
    163         , configuration_(new CoreConfiguration()) // Don't yet create config values!
    16489        , bGraphicsLoaded_(false)
    16590    {
     
    218143        this->languageInstance_.reset(new Language());
    219144
     145        // Do this soon after the ConfigFileManager has been created to open up the
     146        // possibility to configure everything below here
     147        ClassIdentifier<Core>::getIdentifier("Core")->initialiseObject(this, "Core", true);
     148        this->setConfigValues();
     149
    220150        // create persistent io console
    221151        this->ioConsole_.reset(new IOConsole());
     
    223153        // creates the class hierarchy for all classes with factories
    224154        Identifier::createClassHierarchy();
    225 
    226         // Do this soon after the ConfigFileManager has been created to open up the
    227         // possibility to configure everything below here
    228         this->configuration_->initialise();
    229155
    230156        // Load OGRE excluding the renderer and the render window
     
    245171    Core::~Core()
    246172    {
     173        // Remove us from the object lists again to avoid problems when destroying them
     174        this->unregisterObject();
     175    }
     176
     177    //! Function to collect the SetConfigValue-macro calls.
     178    void Core::setConfigValues()
     179    {
     180#ifdef ORXONOX_RELEASE
     181        const unsigned int defaultLevelLogFile = 3;
     182#else
     183        const unsigned int defaultLevelLogFile = 4;
     184#endif
     185        setConfigValueGeneric(this, &this->softDebugLevelLogFile_, ConfigFileType::Settings, "OutputHandler", "softDebugLevelLogFile", defaultLevelLogFile)
     186            .description("The maximum level of debug output shown in the log file");
     187        OutputHandler::getInstance().setSoftDebugLevel(OutputHandler::logFileOutputListenerName_s, this->softDebugLevelLogFile_);
     188
     189        SetConfigValue(language_, Language::getInstance().defaultLanguage_)
     190            .description("The language of the in game text")
     191            .callback(this, &Core::languageChanged);
     192        SetConfigValue(bInitRandomNumberGenerator_, true)
     193            .description("If true, all random actions are different each time you start the game")
     194            .callback(this, &Core::initRandomNumberGenerator);
     195    }
     196
     197    //! Callback function if the language has changed.
     198    void Core::languageChanged()
     199    {
     200        // Read the translation file after the language was configured
     201        Language::getInstance().readTranslatedLanguageFile();
     202    }
     203
     204    void Core::initRandomNumberGenerator()
     205    {
     206        static bool bInitialized = false;
     207        if (!bInitialized && this->bInitRandomNumberGenerator_)
     208        {
     209            srand(static_cast<unsigned int>(time(0)));
     210            rand();
     211            bInitialized = true;
     212        }
    247213    }
    248214
     
    296262    }
    297263
    298     /**
    299         @brief Returns the configured language.
    300     */
    301     /*static*/ const std::string& Core::getLanguage()
    302     {
    303         return Core::getInstance().configuration_->language_;
    304     }
    305 
    306     /**
    307         @brief Sets the language in the config-file back to the default.
    308     */
    309     /*static*/ void Core::resetLanguage()
    310     {
    311         Core::getInstance().configuration_->resetLanguage();
     264    //! Sets the language in the config-file back to the default.
     265    void Core::resetLanguage()
     266    {
     267        ResetConfigValue(language_);
    312268    }
    313269
     
    360316    void Core::preUpdate(const Clock& time)
    361317    {
    362         // singletons from other libraries
    363         ScopedSingletonManager::update<ScopeID::Root>(time);
     318        // Update singletons before general ticking
     319        ScopedSingletonManager::preUpdate<ScopeID::Root>(time);
    364320        if (this->bGraphicsLoaded_)
    365321        {
    366             // process input events
    367             this->inputManager_->update(time);
    368             // process gui events
    369             this->guiManager_->update(time);
    370             // graphics singletons from other libraries
    371             ScopedSingletonManager::update<ScopeID::Graphics>(time);
    372         }
    373         // process console text
    374         this->ioConsole_->update(time);
    375         // process thread commands
    376         this->tclThreadManager_->update(time);
     322            // Process input events
     323            this->inputManager_->preUpdate(time);
     324            // Update GUI
     325            this->guiManager_->preUpdate(time);
     326            // Update singletons before general ticking
     327            ScopedSingletonManager::preUpdate<ScopeID::Graphics>(time);
     328        }
     329        // Process console events and status line
     330        this->ioConsole_->preUpdate(time);
     331        // Process thread commands
     332        this->tclThreadManager_->preUpdate(time);
    377333    }
    378334
    379335    void Core::postUpdate(const Clock& time)
    380336    {
     337        // Update singletons just before rendering
     338        ScopedSingletonManager::postUpdate<ScopeID::Root>(time);
    381339        if (this->bGraphicsLoaded_)
    382340        {
     341            // Update singletons just before rendering
     342            ScopedSingletonManager::postUpdate<ScopeID::Graphics>(time);
    383343            // Render (doesn't throw)
    384             this->graphicsManager_->update(time);
     344            this->graphicsManager_->postUpdate(time);
    385345        }
    386346    }
  • code/trunk/src/libraries/core/Core.h

    r6105 r6417  
    3434
    3535#include <cassert>
     36#include <string>
    3637#include <boost/scoped_ptr.hpp>
    37 #include "util/OutputHandler.h"
    38 #include "util/Scope.h"
    3938#include "util/ScopeGuard.h"
    4039#include "util/Singleton.h"
     40#include "core/OrxonoxClass.h"
    4141
    4242namespace orxonox
    4343{
    44     class CoreConfiguration;
    45 
    4644    /**
    4745    @brief
     
    5048        You should only create this singleton once because it destroys the identifiers!
    5149    */
    52     class _CoreExport Core : public Singleton<Core>
     50    class _CoreExport Core : public Singleton<Core>, public OrxonoxClass
    5351    {
    5452        typedef Loki::ScopeGuardImpl0<void (*)()> SimpleScopeGuard;
     
    6967            void setConfigValues();
    7068
    71             static const std::string& getLanguage();
    72             static void  resetLanguage();
     69            //! Returns the configured language.
     70            const std::string& getLanguage()
     71                { return this->language_; }
     72            void resetLanguage();
    7373
    7474        private:
    7575            Core(const Core&); //!< Don't use (undefined symbol)
     76
     77            void languageChanged();
     78            void initRandomNumberGenerator();
    7679
    7780            void preUpdate(const Clock& time);
     
    8285
    8386            void setThreadAffinity(int limitToCPU);
    84 
     87            // MANAGED SINGLETONS/OBJECTS
    8588            // Mind the order for the destruction!
    8689            scoped_ptr<PathConfig>        pathConfig_;
     
    9295            scoped_ptr<Language>          languageInstance_;
    9396            scoped_ptr<IOConsole>         ioConsole_;
    94             scoped_ptr<CoreConfiguration> configuration_;
    9597            scoped_ptr<TclBind>           tclBind_;
    9698            scoped_ptr<TclThreadManager>  tclThreadManager_;
     99            scoped_ptr<Scope<ScopeID::Root> >     rootScope_;
    97100            // graphical
    98101            scoped_ptr<GraphicsManager>   graphicsManager_;     //!< Interface to OGRE
    99102            scoped_ptr<InputManager>      inputManager_;        //!< Interface to OIS
    100103            scoped_ptr<GUIManager>        guiManager_;          //!< Interface to GUI
    101             scoped_ptr<Scope<ScopeID::Root> >     rootScope_;
    102104            scoped_ptr<Scope<ScopeID::Graphics> > graphicsScope_;
    103105
    104106            bool                          bGraphicsLoaded_;
    105             static Core* singletonPtr_s;
     107            int                           softDebugLevelLogFile_;      //!< The debug level for the log file (belongs to OutputHandler)
     108            std::string                   language_;                   //!< The language
     109            bool                          bInitRandomNumberGenerator_; //!< If true, srand(time(0)) is called
     110
     111            static Core*                  singletonPtr_s;
    106112    };
    107113}
  • code/trunk/src/libraries/core/DynLib.cc

    r6073 r6417  
    7979        m_hInst = (DYNLIB_HANDLE)DYNLIB_LOAD( name.c_str() );
    8080
    81         if( !m_hInst )
     81        if (!m_hInst)
    8282            ThrowException(
    8383                General,
     
    9292        COUT(4) << "Unloading module " << mName << std::endl;
    9393
    94         if( DYNLIB_UNLOAD( m_hInst ) )
     94        if (DYNLIB_UNLOAD( m_hInst ))
    9595        {
    9696            ThrowException(
     
    132132        return std::string(mac_errorBundle());
    133133#else
    134         return std::string("");
     134        return "";
    135135#endif
    136136    }
  • code/trunk/src/libraries/core/Event.cc

    r5929 r6417  
    4545    /**
    4646        @brief Processes an event (calls the set-function if the necessary conditions are met).
    47        
     47
    4848        @param event     The fired event
    4949        @param object    The object whose state is affected by the event (only needed for debug output)
     
    5353        if (this->bProcessingEvent_)
    5454        {
    55             COUT(2) << "Warning: Detected Event loop in section \"" << event.statename_ << "\" of object \"" << object->getName() << "\" and fired by \"" << event.originator_->getName() << "\"" << std::endl;
     55            COUT(2) << "Warning: Detected Event loop in section \"" << event.statename_ << "\" of object \"" << object->getName() << "\" and fired by \"" << event.originator_->getName() << '"' << std::endl;
    5656            return;
    5757        }
  • code/trunk/src/libraries/core/Event.h

    r5929 r6417  
    5050    /**
    5151        @brief The EventState contains information about an event state.
    52        
     52
    5353        An event state is a state of an object, which can be changed by events.
    5454        Event states are changed through functions. Possible functions headers for set event states are:
     
    5656         - boolean state:    function(bool state)
    5757         - individual state: function(bool state, SomeClass originator)
    58          
     58
    5959        Note that SomeClass may be any class deriving from BaseObject. You will not receive events from originators of other classes.
    6060        The actual class for SomeClass must be specified as the second argument of the XMLPortEventState macro.
    61        
     61
    6262        The this pointer of the affected object is hidden in the functors, because the events are processed in the BaseObject, but some
    6363        statefunctions may be from child-classes.
     
    7070
    7171            void process(const Event& event, BaseObject* object);
    72            
     72
    7373            Functor* getFunctor() const
    7474                { return this->statefunction_; }
  • code/trunk/src/libraries/core/EventIncludes.h

    r5929 r6417  
    3636/**
    3737    @brief Defines a new event state (a state of the object which can be changed by events).
    38    
     38
    3939    @param classname    The name of this class
    4040    @param subclassname Usually BaseObject - if different, only instances of this class can send events to this object
     
    6666
    6767#define XMLPortEventStateIntern(name, classname, statename, xmlelement, mode) \
    68     static orxonox::ExecutorMember<classname>* xmlsetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::addEventSource), std::string( #classname ) + "::" + "addEventSource" + "(" + statename + ")")->setDefaultValue(1, statename); \
    69     static orxonox::ExecutorMember<classname>* xmlgetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::getEventSource), std::string( #classname ) + "::" + "getEventSource" + "(" + statename + ")")->setDefaultValue(1, statename); \
     68    static orxonox::ExecutorMember<classname>* xmlsetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::addEventSource), std::string( #classname ) + "::" + "addEventSource" + '(' + statename + ')')->setDefaultValue(1, statename); \
     69    static orxonox::ExecutorMember<classname>* xmlgetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::getEventSource), std::string( #classname ) + "::" + "getEventSource" + '(' + statename + ')')->setDefaultValue(1, statename); \
    7070    XMLPortObjectGeneric(xmlport##name, classname, orxonox::BaseObject, statename, xmlsetfunctor##name, xmlgetfunctor##name, xmlelement, mode, false, true)
    71    
     71
    7272
    7373/**
    7474    @brief Defines a new event name for a class. Named events can only have names which were defined with this macro.
    75    
     75
    7676    @param classname The name of the class
    7777    @param name      The name of the event
     
    8282/**
    8383    @brief This macro is needed to fire an event with this name. The event name must previously be declared with @ref CreateEventName.
    84 */   
     84*/
    8585#define FireEventName(classname, name) \
    8686    eventname##classname##name
    87  
     87
    8888#endif /* _EventIncludes_H__ */
  • code/trunk/src/libraries/core/Executor.cc

    r5738 r6417  
    7373        {
    7474            // only one param: check if there are params given, otherwise try to use default values
    75             std::string temp = getStripped(params);
    76             if ((temp != "") && (temp.size() != 0))
     75            if (!getStripped(params).empty())
    7776            {
    7877                param[0] = params;
  • code/trunk/src/libraries/core/Executor.h

    r5738 r6417  
    6363    else if (paramCount == 1) \
    6464    { \
    65         std::string temp = getStripped(params); \
    66         if ((temp != "") && (temp.size() != 0)) \
     65        const std::string& temp = getStripped(params); \
     66        if (!temp.empty()) \
    6767        { \
    6868            COUT(5) << "Calling Executor " << this->name_ << " through parser with one parameter, using whole string: " << params << std::endl; \
     
    187187                { return this->functor_->getTypenameReturnvalue(); }
    188188
    189             inline void setName(const std::string name)
     189            inline void setName(const std::string& name)
    190190                { this->name_ = name; }
    191191            inline const std::string& getName() const
  • code/trunk/src/libraries/core/Functor.h

    r5929 r6417  
    3535#include "util/Debug.h"
    3636#include "util/MultiType.h"
    37 #include "util/StringUtils.h"
    3837
    3938namespace orxonox
  • code/trunk/src/libraries/core/GUIManager.cc

    r6105 r6417  
    4040#include <CEGUIResourceProvider.h>
    4141#include <CEGUISystem.h>
     42#include <CEGUIWindow.h>
    4243#include <ogreceguirenderer/OgreCEGUIRenderer.h>
    4344
     
    5051
    5152#include "util/Clock.h"
     53#include "util/Convert.h"
    5254#include "util/Debug.h"
    5355#include "util/Exception.h"
    5456#include "util/OrxAssert.h"
     57#include "ConsoleCommand.h"
     58#include "Core.h"
    5559#include "LuaState.h"
    5660#include "PathConfig.h"
     
    5963namespace orxonox
    6064{
     65    static void key_esc()
     66        { GUIManager::getInstance().keyESC(); }
     67    SetConsoleCommandShortcutExternAlias(key_esc, "keyESC");
     68
    6169    class CEGUILogger : public CEGUI::DefaultLogger
    6270    {
     
    8593    GUIManager* GUIManager::singletonPtr_s = 0;
    8694
     95    SetConsoleCommandShortcut(GUIManager, showGUI).accessLevel(AccessLevel::User).defaultValue(1, false).defaultValue(2, true);
     96    SetConsoleCommandShortcut(GUIManager, hideGUI).accessLevel(AccessLevel::User);
     97
    8798    /**
    8899    @brief
     
    101112        , resourceProvider_(0)
    102113        , camera_(NULL)
     114        , bShowIngameGUI_(false)
    103115    {
    104116        using namespace CEGUI;
     
    113125        // setup scripting
    114126        luaState_.reset(new LuaState());
     127        rootFileInfo_ = Resource::getInfo("InitialiseGUI.lua");
     128        // This is necessary to ensure that input events also use the right resource info when triggering lua functions
     129        luaState_->setDefaultResourceInfo(this->rootFileInfo_);
    115130        scriptModule_.reset(new LuaScriptModule(luaState_->getInternalLuaState()));
    116131
     
    127142
    128143        // Initialise the basic Lua code
    129         rootFileInfo_ = Resource::getInfo("InitialiseGUI.lua", "GUI");
    130         this->luaState_->doFile("InitialiseGUI.lua", "GUI", false);
     144        this->luaState_->doFile("InitialiseGUI.lua");
    131145
    132146        // Align CEGUI mouse with OIS mouse
     
    156170        This time value is then used to provide a fluent animation of the GUI.
    157171    */
    158     void GUIManager::update(const Clock& time)
     172    void GUIManager::preUpdate(const Clock& time)
    159173    {
    160174        assert(guiSystem_);
     
    203217        For more details check out loadGUI_2.lua where the function presides.
    204218    */
    205     void GUIManager::showGUI(const std::string& name)
    206     {
    207         this->luaState_->doString("showGUI(\"" + name + "\")", rootFileInfo_);
     219    /*static*/ void GUIManager::showGUI(const std::string& name, bool hidePrevious, bool showCursor)
     220    {
     221        GUIManager::getInstance().executeCode("showGUI(\"" + name + "\", " + multi_cast<std::string>(hidePrevious) + ", " + multi_cast<std::string>(showCursor) + ")");
     222    }
     223
     224    /**
     225    @brief
     226        Hack-ish. Needed for GUIOverlay.
     227    */
     228    void GUIManager::showGUIExtra(const std::string& name, const std::string& ptr, bool hidePrevious, bool showCursor)
     229    {
     230        this->executeCode("showGUI(\"" + name + "\", " + multi_cast<std::string>(hidePrevious) + ", " + multi_cast<std::string>(showCursor) + ", " + ptr + ")");
     231    }
     232
     233    /**
     234    @brief
     235        Hides specified GUI.
     236    @param name
     237        The name of the GUI.
     238    */
     239    /*static*/ void GUIManager::hideGUI(const std::string& name)
     240    {
     241        GUIManager::getInstance().executeCode("hideGUI(\"" + name + "\")");
     242    }
     243
     244    void GUIManager::keyESC()
     245    {
     246        this->executeCode("keyESC()");
     247    }
     248
     249    void GUIManager::setBackground(const std::string& name)
     250    {
     251        this->executeCode("setBackground(\"" + name + "\")");
    208252    }
    209253
     
    304348        }
    305349    }
     350
     351    void GUIManager::subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function)
     352    {
     353        window->subscribeScriptedEvent(event, function);
     354    }
    306355}
  • code/trunk/src/libraries/core/GUIManager.h

    r5929 r6417  
    3434
    3535#include <map>
     36#include <set>
    3637#include <string>
    3738#include <CEGUIForwardRefs.h>
     
    4344#include "input/InputHandler.h"
    4445
    45 namespace orxonox
    46 {
     46namespace orxonox // tolua_export
     47{ // tolua_export
    4748    class PlayerInfo; // Forward declaration
    4849
     
    5859        Those input events are then injected into CEGUI in Lua.
    5960    */
    60     class _CoreExport GUIManager : public Singleton<GUIManager>, public InputHandler
    61     {
     61    class _CoreExport GUIManager // tolua_export
     62        : public Singleton<GUIManager>, public InputHandler
     63    { // tolua_export
    6264        friend class Singleton<GUIManager>;
    6365    public:
     
    6567        ~GUIManager();
    6668
    67         void update(const Clock& time);
     69        void preUpdate(const Clock& time);
    6870
    69         void showGUI(const std::string& name);
    70         void executeCode(const std::string& str);
     71        static void showGUI(const std::string& name, bool hidePrevious=false, bool showCursor=true);
     72        void showGUIExtra(const std::string& name, const std::string& ptr, bool hidePrevious=false, bool showCursor=true);
     73        static void hideGUI(const std::string& name);
     74        void keyESC();
     75        void setBackground(const std::string& name);
    7176
    7277        void setCamera(Ogre::Camera* camera);
     
    8085            { std::map<std::string, PlayerInfo*>::const_iterator it = this->players_.find(guiname); return (it != this->players_.end()) ? it->second : 0; }
    8186
     87        // TODO: Temporary hack because the tolua exported CEGUI method does not seem to work
     88        static void subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function); //tolua_export
     89
    8290    private:
    8391        GUIManager(const GUIManager& instance); //!< private and undefined copy c'tor (this is a singleton class)
     92
     93        void executeCode(const std::string& str);
    8494
    8595        // keyHandler functions
     
    105115
    106116        static GUIManager*                   singletonPtr_s;    //!< Singleton reference to GUIManager
     117        bool                                 bShowIngameGUI_;
    107118
    108     };
    109 }
     119    }; // tolua_export
     120} // tolua_export
    110121
    111122#endif /* _GUIManager_H__ */
  • code/trunk/src/libraries/core/Game.cc

    r6021 r6417  
    5151#include "GameMode.h"
    5252#include "GameState.h"
     53#include "GUIManager.h"
    5354
    5455namespace orxonox
     
    6768    Game* Game::singletonPtr_s = 0;
    6869
    69 
    70     /**
    71     @brief
    72         Represents one node of the game state tree.
    73     */
     70    //! Represents one node of the game state tree.
    7471    struct GameStateTreeNode
    7572    {
     
    7976    };
    8077
    81 
    82     /**
    83     @brief
    84         Another helper class for the Game singleton: we cannot derive
    85         Game from OrxonoxClass because we need to handle the Identifier
    86         destruction in the Core destructor.
    87     */
    88     class GameConfiguration : public OrxonoxClass
    89     {
    90     public:
    91         GameConfiguration()
    92         {
    93             RegisterRootObject(GameConfiguration);
    94             this->setConfigValues();
    95         }
    96 
    97         void setConfigValues()
    98         {
    99             SetConfigValue(statisticsRefreshCycle_, 250000)
    100                 .description("Sets the time in microseconds interval at which average fps, etc. get updated.");
    101             SetConfigValue(statisticsAvgLength_, 1000000)
    102                 .description("Sets the time in microseconds interval at which average fps, etc. gets calculated.");
    103             SetConfigValue(fpsLimit_, 50)
    104                 .description("Sets the desired framerate (0 for no limit).");
    105         }
    106 
    107         unsigned int statisticsRefreshCycle_;
    108         unsigned int statisticsAvgLength_;
    109         unsigned int fpsLimit_;
    110     };
    111 
    112 
    113     /**
    114     @brief
    115         Non-initialising constructor.
    116     */
    11778    Game::Game(const std::string& cmdLine)
    11879        // Destroy factories before the Core!
     
    12889#endif
    12990
     91        // reset statistics
     92        this->statisticsStartTime_ = 0;
     93        this->statisticsTickTimes_.clear();
     94        this->periodTickTime_ = 0;
     95        this->periodTime_ = 0;
     96        this->avgFPS_ = 0.0f;
     97        this->avgTickTime_ = 0.0f;
     98        this->excessSleepTime_ = 0;
     99
    130100        // Create an empty root state
    131101        this->declareGameState<GameState>("GameState", "emptyRootGameState", true, false);
     
    136106        // Create the Core
    137107        this->core_.reset(new Core(cmdLine));
     108
     109        // Do this after the Core creation!
     110        ClassIdentifier<Game>::getIdentifier("Game")->initialiseObject(this, "Game", true);
     111        this->setConfigValues();
    138112
    139113        // After the core has been created, we can safely instantiate the GameStates that don't require graphics
     
    150124        this->loadedTopStateNode_ = this->rootStateNode_;
    151125        this->loadedStates_.push_back(this->getState(rootStateNode_->name_));
    152 
    153         // Do this after the Core creation!
    154         this->configuration_.reset(new GameConfiguration());
    155126    }
    156127
     
    161132    Game::~Game()
    162133    {
     134        // Remove us from the object lists again to avoid problems when destroying them
     135        this->unregisterObject();
     136    }
     137
     138    void Game::setConfigValues()
     139    {
     140        SetConfigValue(statisticsRefreshCycle_, 250000)
     141            .description("Sets the time in microseconds interval at which average fps, etc. get updated.");
     142        SetConfigValue(statisticsAvgLength_, 1000000)
     143            .description("Sets the time in microseconds interval at which average fps, etc. gets calculated.");
     144        SetConfigValue(fpsLimit_, 50)
     145            .description("Sets the desired frame rate (0 for no limit).");
    163146    }
    164147
     
    176159            COUT(0) << "Warning: Starting game without requesting GameState. This automatically terminates the program." << std::endl;
    177160
    178         // reset statistics
    179         this->statisticsStartTime_ = 0;
    180         this->statisticsTickTimes_.clear();
    181         this->periodTickTime_ = 0;
    182         this->periodTime_ = 0;
    183         this->avgFPS_ = 0.0f;
    184         this->avgTickTime_ = 0.0f;
    185         this->excessSleepTime_ = 0;
    186 
    187161        // START GAME
    188162        // first delta time should be about 0 seconds
     
    204178            this->updateGameStateStack();
    205179
    206             // Core preUpdate (doesn't throw)
     180            // Core preUpdate
    207181            try
    208182                { this->core_->preUpdate(*this->gameClock_); }
     
    218192            this->updateGameStates();
    219193
    220             // Core postUpdate (doesn't throw)
     194            // Core postUpdate
    221195            try
    222196                { this->core_->postUpdate(*this->gameClock_); }
     
    232206            this->updateStatistics();
    233207
    234             // Limit framerate
     208            // Limit frame rate
    235209            this->updateFPSLimiter();
    236210        }
     
    312286        this->statisticsTickTimes_.back().tickLength += currentRealTime - currentTime;
    313287        this->periodTickTime_ += currentRealTime - currentTime;
    314         if (this->periodTime_ > this->configuration_->statisticsRefreshCycle_)
     288        if (this->periodTime_ > this->statisticsRefreshCycle_)
    315289        {
    316290            std::list<StatisticsTickInfo>::iterator it = this->statisticsTickTimes_.begin();
    317291            assert(it != this->statisticsTickTimes_.end());
    318             int64_t lastTime = currentTime - this->configuration_->statisticsAvgLength_;
     292            int64_t lastTime = currentTime - this->statisticsAvgLength_;
    319293            if (static_cast<int64_t>(it->tickTime) < lastTime)
    320294            {
     
    330304
    331305            uint32_t framesPerPeriod = this->statisticsTickTimes_.size();
    332             this->avgFPS_ = static_cast<float>(framesPerPeriod) / (currentTime - this->statisticsTickTimes_.front().tickTime) * 1000000.0f;
     306            // Why minus 1? No idea, but otherwise the fps rate is always (from 10 to 200!) one frame too low
     307            this->avgFPS_ = -1 + static_cast<float>(framesPerPeriod) / (currentTime - this->statisticsTickTimes_.front().tickTime) * 1000000.0f;
    333308            this->avgTickTime_ = static_cast<float>(this->periodTickTime_) / framesPerPeriod / 1000.0f;
    334309
    335             this->periodTime_ -= this->configuration_->statisticsRefreshCycle_;
     310            this->periodTime_ -= this->statisticsRefreshCycle_;
    336311        }
    337312    }
     
    339314    void Game::updateFPSLimiter()
    340315    {
    341         // Why configuration_->fpsLimit_ - 1? No idea, but otherwise the fps rate is always (from 10 to 200!) one frame too high
    342         uint32_t nextTime = gameClock_->getMicroseconds() - excessSleepTime_ + static_cast<uint32_t>(1000000.0f / (configuration_->fpsLimit_ - 1));
     316        uint64_t nextTime = gameClock_->getMicroseconds() - excessSleepTime_ + static_cast<uint32_t>(1000000.0f / fpsLimit_);
    343317        uint64_t currentRealTime = gameClock_->getRealMicroseconds();
    344318        while (currentRealTime < nextTime - minimumSleepTime_)
     
    584558
    585559        shared_ptr<GameState> state = this->getState(name);
    586         state->activate();
     560        state->activateInternal();
    587561        if (!this->loadedStates_.empty())
    588562            this->loadedStates_.back()->activity_.topState = false;
     
    603577            if (!this->loadedStates_.empty())
    604578                this->loadedStates_.back()->activity_.topState = true;
    605             state->deactivate();
     579            state->deactivateInternal();
    606580        }
    607581        catch (...)
  • code/trunk/src/libraries/core/Game.h

    r5929 r6417  
    5050#include "util/ScopeGuard.h"
    5151#include "util/Singleton.h"
     52#include "core/OrxonoxClass.h"
    5253
    5354/**
     
    5859#define DeclareGameState(className, stateName, bIgnoreTickTime, bGraphicsMode) \
    5960    static bool BOOST_PP_CAT(bGameStateDummy_##className, __LINE__) = orxonox::Game::declareGameState<className>(#className, stateName, bIgnoreTickTime, bGraphicsMode)
    60 
     61// tolua_begin
    6162namespace orxonox
    6263{
    63     class GameConfiguration;
     64// tolua_end
    6465
    6566    //! Helper object required before GameStates are being constructed
     
    7879        You should only create this singleton once because it owns the Core class! (see remark there)
    7980    */
    80     class _CoreExport Game : public Singleton<Game>
    81     {
     81// tolua_begin
     82    class _CoreExport Game
     83// tolua_end
     84        : public Singleton<Game>, public OrxonoxClass
     85    { // tolua_export
    8286        friend class Singleton<Game>;
    8387        typedef std::vector<shared_ptr<GameState> > GameStateVector;
     
    8993        ~Game();
    9094
     95        void setConfigValues();
     96
    9197        void setStateHierarchy(const std::string& str);
    9298        shared_ptr<GameState> getState(const std::string& name);
     
    95101        void stop();
    96102
    97         void requestState(const std::string& name);
    98         void requestStates(const std::string& names);
    99         void popState();
     103        static Game& getInstance(){ return Singleton<Game>::getInstance(); } // tolua_export
     104
     105        void requestState(const std::string& name); //tolua_export
     106        void requestStates(const std::string& names); //tolua_export
     107        void popState(); //tolua_export
    100108
    101109        const Clock& getGameClock() { return *this->gameClock_; }
     
    160168        scoped_ptr<Core>                   core_;
    161169        ObjScopeGuard                      gsFactoryDestroyer_;
    162         scoped_ptr<GameConfiguration>      configuration_;
    163170
    164171        GameStateMap                       constructedStates_;
     
    181188        unsigned int                       minimumSleepTime_;
    182189
     190        // config values
     191        unsigned int                       statisticsRefreshCycle_;
     192        unsigned int                       statisticsAvgLength_;
     193        unsigned int                       fpsLimit_;
     194
    183195        static std::map<std::string, GameStateInfo> gameStateDeclarations_s;
    184196        static Game* singletonPtr_s;        //!< Pointer to the Single