[Orxonox-commit 4998] r9667 - in code/trunk: . src src/libraries/core src/libraries/core/class src/libraries/core/command src/libraries/core/config src/libraries/core/input src/libraries/core/object src/libraries/network src/libraries/network/packet src/libraries/network/synchronisable src/libraries/tools src/libraries/tools/interfaces src/libraries/util src/modules/designtools src/modules/docking src/modules/gametypes src/modules/notifications src/modules/notifications/dispatchers src/modules/objects src/modules/objects/collisionshapes src/modules/objects/eventsystem src/modules/objects/triggers src/modules/overlays src/modules/overlays/debugging src/modules/overlays/hud src/modules/overlays/stats src/modules/pickup src/modules/pickup/items src/modules/pong src/modules/portals src/modules/questsystem src/modules/questsystem/effects src/modules/tetris src/modules/towerdefense src/modules/weapons src/modules/weapons/munitions src/modules/weapons/projectiles src/modules/weapons/weaponmodes src/orxonox src/orxonox/chat src/orxonox/collisionshapes src/orxonox/controllers src/orxonox/gamestates src/orxonox/gametypes src/orxonox/graphics src/orxonox/infos src/orxonox/interfaces src/orxonox/items src/orxonox/overlays src/orxonox/sound src/orxonox/weaponsystem src/orxonox/worldentities src/orxonox/worldentities/pawns test
landauf at orxonox.net
landauf at orxonox.net
Sun Aug 25 21:08:44 CEST 2013
Author: landauf
Date: 2013-08-25 21:08:42 +0200 (Sun, 25 Aug 2013)
New Revision: 9667
Added:
code/trunk/src/libraries/core/class/
code/trunk/src/libraries/core/class/OrxonoxClass.cc
code/trunk/src/libraries/core/class/OrxonoxInterface.cc
code/trunk/src/libraries/core/config/
code/trunk/src/libraries/core/config/Configurable.cc
code/trunk/src/libraries/core/object/
code/trunk/src/libraries/core/object/IteratorBase.h
code/trunk/test/core/
Removed:
code/trunk/src/libraries/core/ClassFactory.h
code/trunk/src/libraries/core/CommandLineParser.cc
code/trunk/src/libraries/core/CommandLineParser.h
code/trunk/src/libraries/core/ConfigFileManager.cc
code/trunk/src/libraries/core/ConfigFileManager.h
code/trunk/src/libraries/core/ConfigValueContainer.cc
code/trunk/src/libraries/core/ConfigValueContainer.h
code/trunk/src/libraries/core/ConfigValueIncludes.h
code/trunk/src/libraries/core/Identifier.cc
code/trunk/src/libraries/core/Identifier.h
code/trunk/src/libraries/core/Iterator.h
code/trunk/src/libraries/core/MetaObjectList.cc
code/trunk/src/libraries/core/MetaObjectList.h
code/trunk/src/libraries/core/ObjectList.h
code/trunk/src/libraries/core/ObjectListBase.cc
code/trunk/src/libraries/core/ObjectListBase.h
code/trunk/src/libraries/core/ObjectListIterator.h
code/trunk/src/libraries/core/OrxonoxClass.cc
code/trunk/src/libraries/core/OrxonoxClass.h
code/trunk/src/libraries/core/SmartPtr.h
code/trunk/src/libraries/core/SubclassIdentifier.h
code/trunk/src/libraries/core/Super.h
code/trunk/src/libraries/core/WeakPtr.h
code/trunk/src/libraries/core/object/MetaObjectList.cc
code/trunk/src/libraries/core/object/MetaObjectList.h
Modified:
code/trunk/
code/trunk/src/SourceConfig.cmake
code/trunk/src/libraries/core/BaseObject.cc
code/trunk/src/libraries/core/BaseObject.h
code/trunk/src/libraries/core/CMakeLists.txt
code/trunk/src/libraries/core/ClassTreeMask.cc
code/trunk/src/libraries/core/ClassTreeMask.h
code/trunk/src/libraries/core/Core.cc
code/trunk/src/libraries/core/Core.h
code/trunk/src/libraries/core/CoreIncludes.h
code/trunk/src/libraries/core/CorePrereqs.h
code/trunk/src/libraries/core/Event.cc
code/trunk/src/libraries/core/GUIManager.cc
code/trunk/src/libraries/core/GUIManager.h
code/trunk/src/libraries/core/Game.cc
code/trunk/src/libraries/core/Game.h
code/trunk/src/libraries/core/GraphicsManager.cc
code/trunk/src/libraries/core/GraphicsManager.h
code/trunk/src/libraries/core/Loader.cc
code/trunk/src/libraries/core/Namespace.cc
code/trunk/src/libraries/core/Namespace.h
code/trunk/src/libraries/core/PathConfig.cc
code/trunk/src/libraries/core/Template.cc
code/trunk/src/libraries/core/Template.h
code/trunk/src/libraries/core/ViewportEventListener.cc
code/trunk/src/libraries/core/ViewportEventListener.h
code/trunk/src/libraries/core/WindowEventListener.cc
code/trunk/src/libraries/core/WindowEventListener.h
code/trunk/src/libraries/core/XMLNameListener.cc
code/trunk/src/libraries/core/XMLNameListener.h
code/trunk/src/libraries/core/XMLPort.cc
code/trunk/src/libraries/core/XMLPort.h
code/trunk/src/libraries/core/class/CMakeLists.txt
code/trunk/src/libraries/core/class/Identifiable.cc
code/trunk/src/libraries/core/class/Identifiable.h
code/trunk/src/libraries/core/class/Identifier.cc
code/trunk/src/libraries/core/class/Identifier.h
code/trunk/src/libraries/core/class/IdentifierManager.cc
code/trunk/src/libraries/core/class/IdentifierManager.h
code/trunk/src/libraries/core/class/OrxonoxClass.h
code/trunk/src/libraries/core/class/OrxonoxInterface.h
code/trunk/src/libraries/core/class/SubclassIdentifier.h
code/trunk/src/libraries/core/class/Super.h
code/trunk/src/libraries/core/command/ArgumentCompletionFunctions.cc
code/trunk/src/libraries/core/command/Functor.h
code/trunk/src/libraries/core/command/IOConsolePOSIX.cc
code/trunk/src/libraries/core/command/IOConsoleWindows.cc
code/trunk/src/libraries/core/command/Shell.cc
code/trunk/src/libraries/core/command/Shell.h
code/trunk/src/libraries/core/config/CMakeLists.txt
code/trunk/src/libraries/core/config/ConfigValueContainer.h
code/trunk/src/libraries/core/config/Configurable.h
code/trunk/src/libraries/core/input/Button.cc
code/trunk/src/libraries/core/input/InputBuffer.cc
code/trunk/src/libraries/core/input/InputBuffer.h
code/trunk/src/libraries/core/input/InputManager.cc
code/trunk/src/libraries/core/input/JoyStick.cc
code/trunk/src/libraries/core/input/JoyStick.h
code/trunk/src/libraries/core/input/JoyStickQuantityListener.cc
code/trunk/src/libraries/core/input/JoyStickQuantityListener.h
code/trunk/src/libraries/core/input/KeyBinder.cc
code/trunk/src/libraries/core/input/KeyBinderManager.cc
code/trunk/src/libraries/core/input/KeyBinderManager.h
code/trunk/src/libraries/core/input/Mouse.cc
code/trunk/src/libraries/core/object/CMakeLists.txt
code/trunk/src/libraries/core/object/ClassFactory.h
code/trunk/src/libraries/core/object/Context.cc
code/trunk/src/libraries/core/object/Context.h
code/trunk/src/libraries/core/object/Iterator.h
code/trunk/src/libraries/core/object/Listable.cc
code/trunk/src/libraries/core/object/Listable.h
code/trunk/src/libraries/core/object/ObjectList.h
code/trunk/src/libraries/core/object/ObjectListBase.cc
code/trunk/src/libraries/core/object/ObjectListBase.h
code/trunk/src/libraries/core/object/ObjectListIterator.h
code/trunk/src/libraries/network/Client.cc
code/trunk/src/libraries/network/ClientConnectionListener.cc
code/trunk/src/libraries/network/ClientConnectionListener.h
code/trunk/src/libraries/network/Host.cc
code/trunk/src/libraries/network/NetworkChatListener.h
code/trunk/src/libraries/network/NetworkFunction.cc
code/trunk/src/libraries/network/NetworkFunction.h
code/trunk/src/libraries/network/Server.cc
code/trunk/src/libraries/network/TrafficControl.cc
code/trunk/src/libraries/network/WANDiscoverable.cc
code/trunk/src/libraries/network/WANDiscoverable.h
code/trunk/src/libraries/network/WANDiscovery.h
code/trunk/src/libraries/network/packet/ClassID.cc
code/trunk/src/libraries/network/packet/FunctionIDs.cc
code/trunk/src/libraries/network/packet/Gamestate.cc
code/trunk/src/libraries/network/synchronisable/Serialise.h
code/trunk/src/libraries/network/synchronisable/Synchronisable.cc
code/trunk/src/libraries/network/synchronisable/Synchronisable.h
code/trunk/src/libraries/tools/ParticleInterface.cc
code/trunk/src/libraries/tools/ResourceCollection.cc
code/trunk/src/libraries/tools/ResourceCollection.h
code/trunk/src/libraries/tools/ResourceLocation.cc
code/trunk/src/libraries/tools/ResourceLocation.h
code/trunk/src/libraries/tools/Shader.cc
code/trunk/src/libraries/tools/Timer.cc
code/trunk/src/libraries/tools/Timer.h
code/trunk/src/libraries/tools/interfaces/Tickable.h
code/trunk/src/libraries/tools/interfaces/TimeFactorListener.h
code/trunk/src/libraries/tools/interfaces/ToolsInterfaceCompilation.cc
code/trunk/src/libraries/util/ScopedSingletonManager.h
code/trunk/src/modules/designtools/CreateStars.cc
code/trunk/src/modules/designtools/CreateStars.h
code/trunk/src/modules/designtools/ScreenshotManager.cc
code/trunk/src/modules/designtools/ScreenshotManager.h
code/trunk/src/modules/designtools/SkyboxGenerator.cc
code/trunk/src/modules/designtools/SkyboxGenerator.h
code/trunk/src/modules/docking/Dock.cc
code/trunk/src/modules/docking/Dock.h
code/trunk/src/modules/docking/DockToShip.cc
code/trunk/src/modules/docking/DockToShip.h
code/trunk/src/modules/docking/DockingAnimation.cc
code/trunk/src/modules/docking/DockingAnimation.h
code/trunk/src/modules/docking/DockingController.cc
code/trunk/src/modules/docking/DockingController.h
code/trunk/src/modules/docking/DockingEffect.cc
code/trunk/src/modules/docking/DockingEffect.h
code/trunk/src/modules/docking/DockingPrecompiledHeaders.h
code/trunk/src/modules/docking/DockingTarget.cc
code/trunk/src/modules/docking/DockingTarget.h
code/trunk/src/modules/docking/MoveToDockingTarget.cc
code/trunk/src/modules/docking/MoveToDockingTarget.h
code/trunk/src/modules/gametypes/OldRaceCheckPoint.cc
code/trunk/src/modules/gametypes/OldRaceCheckPoint.h
code/trunk/src/modules/gametypes/OldSpaceRace.cc
code/trunk/src/modules/gametypes/OldSpaceRace.h
code/trunk/src/modules/gametypes/RaceCheckPoint.cc
code/trunk/src/modules/gametypes/RaceCheckPoint.h
code/trunk/src/modules/gametypes/SpaceRace.cc
code/trunk/src/modules/gametypes/SpaceRace.h
code/trunk/src/modules/gametypes/SpaceRaceBot.cc
code/trunk/src/modules/gametypes/SpaceRaceBot.h
code/trunk/src/modules/gametypes/SpaceRaceController.cc
code/trunk/src/modules/gametypes/SpaceRaceController.h
code/trunk/src/modules/gametypes/SpaceRaceManager.cc
code/trunk/src/modules/gametypes/SpaceRaceManager.h
code/trunk/src/modules/notifications/NotificationDispatcher.cc
code/trunk/src/modules/notifications/NotificationDispatcher.h
code/trunk/src/modules/notifications/NotificationManager.cc
code/trunk/src/modules/notifications/NotificationManager.h
code/trunk/src/modules/notifications/NotificationQueue.cc
code/trunk/src/modules/notifications/NotificationQueue.h
code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc
code/trunk/src/modules/notifications/NotificationQueueCEGUI.h
code/trunk/src/modules/notifications/dispatchers/CommandNotification.cc
code/trunk/src/modules/notifications/dispatchers/CommandNotification.h
code/trunk/src/modules/notifications/dispatchers/SimpleNotification.cc
code/trunk/src/modules/notifications/dispatchers/SimpleNotification.h
code/trunk/src/modules/objects/Attacher.cc
code/trunk/src/modules/objects/Attacher.h
code/trunk/src/modules/objects/ForceField.cc
code/trunk/src/modules/objects/ForceField.h
code/trunk/src/modules/objects/Planet.cc
code/trunk/src/modules/objects/Planet.h
code/trunk/src/modules/objects/Script.cc
code/trunk/src/modules/objects/Script.h
code/trunk/src/modules/objects/SpaceBoundaries.cc
code/trunk/src/modules/objects/SpaceBoundaries.h
code/trunk/src/modules/objects/Turret.cc
code/trunk/src/modules/objects/Turret.h
code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.cc
code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.h
code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.cc
code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.h
code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.cc
code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.h
code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.cc
code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.h
code/trunk/src/modules/objects/eventsystem/EventDispatcher.cc
code/trunk/src/modules/objects/eventsystem/EventDispatcher.h
code/trunk/src/modules/objects/eventsystem/EventFilter.cc
code/trunk/src/modules/objects/eventsystem/EventFilter.h
code/trunk/src/modules/objects/eventsystem/EventListener.cc
code/trunk/src/modules/objects/eventsystem/EventListener.h
code/trunk/src/modules/objects/eventsystem/EventName.cc
code/trunk/src/modules/objects/eventsystem/EventName.h
code/trunk/src/modules/objects/eventsystem/EventTarget.cc
code/trunk/src/modules/objects/eventsystem/EventTarget.h
code/trunk/src/modules/objects/triggers/CheckPoint.cc
code/trunk/src/modules/objects/triggers/CheckPoint.h
code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc
code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h
code/trunk/src/modules/objects/triggers/DistanceTrigger.cc
code/trunk/src/modules/objects/triggers/DistanceTrigger.h
code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.cc
code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.h
code/trunk/src/modules/objects/triggers/EventMultiTrigger.cc
code/trunk/src/modules/objects/triggers/EventMultiTrigger.h
code/trunk/src/modules/objects/triggers/EventTrigger.cc
code/trunk/src/modules/objects/triggers/EventTrigger.h
code/trunk/src/modules/objects/triggers/MultiTrigger.cc
code/trunk/src/modules/objects/triggers/MultiTrigger.h
code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc
code/trunk/src/modules/objects/triggers/MultiTriggerContainer.h
code/trunk/src/modules/objects/triggers/Trigger.cc
code/trunk/src/modules/objects/triggers/Trigger.h
code/trunk/src/modules/objects/triggers/TriggerBase.cc
code/trunk/src/modules/objects/triggers/TriggerBase.h
code/trunk/src/modules/overlays/FadeoutText.cc
code/trunk/src/modules/overlays/FadeoutText.h
code/trunk/src/modules/overlays/GUIOverlay.cc
code/trunk/src/modules/overlays/GUIOverlay.h
code/trunk/src/modules/overlays/OverlayText.cc
code/trunk/src/modules/overlays/OverlayText.h
code/trunk/src/modules/overlays/debugging/DebugFPSText.cc
code/trunk/src/modules/overlays/debugging/DebugFPSText.h
code/trunk/src/modules/overlays/debugging/DebugRTRText.cc
code/trunk/src/modules/overlays/debugging/DebugRTRText.h
code/trunk/src/modules/overlays/hud/AnnounceMessage.cc
code/trunk/src/modules/overlays/hud/AnnounceMessage.h
code/trunk/src/modules/overlays/hud/ChatOverlay.cc
code/trunk/src/modules/overlays/hud/ChatOverlay.h
code/trunk/src/modules/overlays/hud/DeathMessage.cc
code/trunk/src/modules/overlays/hud/DeathMessage.h
code/trunk/src/modules/overlays/hud/GametypeFadingMessage.cc
code/trunk/src/modules/overlays/hud/GametypeFadingMessage.h
code/trunk/src/modules/overlays/hud/GametypeStaticMessage.cc
code/trunk/src/modules/overlays/hud/GametypeStaticMessage.h
code/trunk/src/modules/overlays/hud/HUDBar.cc
code/trunk/src/modules/overlays/hud/HUDBar.h
code/trunk/src/modules/overlays/hud/HUDBoostBar.cc
code/trunk/src/modules/overlays/hud/HUDBoostBar.h
code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.cc
code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.h
code/trunk/src/modules/overlays/hud/HUDHealthBar.cc
code/trunk/src/modules/overlays/hud/HUDHealthBar.h
code/trunk/src/modules/overlays/hud/HUDNavigation.cc
code/trunk/src/modules/overlays/hud/HUDNavigation.h
code/trunk/src/modules/overlays/hud/HUDRadar.cc
code/trunk/src/modules/overlays/hud/HUDRadar.h
code/trunk/src/modules/overlays/hud/HUDSpeedBar.cc
code/trunk/src/modules/overlays/hud/HUDSpeedBar.h
code/trunk/src/modules/overlays/hud/HUDTimer.cc
code/trunk/src/modules/overlays/hud/HUDTimer.h
code/trunk/src/modules/overlays/hud/KillMessage.cc
code/trunk/src/modules/overlays/hud/KillMessage.h
code/trunk/src/modules/overlays/hud/LastManStandingInfos.cc
code/trunk/src/modules/overlays/hud/LastManStandingInfos.h
code/trunk/src/modules/overlays/hud/LastTeamStandingInfos.cc
code/trunk/src/modules/overlays/hud/LastTeamStandingInfos.h
code/trunk/src/modules/overlays/hud/PauseNotice.cc
code/trunk/src/modules/overlays/hud/PauseNotice.h
code/trunk/src/modules/overlays/hud/TeamBaseMatchScore.cc
code/trunk/src/modules/overlays/hud/TeamBaseMatchScore.h
code/trunk/src/modules/overlays/stats/Scoreboard.cc
code/trunk/src/modules/overlays/stats/Scoreboard.h
code/trunk/src/modules/overlays/stats/Stats.cc
code/trunk/src/modules/overlays/stats/Stats.h
code/trunk/src/modules/pickup/CollectiblePickup.cc
code/trunk/src/modules/pickup/Pickup.cc
code/trunk/src/modules/pickup/Pickup.h
code/trunk/src/modules/pickup/PickupCollection.cc
code/trunk/src/modules/pickup/PickupCollection.h
code/trunk/src/modules/pickup/PickupManager.cc
code/trunk/src/modules/pickup/PickupManager.h
code/trunk/src/modules/pickup/PickupRepresentation.cc
code/trunk/src/modules/pickup/PickupRepresentation.h
code/trunk/src/modules/pickup/PickupSpawner.cc
code/trunk/src/modules/pickup/PickupSpawner.h
code/trunk/src/modules/pickup/items/DamageBoostPickup.cc
code/trunk/src/modules/pickup/items/DamageBoostPickup.h
code/trunk/src/modules/pickup/items/DronePickup.cc
code/trunk/src/modules/pickup/items/DronePickup.h
code/trunk/src/modules/pickup/items/HealthPickup.cc
code/trunk/src/modules/pickup/items/HealthPickup.h
code/trunk/src/modules/pickup/items/InvisiblePickup.cc
code/trunk/src/modules/pickup/items/InvisiblePickup.h
code/trunk/src/modules/pickup/items/MetaPickup.cc
code/trunk/src/modules/pickup/items/MetaPickup.h
code/trunk/src/modules/pickup/items/ShieldPickup.cc
code/trunk/src/modules/pickup/items/ShieldPickup.h
code/trunk/src/modules/pickup/items/ShrinkPickup.cc
code/trunk/src/modules/pickup/items/ShrinkPickup.h
code/trunk/src/modules/pickup/items/SpeedPickup.cc
code/trunk/src/modules/pickup/items/SpeedPickup.h
code/trunk/src/modules/pong/Pong.cc
code/trunk/src/modules/pong/Pong.h
code/trunk/src/modules/pong/PongAI.cc
code/trunk/src/modules/pong/PongAI.h
code/trunk/src/modules/pong/PongBall.cc
code/trunk/src/modules/pong/PongBall.h
code/trunk/src/modules/pong/PongBat.cc
code/trunk/src/modules/pong/PongBat.h
code/trunk/src/modules/pong/PongBot.cc
code/trunk/src/modules/pong/PongBot.h
code/trunk/src/modules/pong/PongCenterpoint.cc
code/trunk/src/modules/pong/PongCenterpoint.h
code/trunk/src/modules/pong/PongScore.cc
code/trunk/src/modules/pong/PongScore.h
code/trunk/src/modules/portals/PortalEndPoint.cc
code/trunk/src/modules/portals/PortalEndPoint.h
code/trunk/src/modules/portals/PortalLink.cc
code/trunk/src/modules/portals/PortalLink.h
code/trunk/src/modules/questsystem/GlobalQuest.cc
code/trunk/src/modules/questsystem/GlobalQuest.h
code/trunk/src/modules/questsystem/LocalQuest.cc
code/trunk/src/modules/questsystem/LocalQuest.h
code/trunk/src/modules/questsystem/Quest.cc
code/trunk/src/modules/questsystem/Quest.h
code/trunk/src/modules/questsystem/QuestDescription.cc
code/trunk/src/modules/questsystem/QuestDescription.h
code/trunk/src/modules/questsystem/QuestEffect.cc
code/trunk/src/modules/questsystem/QuestEffect.h
code/trunk/src/modules/questsystem/QuestEffectBeacon.cc
code/trunk/src/modules/questsystem/QuestEffectBeacon.h
code/trunk/src/modules/questsystem/QuestHint.cc
code/trunk/src/modules/questsystem/QuestHint.h
code/trunk/src/modules/questsystem/QuestItem.cc
code/trunk/src/modules/questsystem/QuestItem.h
code/trunk/src/modules/questsystem/QuestListener.cc
code/trunk/src/modules/questsystem/QuestListener.h
code/trunk/src/modules/questsystem/QuestManager.cc
code/trunk/src/modules/questsystem/QuestManager.h
code/trunk/src/modules/questsystem/effects/AddQuest.cc
code/trunk/src/modules/questsystem/effects/AddQuest.h
code/trunk/src/modules/questsystem/effects/AddQuestHint.cc
code/trunk/src/modules/questsystem/effects/AddQuestHint.h
code/trunk/src/modules/questsystem/effects/AddReward.cc
code/trunk/src/modules/questsystem/effects/AddReward.h
code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.cc
code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.h
code/trunk/src/modules/questsystem/effects/CompleteQuest.cc
code/trunk/src/modules/questsystem/effects/CompleteQuest.h
code/trunk/src/modules/questsystem/effects/FailQuest.cc
code/trunk/src/modules/questsystem/effects/FailQuest.h
code/trunk/src/modules/tetris/Tetris.cc
code/trunk/src/modules/tetris/Tetris.h
code/trunk/src/modules/tetris/TetrisBrick.cc
code/trunk/src/modules/tetris/TetrisBrick.h
code/trunk/src/modules/tetris/TetrisCenterpoint.cc
code/trunk/src/modules/tetris/TetrisCenterpoint.h
code/trunk/src/modules/tetris/TetrisScore.cc
code/trunk/src/modules/tetris/TetrisScore.h
code/trunk/src/modules/tetris/TetrisStone.cc
code/trunk/src/modules/tetris/TetrisStone.h
code/trunk/src/modules/towerdefense/Tower.cc
code/trunk/src/modules/towerdefense/Tower.h
code/trunk/src/modules/towerdefense/TowerDefense.cc
code/trunk/src/modules/towerdefense/TowerDefense.h
code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.cc
code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.h
code/trunk/src/modules/towerdefense/TowerDefenseController.cc
code/trunk/src/modules/towerdefense/TowerDefenseController.h
code/trunk/src/modules/towerdefense/TowerDefenseHUDController.cc
code/trunk/src/modules/towerdefense/TowerDefenseHUDController.h
code/trunk/src/modules/weapons/MuzzleFlash.cc
code/trunk/src/modules/weapons/MuzzleFlash.h
code/trunk/src/modules/weapons/RocketController.cc
code/trunk/src/modules/weapons/RocketController.h
code/trunk/src/modules/weapons/munitions/FusionMunition.cc
code/trunk/src/modules/weapons/munitions/FusionMunition.h
code/trunk/src/modules/weapons/munitions/LaserMunition.cc
code/trunk/src/modules/weapons/munitions/LaserMunition.h
code/trunk/src/modules/weapons/munitions/ReplenishingMunition.cc
code/trunk/src/modules/weapons/munitions/ReplenishingMunition.h
code/trunk/src/modules/weapons/munitions/RocketMunition.cc
code/trunk/src/modules/weapons/munitions/RocketMunition.h
code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc
code/trunk/src/modules/weapons/projectiles/BasicProjectile.h
code/trunk/src/modules/weapons/projectiles/BillboardProjectile.cc
code/trunk/src/modules/weapons/projectiles/BillboardProjectile.h
code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc
code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.h
code/trunk/src/modules/weapons/projectiles/ParticleProjectile.cc
code/trunk/src/modules/weapons/projectiles/ParticleProjectile.h
code/trunk/src/modules/weapons/projectiles/Projectile.cc
code/trunk/src/modules/weapons/projectiles/Projectile.h
code/trunk/src/modules/weapons/projectiles/Rocket.cc
code/trunk/src/modules/weapons/projectiles/Rocket.h
code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc
code/trunk/src/modules/weapons/projectiles/SimpleRocket.h
code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc
code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.h
code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc
code/trunk/src/modules/weapons/weaponmodes/FusionFire.h
code/trunk/src/modules/weapons/weaponmodes/HsW01.cc
code/trunk/src/modules/weapons/weaponmodes/HsW01.h
code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc
code/trunk/src/modules/weapons/weaponmodes/LaserFire.h
code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc
code/trunk/src/modules/weapons/weaponmodes/LightningGun.h
code/trunk/src/modules/weapons/weaponmodes/RocketFire.cc
code/trunk/src/modules/weapons/weaponmodes/RocketFire.h
code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.h
code/trunk/src/orxonox/CameraManager.cc
code/trunk/src/orxonox/CameraManager.h
code/trunk/src/orxonox/Level.cc
code/trunk/src/orxonox/Level.h
code/trunk/src/orxonox/LevelInfo.cc
code/trunk/src/orxonox/LevelInfo.h
code/trunk/src/orxonox/LevelManager.cc
code/trunk/src/orxonox/LevelManager.h
code/trunk/src/orxonox/Main.cc
code/trunk/src/orxonox/MoodManager.cc
code/trunk/src/orxonox/MoodManager.h
code/trunk/src/orxonox/PawnManager.cc
code/trunk/src/orxonox/PlayerManager.cc
code/trunk/src/orxonox/Radar.cc
code/trunk/src/orxonox/Radar.h
code/trunk/src/orxonox/Scene.cc
code/trunk/src/orxonox/Scene.h
code/trunk/src/orxonox/Test.cc
code/trunk/src/orxonox/Test.h
code/trunk/src/orxonox/chat/ChatHistory.cc
code/trunk/src/orxonox/chat/ChatListener.h
code/trunk/src/orxonox/chat/ChatManager.cc
code/trunk/src/orxonox/collisionshapes/CollisionShape.cc
code/trunk/src/orxonox/collisionshapes/CollisionShape.h
code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.cc
code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.h
code/trunk/src/orxonox/collisionshapes/WorldEntityCollisionShape.cc
code/trunk/src/orxonox/collisionshapes/WorldEntityCollisionShape.h
code/trunk/src/orxonox/controllers/AIController.cc
code/trunk/src/orxonox/controllers/AIController.h
code/trunk/src/orxonox/controllers/ArtificialController.cc
code/trunk/src/orxonox/controllers/ArtificialController.h
code/trunk/src/orxonox/controllers/Controller.cc
code/trunk/src/orxonox/controllers/Controller.h
code/trunk/src/orxonox/controllers/DroneController.cc
code/trunk/src/orxonox/controllers/DroneController.h
code/trunk/src/orxonox/controllers/FormationController.cc
code/trunk/src/orxonox/controllers/FormationController.h
code/trunk/src/orxonox/controllers/HumanController.cc
code/trunk/src/orxonox/controllers/HumanController.h
code/trunk/src/orxonox/controllers/NewHumanController.cc
code/trunk/src/orxonox/controllers/NewHumanController.h
code/trunk/src/orxonox/controllers/ScriptController.cc
code/trunk/src/orxonox/controllers/ScriptController.h
code/trunk/src/orxonox/controllers/WaypointController.cc
code/trunk/src/orxonox/controllers/WaypointController.h
code/trunk/src/orxonox/controllers/WaypointPatrolController.cc
code/trunk/src/orxonox/controllers/WaypointPatrolController.h
code/trunk/src/orxonox/gamestates/GSClient.cc
code/trunk/src/orxonox/gamestates/GSLevel.h
code/trunk/src/orxonox/gamestates/GSMainMenu.cc
code/trunk/src/orxonox/gamestates/GSMainMenu.h
code/trunk/src/orxonox/gamestates/GSServer.cc
code/trunk/src/orxonox/gametypes/Asteroids.cc
code/trunk/src/orxonox/gametypes/Asteroids.h
code/trunk/src/orxonox/gametypes/Deathmatch.cc
code/trunk/src/orxonox/gametypes/Deathmatch.h
code/trunk/src/orxonox/gametypes/Dynamicmatch.cc
code/trunk/src/orxonox/gametypes/Dynamicmatch.h
code/trunk/src/orxonox/gametypes/Gametype.cc
code/trunk/src/orxonox/gametypes/Gametype.h
code/trunk/src/orxonox/gametypes/LastManStanding.cc
code/trunk/src/orxonox/gametypes/LastManStanding.h
code/trunk/src/orxonox/gametypes/LastTeamStanding.cc
code/trunk/src/orxonox/gametypes/LastTeamStanding.h
code/trunk/src/orxonox/gametypes/Mission.cc
code/trunk/src/orxonox/gametypes/Mission.h
code/trunk/src/orxonox/gametypes/TeamBaseMatch.cc
code/trunk/src/orxonox/gametypes/TeamBaseMatch.h
code/trunk/src/orxonox/gametypes/TeamDeathmatch.cc
code/trunk/src/orxonox/gametypes/TeamDeathmatch.h
code/trunk/src/orxonox/gametypes/TeamGametype.cc
code/trunk/src/orxonox/gametypes/TeamGametype.h
code/trunk/src/orxonox/gametypes/UnderAttack.cc
code/trunk/src/orxonox/gametypes/UnderAttack.h
code/trunk/src/orxonox/graphics/AnimatedModel.cc
code/trunk/src/orxonox/graphics/AnimatedModel.h
code/trunk/src/orxonox/graphics/Backlight.cc
code/trunk/src/orxonox/graphics/Backlight.h
code/trunk/src/orxonox/graphics/Billboard.cc
code/trunk/src/orxonox/graphics/Billboard.h
code/trunk/src/orxonox/graphics/BlinkingBillboard.cc
code/trunk/src/orxonox/graphics/BlinkingBillboard.h
code/trunk/src/orxonox/graphics/Camera.cc
code/trunk/src/orxonox/graphics/Camera.h
code/trunk/src/orxonox/graphics/FadingBillboard.cc
code/trunk/src/orxonox/graphics/FadingBillboard.h
code/trunk/src/orxonox/graphics/GlobalShader.cc
code/trunk/src/orxonox/graphics/GlobalShader.h
code/trunk/src/orxonox/graphics/Light.cc
code/trunk/src/orxonox/graphics/Light.h
code/trunk/src/orxonox/graphics/MeshLodInformation.cc
code/trunk/src/orxonox/graphics/MeshLodInformation.h
code/trunk/src/orxonox/graphics/Model.cc
code/trunk/src/orxonox/graphics/Model.h
code/trunk/src/orxonox/graphics/ParticleEmitter.cc
code/trunk/src/orxonox/graphics/ParticleEmitter.h
code/trunk/src/orxonox/graphics/ParticleSpawner.cc
code/trunk/src/orxonox/graphics/ParticleSpawner.h
code/trunk/src/orxonox/infos/Bot.cc
code/trunk/src/orxonox/infos/Bot.h
code/trunk/src/orxonox/infos/GametypeInfo.cc
code/trunk/src/orxonox/infos/GametypeInfo.h
code/trunk/src/orxonox/infos/HumanPlayer.cc
code/trunk/src/orxonox/infos/HumanPlayer.h
code/trunk/src/orxonox/infos/Info.cc
code/trunk/src/orxonox/infos/Info.h
code/trunk/src/orxonox/infos/PlayerInfo.cc
code/trunk/src/orxonox/infos/PlayerInfo.h
code/trunk/src/orxonox/interfaces/GametypeMessageListener.h
code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc
code/trunk/src/orxonox/interfaces/NotificationListener.cc
code/trunk/src/orxonox/interfaces/NotificationListener.h
code/trunk/src/orxonox/interfaces/PickupCarrier.cc
code/trunk/src/orxonox/interfaces/PickupCarrier.h
code/trunk/src/orxonox/interfaces/PickupListener.cc
code/trunk/src/orxonox/interfaces/PickupListener.h
code/trunk/src/orxonox/interfaces/Pickupable.cc
code/trunk/src/orxonox/interfaces/Pickupable.h
code/trunk/src/orxonox/interfaces/PlayerTrigger.h
code/trunk/src/orxonox/interfaces/RadarListener.h
code/trunk/src/orxonox/interfaces/RadarViewable.cc
code/trunk/src/orxonox/interfaces/RadarViewable.h
code/trunk/src/orxonox/interfaces/Rewardable.h
code/trunk/src/orxonox/interfaces/TeamColourable.h
code/trunk/src/orxonox/items/Engine.cc
code/trunk/src/orxonox/items/Engine.h
code/trunk/src/orxonox/items/Item.cc
code/trunk/src/orxonox/items/Item.h
code/trunk/src/orxonox/items/MultiStateEngine.cc
code/trunk/src/orxonox/items/MultiStateEngine.h
code/trunk/src/orxonox/overlays/GUISheet.cc
code/trunk/src/orxonox/overlays/GUISheet.h
code/trunk/src/orxonox/overlays/InGameConsole.cc
code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc
code/trunk/src/orxonox/overlays/OrxonoxOverlay.h
code/trunk/src/orxonox/overlays/OverlayGroup.cc
code/trunk/src/orxonox/overlays/OverlayGroup.h
code/trunk/src/orxonox/sound/BaseSound.cc
code/trunk/src/orxonox/sound/BaseSound.h
code/trunk/src/orxonox/sound/SoundManager.cc
code/trunk/src/orxonox/sound/SoundManager.h
code/trunk/src/orxonox/sound/WorldAmbientSound.cc
code/trunk/src/orxonox/sound/WorldAmbientSound.h
code/trunk/src/orxonox/sound/WorldSound.cc
code/trunk/src/orxonox/sound/WorldSound.h
code/trunk/src/orxonox/weaponsystem/DefaultWeaponmodeLink.cc
code/trunk/src/orxonox/weaponsystem/DefaultWeaponmodeLink.h
code/trunk/src/orxonox/weaponsystem/Munition.cc
code/trunk/src/orxonox/weaponsystem/Munition.h
code/trunk/src/orxonox/weaponsystem/Weapon.cc
code/trunk/src/orxonox/weaponsystem/Weapon.h
code/trunk/src/orxonox/weaponsystem/WeaponMode.cc
code/trunk/src/orxonox/weaponsystem/WeaponMode.h
code/trunk/src/orxonox/weaponsystem/WeaponPack.cc
code/trunk/src/orxonox/weaponsystem/WeaponPack.h
code/trunk/src/orxonox/weaponsystem/WeaponSet.cc
code/trunk/src/orxonox/weaponsystem/WeaponSet.h
code/trunk/src/orxonox/weaponsystem/WeaponSlot.cc
code/trunk/src/orxonox/weaponsystem/WeaponSlot.h
code/trunk/src/orxonox/weaponsystem/WeaponSystem.cc
code/trunk/src/orxonox/weaponsystem/WeaponSystem.h
code/trunk/src/orxonox/worldentities/BigExplosion.cc
code/trunk/src/orxonox/worldentities/BigExplosion.h
code/trunk/src/orxonox/worldentities/CameraPosition.cc
code/trunk/src/orxonox/worldentities/CameraPosition.h
code/trunk/src/orxonox/worldentities/ControllableEntity.cc
code/trunk/src/orxonox/worldentities/ControllableEntity.h
code/trunk/src/orxonox/worldentities/Drone.cc
code/trunk/src/orxonox/worldentities/Drone.h
code/trunk/src/orxonox/worldentities/EffectContainer.cc
code/trunk/src/orxonox/worldentities/EffectContainer.h
code/trunk/src/orxonox/worldentities/ExplosionChunk.cc
code/trunk/src/orxonox/worldentities/ExplosionChunk.h
code/trunk/src/orxonox/worldentities/MobileEntity.cc
code/trunk/src/orxonox/worldentities/MobileEntity.h
code/trunk/src/orxonox/worldentities/MovableEntity.cc
code/trunk/src/orxonox/worldentities/MovableEntity.h
code/trunk/src/orxonox/worldentities/SpawnPoint.cc
code/trunk/src/orxonox/worldentities/SpawnPoint.h
code/trunk/src/orxonox/worldentities/StaticEntity.cc
code/trunk/src/orxonox/worldentities/StaticEntity.h
code/trunk/src/orxonox/worldentities/TeamSpawnPoint.cc
code/trunk/src/orxonox/worldentities/TeamSpawnPoint.h
code/trunk/src/orxonox/worldentities/WorldEntity.cc
code/trunk/src/orxonox/worldentities/WorldEntity.h
code/trunk/src/orxonox/worldentities/pawns/Destroyer.cc
code/trunk/src/orxonox/worldentities/pawns/Destroyer.h
code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.cc
code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.h
code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
code/trunk/src/orxonox/worldentities/pawns/Pawn.h
code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc
code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h
code/trunk/src/orxonox/worldentities/pawns/Spectator.cc
code/trunk/src/orxonox/worldentities/pawns/Spectator.h
code/trunk/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc
code/trunk/src/orxonox/worldentities/pawns/TeamBaseMatchBase.h
code/trunk/test/CMakeLists.txt
Log:
merged core6 back to trunk
Property changes on: code/trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/Racingbot:9388-9513
/code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/core6:9594
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/formationupdate:9580-9624
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hud:8883-8986
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/largeShip1:9384-9515
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/newlevel2012:9033-9244
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/pCuts:9023-9284
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup2012:9029-9189
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation2012:9189-9268
/code/branches/presentation2012merge:9266-9347
/code/branches/presentation3:6913-7162
/code/branches/presentationHS12:9481-9525
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/shipSelection:9038-9206
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound2012:9205-9214
/code/branches/sound3:5941-6102
/code/branches/spaceNavigation:9381-9497
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/steering:5949-6091,8140-8595
/code/branches/surfaceRace:9028-9199
/code/branches/testing:9015-9549
/code/branches/tetris:8100-8563
/code/branches/turret:9380-9501
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
+ /code/branches/Racingbot:9388-9513
/code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/core6:9552-9666
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/formationupdate:9580-9624
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hud:8883-8986
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/largeShip1:9384-9515
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/newlevel2012:9033-9244
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/pCuts:9023-9284
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup2012:9029-9189
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation2012:9189-9268
/code/branches/presentation2012merge:9266-9347
/code/branches/presentation3:6913-7162
/code/branches/presentationHS12:9481-9525
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/shipSelection:9038-9206
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound2012:9205-9214
/code/branches/sound3:5941-6102
/code/branches/spaceNavigation:9381-9497
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/steering:5949-6091,8140-8595
/code/branches/surfaceRace:9028-9199
/code/branches/testing:9015-9549
/code/branches/tetris:8100-8563
/code/branches/turret:9380-9501
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
Modified: code/trunk/src/SourceConfig.cmake
===================================================================
--- code/trunk/src/SourceConfig.cmake 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/SourceConfig.cmake 2013-08-25 19:08:42 UTC (rev 9667)
@@ -98,10 +98,10 @@
# All includes in "externals" should be prefixed with the path
# relative to "external" to avoid conflicts
- ${CMAKE_CURRENT_SOURCE_DIR}/external
+ ../src/external
# Include directories needed even if only included by Orxonox
- ${CMAKE_CURRENT_SOURCE_DIR}/external/bullet
- ${CMAKE_CURRENT_SOURCE_DIR}/external/ois
+ ../src/external/bullet
+ ../src/external/ois
# External
${OGRE_INCLUDE_DIR}
Modified: code/trunk/src/libraries/core/BaseObject.cc
===================================================================
--- code/trunk/src/libraries/core/BaseObject.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/BaseObject.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,23 +38,25 @@
#include "CoreIncludes.h"
#include "Event.h"
#include "EventIncludes.h"
-#include "Iterator.h"
#include "Template.h"
#include "XMLFile.h"
#include "XMLNameListener.h"
#include "XMLPort.h"
#include "command/Functor.h"
+#include "object/Iterator.h"
+#include "class/OrxonoxInterface.h" // we include this only to include OrxonoxInterface.h at least once in core to keep MSVC happy...
+
namespace orxonox
{
- CreateFactory(BaseObject);
+ RegisterClass(BaseObject);
/**
@brief Constructor: Registers the object in the BaseObject-list.
*/
- BaseObject::BaseObject(BaseObject* creator) : bInitialized_(false)
+ BaseObject::BaseObject(Context* context) : bInitialized_(false)
{
- RegisterRootObject(BaseObject);
+ RegisterObject(BaseObject);
this->bInitialized_ = true;
@@ -67,6 +69,10 @@
this->mainStateFunctor_ = 0;
+ if (context)
+ this->setContext(context);
+
+ BaseObject* creator = orxonox_cast<BaseObject*>(context);
this->setCreator(creator);
if (this->creator_)
{
@@ -198,7 +204,7 @@
if (temp->isLink())
{
this->networkTemplateNames_.insert(temp->getLink());
-
+
Template* link;
assert(!(link = Template::getTemplate(temp->getLink())) || !link->isLink());
link = NULL;
Modified: code/trunk/src/libraries/core/BaseObject.h
===================================================================
--- code/trunk/src/libraries/core/BaseObject.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/BaseObject.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -48,9 +48,9 @@
#include <list>
#include "util/mbool.h"
-#include "OrxonoxClass.h"
-#include "Super.h"
-#include "SmartPtr.h"
+#include "class/OrxonoxClass.h"
+#include "class/Super.h"
+#include "object/SmartPtr.h"
namespace orxonox
{
@@ -59,12 +59,12 @@
class Level;
/// The BaseObject is the parent of all classes representing an instance in the game.
- class _CoreExport BaseObject : virtual public OrxonoxClass
+ class _CoreExport BaseObject : public OrxonoxClass
{
template <class T> friend class XMLPortClassParamContainer;
public:
- BaseObject(BaseObject* creator);
+ BaseObject(Context* context);
virtual ~BaseObject();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/libraries/core/CMakeLists.txt
===================================================================
--- code/trunk/src/libraries/core/CMakeLists.txt 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/CMakeLists.txt 2013-08-25 19:08:42 UTC (rev 9667)
@@ -21,23 +21,17 @@
#BUILD_UNIT CoreStableBuildUnit.cc
ClassTreeMask.cc
- CommandLineParser.cc
- ConfigValueContainer.cc
DynLib.cc
DynLibManager.cc
Event.cc
Game.cc
GameMode.cc
GameState.cc
- Identifier.cc
Language.cc
Loader.cc
LuaState.cc
- MetaObjectList.cc
Namespace.cc
NamespaceNode.cc
- ObjectListBase.cc
- OrxonoxClass.cc
Template.cc
ViewportEventListener.cc
WindowEventListener.cc
@@ -56,7 +50,7 @@
BUILD_UNIT FilesystemBuildUnit.cc
command/ArgumentCompletionFunctions.cc
- ConfigFileManager.cc
+ config/ConfigFile.cc
PathConfig.cc
END_BUILD_UNIT
@@ -67,14 +61,17 @@
END_BUILD_UNIT
)
+ADD_SUBDIRECTORY(class)
ADD_SUBDIRECTORY(command)
+ADD_SUBDIRECTORY(config)
ADD_SUBDIRECTORY(input)
+ADD_SUBDIRECTORY(object)
ORXONOX_ADD_LIBRARY(core
FIND_HEADER_FILES
TOLUA_FILES
command/CommandExecutor.h
- ConfigFileManager.h
+ config/SettingsConfigFile.h
Game.h
GameMode.h
GraphicsManager.h
Deleted: code/trunk/src/libraries/core/ClassFactory.h
===================================================================
--- code/trunk/src/libraries/core/ClassFactory.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/ClassFactory.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,91 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @ingroup Object Factory
- @brief Definition and implementation of the ClassFactory class
-
- The ClassFactory is able to create new objects of a specific class which creates objects.
-*/
-
-#ifndef _ClassFactory_H__
-#define _ClassFactory_H__
-
-#include "CorePrereqs.h"
-
-#include <string>
-
-#include "util/Output.h"
-#include "Identifier.h"
-
-namespace orxonox
-{
- // ###########################
- // ### Factory ###
- // ###########################
- /// Base-class of ClassFactory.
- class _CoreExport Factory
- {
- public:
- virtual ~Factory() {};
- virtual BaseObject* fabricate(BaseObject* creator) = 0;
- };
-
- // ###############################
- // ### ClassFactory ###
- // ###############################
- /// The ClassFactory is able to create new objects of a specific class.
- template <class T>
- class ClassFactory : public Factory
- {
- public:
- /**
- @brief Constructor: Adds the ClassFactory to the Identifier of the same type.
- @param name The name of the class
- @param bLoadable True if the class can be loaded through XML
- */
- ClassFactory(const std::string& name, bool bLoadable = true)
- {
- orxout(verbose, context::misc::factory) << "Create entry for " << name << " in Factory." << endl;
- ClassIdentifier<T>::getIdentifier(name)->addFactory(this);
- ClassIdentifier<T>::getIdentifier()->setLoadable(bLoadable);
- }
-
- /**
- @brief Creates and returns a new object of class T.
- @return The new object
- */
- inline BaseObject* fabricate(BaseObject* creator)
- {
- return static_cast<BaseObject*>(new T(creator));
- }
- };
-}
-
-#endif /* _ClassFactory_H__ */
Modified: code/trunk/src/libraries/core/ClassTreeMask.cc
===================================================================
--- code/trunk/src/libraries/core/ClassTreeMask.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/ClassTreeMask.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,7 +32,7 @@
*/
#include "ClassTreeMask.h"
-#include "Identifier.h"
+#include "class/Identifier.h"
namespace orxonox
{
@@ -848,7 +848,7 @@
// If there is a first subclass, move the object-iterator to the first object of this class. Else go to the end
if (this->subclassIterator_ != this->subclasses_.end())
- this->objectIterator_ = this->subclassIterator_->first->getObjects()->begin();
+ this->objectIterator_ = Context::getRootContext()->getObjectList(this->subclassIterator_->first)->begin();
else
this->objectIterator_ = ObjectList<BaseObject>::end();
@@ -880,7 +880,7 @@
// Check if there really is a next class. If yes, move the object-iterator to the first object
if (this->subclassIterator_ != this->subclasses_.end())
- this->objectIterator_ = this->subclassIterator_->first->getObjects()->begin();
+ this->objectIterator_ = Context::getRootContext()->getObjectList(this->subclassIterator_->first)->begin();
else
return (*this);
}
Modified: code/trunk/src/libraries/core/ClassTreeMask.h
===================================================================
--- code/trunk/src/libraries/core/ClassTreeMask.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/ClassTreeMask.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -72,7 +72,7 @@
#include <list>
#include <stack>
#include "BaseObject.h"
-#include "Iterator.h"
+#include "object/Iterator.h"
namespace orxonox
{
Deleted: code/trunk/src/libraries/core/CommandLineParser.cc
===================================================================
--- code/trunk/src/libraries/core/CommandLineParser.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/CommandLineParser.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,340 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#include "CommandLineParser.h"
-
-#include <algorithm>
-#include <sstream>
-
-#include "util/Convert.h"
-#include "util/Output.h"
-#include "util/Exception.h"
-#include "util/StringUtils.h"
-#include "util/SubString.h"
-#include "PathConfig.h"
-
-namespace orxonox
-{
- /**
- @brief
- Parses a value string for a command line argument.
- It simply uses convertValue(Output, Input) to do that.
- Bools are treated specially. That is necessary
- so that you can have simple command line switches.
- */
- void CommandLineArgument::parse(const std::string& value)
- {
- if (value_.isType<bool>())
- {
- // simulate command line switch
- bool temp;
- if (convertValue(&temp, value))
- {
- this->bHasDefaultValue_ = false;
- this->value_ = temp;
- }
- else if (value.empty())
- {
- this->bHasDefaultValue_ = false;
- this->value_ = true;
- }
- else
- ThrowException(Argument, "Could not read command line argument '" + getName() + "'.");
- }
- else
- {
- if (!value_.set(value))
- {
- value_.set(defaultValue_);
- ThrowException(Argument, "Could not read command line argument '" + getName() + "'.");
- }
- else
- this->bHasDefaultValue_ = false;
- }
- }
-
-
- /**
- @brief
- Destructor destroys all CommandLineArguments with it.
- */
- CommandLineParser::~CommandLineParser()
- {
- CommandLineParser::destroyAllArguments();
- }
-
- /**
- @brief
- Returns a unique instance (Meyers Singleton).
- */
- CommandLineParser& CommandLineParser::_getInstance()
- {
- static CommandLineParser instance;
- return instance;
- }
-
- /**
- @brief
- Destroys all command line arguments. This should be called at the end
- of main. Do not use before that.
- */
- void CommandLineParser::destroyAllArguments()
- {
- for (std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.begin();
- it != _getInstance().cmdLineArgs_.end(); ++it)
- delete it->second;
- _getInstance().cmdLineArgs_.clear();
- }
-
- /** Parses the command line string for arguments and stores these.
- @note
- The reason that you have to provide the string to be parsed as
- space separated list is because of argc and argv. If you only have
- a whole string, simply use getAllStrings() of SubString.
- @param cmdLine
- Command line string WITHOUT the execution path.
- */
- void CommandLineParser::_parse(const std::string& cmdLine)
- {
- std::vector<std::string> arguments;
- SubString tokens(cmdLine, " ", " ", false, '\\', true, '"', true, '\0', '\0', false);
- for (unsigned i = 0; i < tokens.size(); ++i)
- arguments.push_back(tokens[i]);
-
- try
- {
- // why this? See bFirstTimeParse_ declaration.
- if (bFirstTimeParse_)
- {
- // first shove all the shortcuts in a map
- for (std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.begin();
- it != cmdLineArgs_.end(); ++it)
- {
- OrxAssert(cmdLineArgsShortcut_.find(it->second->getShortcut()) == cmdLineArgsShortcut_.end(),
- "Cannot have two command line shortcut with the same name.");
- if (!it->second->getShortcut().empty())
- cmdLineArgsShortcut_[it->second->getShortcut()] = it->second;
- }
- bFirstTimeParse_ = false;
- }
-
- std::string name;
- std::string shortcut;
- std::string value;
- for (unsigned int i = 0; i < arguments.size(); ++i)
- {
- if (arguments[i].size() != 0)
- {
- // sure not ""
- if (arguments[i][0] == '-')
- {
- // start with "-"
- if (arguments[i].size() == 1)
- {
- // argument[i] is "-", probably a minus sign
- value += "- ";
- }
- else if (arguments[i][1] <= 57 && arguments[i][1] >= 48)
- {
- // negative number as a value
- value += arguments[i] + ' ';
- }
- else
- {
- // can be shortcut or full name argument
-
- // save old data first
- value = removeTrailingWhitespaces(value);
- if (!name.empty())
- {
- checkFullArgument(name, value);
- name.clear();
- assert(shortcut.empty());
- }
- else if (!shortcut.empty())
- {
- checkShortcut(shortcut, value);
- shortcut.clear();
- assert(name.empty());
- }
-
- if (arguments[i][1] == '-')
- {
- // full name argument with "--name"
- name = arguments[i].substr(2);
- }
- else
- {
- // shortcut with "-s"
- shortcut = arguments[i].substr(1);
- }
-
- // reset value string
- value.clear();
- }
- }
- else
- {
- // value string
-
- if (name.empty() && shortcut.empty())
- {
- ThrowException(Argument, "Expected \"-\" or \"-\" in command line arguments.\n");
- }
-
- // Concatenate strings as long as there's no new argument by "-" or "--"
- value += arguments[i] + ' ';
- }
- }
- }
-
- // parse last argument
- value = removeTrailingWhitespaces(value);
- if (!name.empty())
- {
- checkFullArgument(name, value);
- assert(shortcut.empty());
- }
- else if (!shortcut.empty())
- {
- checkShortcut(shortcut, value);
- assert(name.empty());
- }
- }
- catch (const ArgumentException& ex)
- {
- orxout(user_error) << "Could not parse command line: " << ex.what() << endl;
- orxout(user_error) << CommandLineParser::getUsageInformation() << endl;
- throw GeneralException("");
- }
- }
-
- /**
- @brief
- Parses an argument based on its full name.
- @param name
- Full name of the argument
- @param value
- String containing the value
- @param bParsingFile
- Parsing a file or the command line itself
- */
- void CommandLineParser::checkFullArgument(const std::string& name, const std::string& value)
- {
- std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.find(name);
- if (it == cmdLineArgs_.end())
- ThrowException(Argument, "Command line argument '" + name + "' does not exist.");
-
- it->second->parse(value);
- }
-
- /**
- @brief
- Parses an argument based on its shortcut.
- @param shortcut
- Shortcut to the argument
- @param value
- String containing the value
- @param bParsingFile
- Parsing a file or the command line itself
- */
- void CommandLineParser::checkShortcut(const std::string& shortcut, const std::string& value)
- {
- std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgsShortcut_.find(shortcut);
- if (it == cmdLineArgsShortcut_.end())
- ThrowException(Argument, "Command line shortcut '" + shortcut + "' does not exist.");
-
- it->second->parse(value);
- }
-
- std::string CommandLineParser::getUsageInformation()
- {
- CommandLineParser& inst = _getInstance();
- std::ostringstream infoStr;
-
- // determine maximum name size
- size_t maxNameSize = 0;
- for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
- it != inst.cmdLineArgs_.end(); ++it)
- {
- maxNameSize = std::max(it->second->getName().size(), maxNameSize);
- }
-
- infoStr << endl;
- infoStr << "Usage: orxonox [options]" << endl;
- infoStr << "Available options:" << endl;
-
- for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
- it != inst.cmdLineArgs_.end(); ++it)
- {
- if (!it->second->getShortcut().empty())
- infoStr << " [-" << it->second->getShortcut() << "] ";
- else
- infoStr << " ";
- infoStr << "--" << it->second->getName() << ' ';
- if (it->second->getValue().isType<bool>())
- infoStr << " ";
- else
- infoStr << "ARG ";
- // fill with the necessary amount of blanks
- infoStr << std::string(maxNameSize - it->second->getName().size(), ' ');
- infoStr << ": " << it->second->getInformation();
- infoStr << endl;
- }
- return infoStr.str();
- }
-
- void CommandLineParser::generateDoc(std::ofstream& file)
- {
- file << "/** @page cmdargspage Command Line Arguments Reference" << endl;
- file << " @verbatim"; /*no endl*/
- file << getUsageInformation(); /*no endl*/
- file << " @endverbatim" << endl;
- file << "*/" << endl;
- }
-
- /**
- @brief
- Retrieves a CommandLineArgument.
- The method throws an exception if 'name' was not found or the value could not be converted.
- @note
- You should of course not call this method before the command line has been parsed.
- */
- const CommandLineArgument* CommandLineParser::getArgument(const std::string& name)
- {
- std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.find(name);
- if (it == _getInstance().cmdLineArgs_.end())
- {
- ThrowException(Argument, "Could find command line argument '" + name + "'.");
- }
- else
- {
- return it->second;
- }
- }
-}
Deleted: code/trunk/src/libraries/core/CommandLineParser.h
===================================================================
--- code/trunk/src/libraries/core/CommandLineParser.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/CommandLineParser.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,227 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-/**
- @defgroup CmdArgs Commandline arguments
- @ingroup Config
- @brief For a reference of all commandline arguments see @ref cmdargspage
-*/
-
-/**
- @file
- @ingroup Config CmdArgs
- @brief Declaration of CommandLineParser and CommandLineArgument, definition of the SetCommandLineArgument() macros.
-*/
-
-#ifndef _CommandLine_H__
-#define _CommandLine_H__
-
-#include "CorePrereqs.h"
-
-#include <fstream>
-#include <map>
-#include "util/OrxAssert.h"
-#include "util/MultiType.h"
-
-#define SetCommandLineArgument(name, defaultValue) \
- orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
- = orxonox::CommandLineParser::addArgument(#name, defaultValue)
-#define SetCommandLineSwitch(name) \
- orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
- = orxonox::CommandLineParser::addArgument(#name, false)
-
-namespace orxonox
-{
- /**
- @brief
- Container class for a command line argument of any type supported by MultiType.
-
- Whenever you want to have an option specified by a command line switch,
- you need to first define it with SetCommandLineArgument(name, defaultValue).
- It is then added to a map and possibly changed when the command line is being parsed.
- If the option was not given, you can detect this by asking hasDefaultValue().
-
- There is a possibility to define a short cut so you can write "-p 20" instead of "--port 20".
- Note the difference between "-" and "--"!
- Also, there is no restriction to the number of strings you add after --name.
- So "--startVector {2, 4, 5}" is perfectly legal.
-
- Retrieving an argument is possible with the getCommandLineArgument function of the
- CommandLineParser class. It is a Singleton, but the public interface is static.
- */
- class _CoreExport CommandLineArgument
- {
- friend class CommandLineParser;
-
- public:
- //! Tells whether the value has been changed by the command line.
- bool hasDefaultValue() const { return bHasDefaultValue_; }
- //! Returns the name of the argument.
- const std::string& getName() const { return name_; }
-
- //! Returns the shortcut (example: "-p 22" for "--port 22") of the argument.
- //! Evaluates to "" if there is none.
- const std::string& getShortcut() const { return shortcut_; }
- //! Sets the shortcut for the argument
- CommandLineArgument& shortcut(const std::string& shortcut)
- { this->shortcut_ = shortcut; return *this; }
-
- //! Returns the usage information
- const std::string& getInformation() const { return this->usageInformation_; }
- //! Sets the option information when displaying orxonox usage.
- CommandLineArgument& information(const std::string& usage)
- { this->usageInformation_ = usage; return *this; }
-
- //! Returns the actual value of the argument. Can be equal to default value.
- const MultiType& getValue() const { return value_; }
- //! Returns the given default value as type T.
- const MultiType& getDefaultValue() const { return defaultValue_; }
-
- private:
- //! Constructor initialises both value_ and defaultValue_ with defaultValue.
- CommandLineArgument(const std::string& name, const MultiType& defaultValue)
- : bHasDefaultValue_(true)
- , name_(name)
- , value_(defaultValue)
- , defaultValue_(defaultValue)
- { }
-
- //! Undefined copy constructor
- CommandLineArgument(const CommandLineArgument& instance);
- ~CommandLineArgument() { }
-
- //! Parses the value string of a command line argument.
- void parse(const std::string& value);
-
- //! Tells whether the value has been changed by the command line.
- bool bHasDefaultValue_;
-
- private:
- std::string name_; //!< Name of the argument
- std::string shortcut_; //!< Shortcut of the argument. @see getShortcut().
- std::string usageInformation_; //!< Tells about the usage of this parameter
-
- MultiType value_; //!< The actual value
- MultiType defaultValue_; //!< Default value. Should not be changed.
- };
-
-
- /**
- @brief
- Global interface to command line options.
- Allows to add and retrieve command line arguments. Also does the parsing.
- @note
- Internally it is a Singleton, but the public interface is static.
- @see
- CommandLineArgument
- */
- class _CoreExport CommandLineParser
- {
- public:
-
- //! Parse redirection to internal member method.
- static void parse(const std::string& cmdLine)
- { _getInstance()._parse(cmdLine); }
-
- static std::string getUsageInformation();
-
- static const CommandLineArgument* getArgument(const std::string& name);
- //! Writes the argument value in the given parameter.
- template <class T>
- static void getValue(const std::string& name, T* value)
- { *value = (T)(getArgument(name)->getValue()); }
- static const MultiType& getValue(const std::string& name)
- { return getArgument(name)->getValue(); }
- template <class T>
- static CommandLineArgument& addArgument(const std::string& name, T defaultValue);
-
- static bool existsArgument(const std::string& name)
- {
- std::map<std::string, CommandLineArgument*>::const_iterator it = _getInstance().cmdLineArgs_.find(name);
- return !(it == _getInstance().cmdLineArgs_.end());
- }
-
- static void destroyAllArguments();
-
- static void generateDoc(std::ofstream& file);
-
- private:
- //! Constructor initialises bFirstTimeParse_ with true.
- CommandLineParser() : bFirstTimeParse_(true) { }
- //! Undefined copy constructor
- CommandLineParser(const CommandLineParser& instance);
- ~CommandLineParser();
-
- static CommandLineParser& _getInstance();
-
- void _parse(const std::string& cmdLine);
- void checkFullArgument(const std::string& name, const std::string& value);
- void checkShortcut(const std::string& shortcut, const std::string& value);
-
- /**
- Tells whether we parsed for the first time. The CommmandLineArguments are added before main().
- So when we call parse() the first time, we need to create a map with all shortcuts since these
- get added after addCommandLineArgument().
- */
- bool bFirstTimeParse_;
-
- //! Holds all pointers to the arguments and serves as a search map by name.
- std::map<std::string, CommandLineArgument*> cmdLineArgs_;
- //! Search map by shortcut for the arguments.
- std::map<std::string, CommandLineArgument*> cmdLineArgsShortcut_;
- };
-
- template <>
- inline void CommandLineParser::getValue<std::string>(const std::string& name, std::string* value)
- {
- *value = getArgument(name)->getValue().get<std::string>();
- }
-
- /**
- @brief
- Adds a new CommandLineArgument to the internal map.
- Note that only such arguments are actually valid.
- @param name
- Name of the argument. Shortcut can be added later.
- @param defaultValue
- Default value that is used when argument was not given.
- */
- template <class T>
- CommandLineArgument& CommandLineParser::addArgument(const std::string& name, T defaultValue)
- {
- OrxAssert(!_getInstance().existsArgument(name),
- "Cannot add a command line argument with name '" + name + "' twice.");
- OrxAssert(!MultiType(defaultValue).isType<bool>() || MultiType(defaultValue).get<bool>() != true,
- "Boolean command line arguments with positive default values are not supported." << endl
- << "Please use SetCommandLineSwitch and adjust your argument: " << name);
-
- return *(_getInstance().cmdLineArgs_[name] = new CommandLineArgument(name, defaultValue));
- }
-}
-
-#endif /* _CommandLine_H__ */
Deleted: code/trunk/src/libraries/core/ConfigFileManager.cc
===================================================================
--- code/trunk/src/libraries/core/ConfigFileManager.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/ConfigFileManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,771 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief Implementation of ConfigFileManager and its helper classes.
-*/
-
-#include "ConfigFileManager.h"
-
-#include <boost/filesystem.hpp>
-
-#include "util/Convert.h"
-#include "util/Math.h"
-#include "util/StringUtils.h"
-#include "ConfigValueContainer.h"
-#include "PathConfig.h"
-#include "command/ConsoleCommand.h"
-
-namespace orxonox
-{
- //////////////////////////
- // ConfigFileEntryValue //
- //////////////////////////
- /**
- @brief Updates the string that will be stored in the file after one of it's components (name, value, comment) has changed.
- */
- void ConfigFileEntryValue::update()
- {
- // Make sure we remove the quotes when bString changes
- if (this->bString_)
- this->value_ = stripEnclosingQuotes(this->value_);
- // Assemble the entry line
- this->fileEntry_ = this->getKeyString() + " = ";
- if (this->bString_ && !this->value_.empty())
- this->fileEntry_ += '"' + addSlashes(this->value_) + '"';
- else
- this->fileEntry_ += this->value_;
- if (!this->additionalComment_.empty())
- this->fileEntry_ += ' ' + this->additionalComment_;
- }
-
-
- ////////////////////////////////
- // ConfigFileEntryVectorValue //
- ////////////////////////////////
- /**
- @brief Updates the string that will be stored in the file after one of it's components (name, value, index, comment) has changed.
- */
- void ConfigFileEntryVectorValue::update()
- {
- this->keyString_ = this->name_ + '[' + multi_cast<std::string>(this->index_) + ']';
- ConfigFileEntryValue::update();
- }
-
-
- ///////////////////////
- // ConfigFileSection //
- ///////////////////////
- /**
- @brief Destructor: Deletes all entries.
- */
- ConfigFileSection::~ConfigFileSection()
- {
- for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); )
- delete (*(it++));
- }
-
- /**
- @brief Deletes all elements of a config vector if their index is greater or equal to @a startindex.
-
- @param name The name of the vector
- @param startindex The index of the first element that will be deleted
- */
- void ConfigFileSection::deleteVectorEntries(const std::string& name, unsigned int startindex)
- {
- for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); )
- {
- if (((*it)->getName() == name) && ((*it)->getIndex() >= startindex))
- {
- delete (*it);
- this->entries_.erase(it++);
- }
- else
- {
- ++it;
- }
- }
- }
-
- /**
- @brief Returns the size of a config vector.
- @param name The name of the vector
- */
- unsigned int ConfigFileSection::getVectorSize(const std::string& name) const
- {
- unsigned int size = 0;
- for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
- if ((*it)->getName() == name)
- if ((*it)->getIndex() >= size)
- size = (*it)->getIndex() + 1;
- return size;
- }
-
- /**
- @brief Returns the title and comment of the section as it will be stored in the file.
- */
- std::string ConfigFileSection::getFileEntry() const
- {
- if (this->additionalComment_.empty())
- return ('[' + this->name_ + ']');
- else
- return ('[' + this->name_ + "] " + this->additionalComment_);
- }
-
- /**
- @brief Returns the entry with given name (or NULL if it doesn't exist).
-
- @param name The name of the entry
- */
- ConfigFileEntry* ConfigFileSection::getEntry(const std::string& name) const
- {
- for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
- {
- if ((*it)->getName() == name)
- return *it;
- }
- return NULL;
- }
-
- /**
- @brief Returns the entry of a vector element with given name and index (or NULL if it doesn't exist).
-
- @param name The name of the vector
- @param index The index of the element in the vector
- */
- ConfigFileEntry* ConfigFileSection::getEntry(const std::string& name, unsigned int index) const
- {
- for (std::list<ConfigFileEntry*>::const_iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
- {
- if (((*it)->getName() == name) && ((*it)->getIndex() == index))
- return *it;
- }
- return NULL;
- }
-
- /**
- @brief Returns the iterator to the entry with given name. If the entry doesn't exist, it is created using the fallback value.
-
- @param name The name of the entry
- @param fallback The value that will be used if the entry doesn't exist
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- */
- std::list<ConfigFileEntry*>::iterator ConfigFileSection::getOrCreateEntryIterator(const std::string& name, const std::string& fallback, bool bString)
- {
- for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
- {
- if ((*it)->getName() == name)
- {
- (*it)->setString(bString);
- return it;
- }
- }
-
- this->bUpdated_ = true;
-
- return this->entries_.insert(this->entries_.end(), new ConfigFileEntryValue(name, fallback, bString));
- }
-
- /**
- @brief Returns the iterator to the entry of a vector element with given name and index. If the entry doesn't exist, it is created using the fallback value.
-
- @param name The name of the vector
- @param index The index of the element in the vector
- @param fallback The value that will be used if the entry doesn't exist
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- */
- std::list<ConfigFileEntry*>::iterator ConfigFileSection::getOrCreateEntryIterator(const std::string& name, unsigned int index, const std::string& fallback, bool bString)
- {
- for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
- {
- if (((*it)->getName() == name) && ((*it)->getIndex() == index))
- {
- (*it)->setString(bString);
- return it;
- }
- }
-
- this->bUpdated_ = true;
-
- if (index == 0)
- return this->entries_.insert(this->entries_.end(), new ConfigFileEntryVectorValue(name, index, fallback, bString));
- else
- return this->entries_.insert(++this->getOrCreateEntryIterator(name, index - 1, "", bString), new ConfigFileEntryVectorValue(name, index, fallback, bString));
- }
-
-
- ////////////////
- // ConfigFile //
- ////////////////
-
- const char* ConfigFile::DEFAULT_CONFIG_FOLDER = "defaultConfig";
-
- /**
- @brief Constructor: Initializes the config file.
- @param filename The file-name of this config file
- @param bCopyFallbackFile If true, the default config file is copied into the config-directory before loading the file
- */
- ConfigFile::ConfigFile(const std::string& filename, bool bCopyFallbackFile)
- : filename_(filename)
- , bCopyFallbackFile_(bCopyFallbackFile)
- , bUpdated_(false)
- {
- }
-
- /**
- @brief Destructor: Deletes all sections and entries.
- */
- ConfigFile::~ConfigFile()
- {
- this->clear();
- }
-
- /**
- @brief Loads the config file from the hard-disk and reads the sections and their values.
- */
- void ConfigFile::load()
- {
- // Be sure we start from new in the memory
- this->clear();
-
- boost::filesystem::path filepath(this->filename_);
- if (!filepath.is_complete())
- {
- filepath = PathConfig::getConfigPath() / filepath;
- if (this->bCopyFallbackFile_)
- {
- // Look for default file in the data folder
- if (!boost::filesystem::exists(filepath))
- {
- boost::filesystem::path defaultFilepath(PathConfig::getDataPath() / DEFAULT_CONFIG_FOLDER / this->filename_);
- if (boost::filesystem::exists(defaultFilepath))
- {
- // Try to copy default file from the data folder
- try
- {
- boost::filesystem::copy_file(defaultFilepath, filepath);
- orxout(internal_info, context::config) << "Copied " << this->filename_ << " from the default config folder." << endl;
- }
- catch (const boost::filesystem::filesystem_error& ex)
- { orxout(user_error, context::config) << "Error in ConfigFile: " << ex.what() << endl; }
- }
- }
- }
- }
-
- // Open the file
- std::ifstream file;
- file.open(filepath.string().c_str(), std::fstream::in);
- if (file.is_open())
- {
- ConfigFileSection* newsection = 0;
-
- while (file.good() && !file.eof())
- {
- std::string line;
- std::getline(file, line);
-
- const std::string& temp = getStripped(line);
- if (!isEmpty(temp) && !isComment(temp))
- {
- size_t pos1 = temp.find('[');
- if (pos1 == 0) pos1 = line.find('['); else pos1 = std::string::npos;
- size_t pos2 = line.find(']');
-
- if (pos1 != std::string::npos && pos2 != std::string::npos && pos2 > pos1 + 1)
- {
- // New section
- const std::string& comment = line.substr(pos2 + 1);
- if (isComment(comment))
- newsection = new ConfigFileSection(line.substr(pos1 + 1, pos2 - pos1 - 1), comment);
- else
- newsection = new ConfigFileSection(line.substr(pos1 + 1, pos2 - pos1 - 1));
- this->sections_.insert(this->sections_.end(), newsection);
- continue;
- }
- }
-
- if (newsection != 0)
- {
- if (isComment(line))
- {
- // New comment
- newsection->getEntries().insert(newsection->getEntries().end(), new ConfigFileEntryComment(removeTrailingWhitespaces(line)));
- continue;
- }
- else
- {
- size_t pos1 = line.find('=');
-
- if (pos1 != std::string::npos && pos1 > 0)
- {
- // New entry
- size_t pos2 = line.find('[');
- size_t pos3 = line.find(']');
- size_t commentposition = getNextCommentPosition(line, pos1 + 1);
- while (isBetweenQuotes(line, commentposition))
- {
- commentposition = getNextCommentPosition(line, commentposition + 1);
- }
- std::string value, comment;
- if (commentposition == std::string::npos)
- {
- value = line.substr(pos1 + 1);
- }
- else
- {
- value = line.substr(pos1 + 1, commentposition - pos1 - 1);
- comment = removeTrailingWhitespaces(line.substr(commentposition));
- }
-
- value = removeTrailingWhitespaces(value);
- value = removeSlashes(value);
-
- if (pos2 != std::string::npos && pos3 != std::string::npos && pos3 > pos2 + 1)
- {
- // There might be an array index
- unsigned int index = 0;
- if (convertValue(&index, line.substr(pos2 + 1, pos3 - pos2 - 1)))
- {
- // New array
- std::list<ConfigFileEntry*>::iterator it = newsection->getOrCreateEntryIterator(getStripped(line.substr(0, pos2)), index, value, false);
- (*it)->setValue(value);
- (*it)->setComment(comment);
- continue;
- }
- }
-
- // New value
- newsection->getEntries().insert(newsection->getEntries().end(), new ConfigFileEntryValue(getStripped(line.substr(0, pos1)), value, false, comment));
- continue;
- }
- }
- }
- }
-
- file.close();
-
- orxout(internal_info, context::config) << "Loaded config file \"" << this->filename_ << "\"." << endl;
-
- // DO NOT save the file --> we can open supposedly read only config files
- } // end file.is_open()
- }
-
- /**
- @brief Writes the sections and values to the hard-disk.
- */
- void ConfigFile::save() const
- {
- this->saveAs(this->filename_);
- }
-
- /**
- @brief Writes the sections and values to a given file on the hard-disk.
- */
- void ConfigFile::saveAs(const std::string& filename) const
- {
- boost::filesystem::path filepath(filename);
- if (!filepath.is_complete())
- filepath = PathConfig::getConfigPath() / filename;
- std::ofstream file;
- file.open(filepath.string().c_str(), std::fstream::out);
- file.setf(std::ios::fixed, std::ios::floatfield);
- file.precision(6);
-
- if (!file.is_open())
- {
- orxout(user_error, context::config) << "Couldn't open config-file \"" << filename << "\"." << endl;
- return;
- }
-
- for (std::list<ConfigFileSection*>::const_iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
- {
- file << (*it)->getFileEntry() << endl;
-
- for (std::list<ConfigFileEntry*>::const_iterator it_entries = (*it)->getEntriesBegin(); it_entries != (*it)->getEntriesEnd(); ++it_entries)
- file << (*it_entries)->getFileEntry() << endl;
-
- file << endl;
- }
-
- file.close();
-
- orxout(verbose, context::config) << "Saved config file \"" << filename << "\"." << endl;
- }
-
- /**
- @brief Deletes all sections (which again delete all their values) and clears the list of sections.
- */
- void ConfigFile::clear()
- {
- for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); )
- delete (*(it++));
- this->sections_.clear();
- }
-
- /**
- @brief Deletes all elements of a config vector if their index is greater or equal to @a startindex.
-
- @param section The name of the section
- @param name The name of the vector
- @param startindex The index of the first element that will be deleted
- */
- void ConfigFile::deleteVectorEntries(const std::string& section, const std::string& name, unsigned int startindex)
- {
- if (ConfigFileSection* sectionPtr = this->getSection(section))
- {
- sectionPtr->deleteVectorEntries(name, startindex);
- this->save();
- }
- }
-
- /**
- @brief Returns a pointer to the section with given name (or NULL if the section doesn't exist).
- */
- ConfigFileSection* ConfigFile::getSection(const std::string& section) const
- {
- for (std::list<ConfigFileSection*>::const_iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
- if ((*it)->getName() == section)
- return (*it);
- return NULL;
- }
-
- /**
- @brief Returns a pointer to the section with given name. If it doesn't exist, the section is created.
- */
- ConfigFileSection* ConfigFile::getOrCreateSection(const std::string& section)
- {
- for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
- if ((*it)->getName() == section)
- return (*it);
-
- this->bUpdated_ = true;
-
- return (*this->sections_.insert(this->sections_.end(), new ConfigFileSection(section)));
- }
-
- /**
- @brief Saves the config file if it was updated (or if any of its sections were updated).
- */
- void ConfigFile::saveIfUpdated()
- {
- bool sectionsUpdated = false;
-
- for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
- {
- if ((*it)->bUpdated_)
- {
- sectionsUpdated = true;
- (*it)->bUpdated_ = false;
- }
- }
-
- if (this->bUpdated_ || sectionsUpdated)
- {
- this->bUpdated_ = false;
- this->save();
- }
- }
-
-
- ////////////////////////
- // SettingsConfigFile //
- ////////////////////////
-
- static const std::string __CC_load_name = "reloadSettings";
- static const std::string __CC_setFilename_name = "setSettingsFile";
- static const std::string __CC_config_name = "config";
- static const std::string __CC_tconfig_name = "tconfig";
- static const std::string __CC_getConfig_name = "getConfig";
-
- SetConsoleCommand(__CC_load_name, &ConfigFile::load);
- SetConsoleCommand(__CC_setFilename_name, &SettingsConfigFile::setFilename);
- SetConsoleCommand(__CC_config_name, &SettingsConfigFile::config).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue());
- SetConsoleCommand(__CC_tconfig_name, &SettingsConfigFile::tconfig).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries()).argumentCompleter(2, autocompletion::settingsvalue());
- SetConsoleCommand(__CC_getConfig_name, &SettingsConfigFile::getConfig).argumentCompleter(0, autocompletion::settingssections()).argumentCompleter(1, autocompletion::settingsentries());
-
- SettingsConfigFile* SettingsConfigFile::singletonPtr_s = 0;
-
- /**
- @brief Constructor: Activates the console commands.
- */
- SettingsConfigFile::SettingsConfigFile(const std::string& filename)
- : ConfigFile(filename)
- {
- ModifyConsoleCommand(__CC_load_name).setObject(this);
- ModifyConsoleCommand(__CC_setFilename_name).setObject(this);
- ModifyConsoleCommand(__CC_config_name).setObject(this);
- ModifyConsoleCommand(__CC_tconfig_name).setObject(this);
- ModifyConsoleCommand(__CC_getConfig_name).setObject(this);
- }
-
- /**
- @brief Destructor: Deactivates the console commands.
- */
- SettingsConfigFile::~SettingsConfigFile()
- {
- ModifyConsoleCommand(__CC_load_name).setObject(0);
- ModifyConsoleCommand(__CC_setFilename_name).setObject(0);
- ModifyConsoleCommand(__CC_config_name).setObject(0);
- ModifyConsoleCommand(__CC_tconfig_name).setObject(0);
- ModifyConsoleCommand(__CC_getConfig_name).setObject(0);
- }
-
- /**
- @brief Loads the config file and updates the @ref ConfigValueContainer "config value containers".
- */
- void SettingsConfigFile::load()
- {
- ConfigFile::load();
- this->updateConfigValues();
- }
-
- /**
- @brief Changes the file-name.
- */
- void SettingsConfigFile::setFilename(const std::string& filename)
- {
- ConfigFileManager::getInstance().setFilename(ConfigFileType::Settings, filename);
- }
-
- /**
- @brief Registers a new @ref ConfigValueContainer "config value container".
- */
- void SettingsConfigFile::addConfigValueContainer(ConfigValueContainer* container)
- {
- if (container == NULL)
- return;
- std::pair<std::string, ConfigValueContainer*> second(getLowercase(container->getName()), container);
- this->containers_.insert(std::make_pair(getLowercase(container->getSectionName()), second));
- this->sectionNames_.insert(container->getSectionName());
- }
-
- /**
- @brief Unregisters a @ref ConfigValueContainer "config value container".
- */
- void SettingsConfigFile::removeConfigValueContainer(ConfigValueContainer* container)
- {
- if (container == NULL)
- return;
- const std::string& sectionLC = getLowercase(container->getSectionName());
- ContainerMap::iterator upper = this->containers_.upper_bound(sectionLC);
- for (ContainerMap::iterator it = this->containers_.lower_bound(sectionLC); it != upper; ++it)
- {
- if (it->second.second == container)
- {
- // Remove entry from section name set this was the last container for that section
- if (upper == this->containers_.lower_bound(sectionLC))
- this->sectionNames_.erase(container->getSectionName());
- this->containers_.erase(it);
- break;
- }
- }
- }
-
- /**
- @brief Updates all @ref ConfigValueContainer "config value containers".
- */
- void SettingsConfigFile::updateConfigValues()
- {
- // todo: can this be done more efficiently? looks like some identifiers will be updated multiple times.
-
- for (ContainerMap::const_iterator it = this->containers_.begin(); it != this->containers_.end(); ++it)
- {
- it->second.second->update();
- it->second.second->getIdentifier()->updateConfigValues();
- }
- }
-
- /**
- @brief Removes entries and sections from the file that don't exist anymore (i.e. if there's no corresponding @ref ConfigValueContainer "config value container").
- @param bCleanComments If true, comments are also removed from the file
- */
- void SettingsConfigFile::clean(bool bCleanComments)
- {
- for (std::list<ConfigFileSection*>::iterator itSection = this->sections_.begin(); itSection != this->sections_.end(); )
- {
- const std::string& sectionLC = getLowercase((*itSection)->getName());
- ContainerMap::const_iterator lower = this->containers_.lower_bound(sectionLC);
- ContainerMap::const_iterator upper = this->containers_.upper_bound(sectionLC);
- if (lower != upper)
- {
- // The section exists, delete comment
- if (bCleanComments)
- (*itSection)->setComment("");
- for (std::list<ConfigFileEntry*>::iterator itEntry = (*itSection)->entries_.begin(); itEntry != (*itSection)->entries_.end(); )
- {
- const std::string& entryLC = getLowercase((*itEntry)->getName());
- bool bFound = false;
- for (ContainerMap::const_iterator itContainer = lower; itContainer != upper; ++itContainer)
- {
- if (itContainer->second.first == entryLC)
- {
- // The config-value exists, delete comment
- if (bCleanComments)
- (*itEntry)->setComment("");
- ++itEntry;
- bFound = true;
- break;
- }
- }
- if (!bFound)
- {
- // The config-value doesn't exist
- delete (*itEntry);
- (*itSection)->entries_.erase(itEntry++);
- }
- }
- ++itSection;
- }
- else
- {
- // The section doesn't exist
- delete (*itSection);
- this->sections_.erase(itSection++);
- }
- }
-
- // Save the file
- this->save();
- }
-
- /**
- @brief Console-command: Changes the value of an entry and stores it the file.
-
- @param section The section of the config value
- @param entry The name of the config value
- @param value The new value
- */
- void SettingsConfigFile::config(const std::string& section, const std::string& entry, const std::string& value)
- {
- if (!this->configImpl(section, entry, value, &ConfigValueContainer::set))
- orxout(user_error, context::config) << "Config value \"" << entry << "\" in section \"" << section << "\" doesn't exist." << endl;
- }
-
- /**
- @brief Console-command: Changes the value of an entry, but doesn't store it in the file (it's only a temporary change).
-
- @param section The section of the config value
- @param entry The name of the config value
- @param value The new value
- */
- void SettingsConfigFile::tconfig(const std::string& section, const std::string& entry, const std::string& value)
- {
- if (!this->configImpl(section, entry, value, &ConfigValueContainer::tset))
- orxout(user_error, context::config) << "Config value \"" << entry << "\" in section \"" << section << "\" doesn't exist." << endl;
- }
-
- /**
- @brief Changes the value of an entry, depending on @a function, either by using "set" or "tset"
-
- @param section The section of the config value
- @param entry The name of the config value
- @param value The new value
- @param function The function ("set" or "tset") that will be used to change the value.
- */
- bool SettingsConfigFile::configImpl(const std::string& section, const std::string& entry, const std::string& value, bool (ConfigValueContainer::*function)(const MultiType&))
- {
- const std::string& sectionLC = getLowercase(section);
- const std::string& entryLC = getLowercase(entry);
- ContainerMap::iterator upper = this->containers_.upper_bound(sectionLC);
- for (ContainerMap::iterator it = this->containers_.lower_bound(sectionLC); it != upper; ++it)
- {
- // Note: Config value vectors cannot be supported
- if (it->second.first == entryLC && !it->second.second->isVector())
- {
- return (it->second.second->*function)(value);
- }
- }
- return false;
- }
-
- /**
- @brief Console-command: Returns the value of a given entry.
-
- @param section The section of the config value
- @param entry The name of the config value
- */
- std::string SettingsConfigFile::getConfig(const std::string& section, const std::string& entry)
- {
- const std::string& sectionLC = getLowercase(section);
- const std::string& entryLC = getLowercase(entry);
- ContainerMap::iterator upper = this->containers_.upper_bound(sectionLC);
- for (ContainerMap::iterator it = this->containers_.lower_bound(sectionLC); it != upper; ++it)
- {
- // Note: Config value vectors cannot be supported
- if (it->second.first == entryLC && ! it->second.second->isVector())
- {
- std::string value;
- it->second.second->getValue<std::string, OrxonoxClass>(&value, NULL);
- return value;
- }
- }
- return "";
- }
-
-
- ///////////////////////
- // ConfigFileManager //
- ///////////////////////
-
- ConfigFileManager* ConfigFileManager::singletonPtr_s = 0;
-
- /// Constructor: Initializes the array of config files with NULL.
- ConfigFileManager::ConfigFileManager()
- {
- this->configFiles_.assign(NULL);
- }
-
- /// Destructor: Deletes the config files.
- ConfigFileManager::~ConfigFileManager()
- {
- for (boost::array<ConfigFile*, 3>::const_iterator it = this->configFiles_.begin(); it != this->configFiles_.end(); ++it)
- if (*it)
- delete (*it);
- }
-
- /// Defines the file-name for the config file of a given type (settings, calibration, etc.).
- void ConfigFileManager::setFilename(ConfigFileType::Value type, const std::string& filename)
- {
- if (this->getConfigFile(type))
- delete this->configFiles_[type];
- // Create and load config file
- switch (type)
- {
- case ConfigFileType::Settings:
- this->configFiles_[type] = new SettingsConfigFile(filename);
- break;
- case ConfigFileType::JoyStickCalibration:
- case ConfigFileType::CommandHistory:
- this->configFiles_[type] = new ConfigFile(filename);
- break;
- }
- this->configFiles_[type]->load();
- }
-}
Deleted: code/trunk/src/libraries/core/ConfigFileManager.h
===================================================================
--- code/trunk/src/libraries/core/ConfigFileManager.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/ConfigFileManager.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,602 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @ingroup Config ConfigFile
- @brief Declaration of ConfigFileManager and its helper classes, used to load and save config files.
-*/
-
-#ifndef _ConfigFileManager_H__
-#define _ConfigFileManager_H__
-
-#include "CorePrereqs.h"
-
-#include <list>
-#include <map>
-#include <set>
-#include <string>
-#include <boost/array.hpp>
-
-#include "util/Singleton.h"
-
-namespace orxonox // tolua_export
-{ // tolua_export
-
- /////////////////////
- // ConfigFileEntry //
- /////////////////////
- /**
- @brief This class represents an entry in the config file.
-
- This class is pure virtual. Use one of the derived classes to define the type of the entry.
- */
- class _CoreExport ConfigFileEntry
- {
- public:
- /// Destructor
- virtual ~ConfigFileEntry() {};
-
- /// Changes the value of the entry.
- virtual void setValue(const std::string& value) = 0;
- /// Returns the value of the entry.
- virtual const std::string& getValue() const = 0;
-
- /// Returns the name of the entry
- virtual const std::string& getName() const = 0;
-
- /// Changes the comment of the entry (will be placed after the value)
- virtual void setComment(const std::string& comment) = 0;
-
- /// Returns the index of the entry in a vector (used only if it is a vector)
- virtual unsigned int getIndex() const { return 0; }
-
- /// Defines if this entry is treated as string which means some special treatment of special characters.
- virtual void setString(bool bString) = 0;
-
- /// Returns the line as it will be stored in the config file.
- virtual const std::string& getFileEntry() const = 0;
- };
-
-
- //////////////////////////
- // ConfigFileEntryValue //
- //////////////////////////
- /**
- @brief This class represents a normal value in the config file.
- */
- class _CoreExport ConfigFileEntryValue : public ConfigFileEntry
- {
- public:
- /**
- @brief Constructor: Initializes the entry.
-
- @param name The name of the entry
- @param value The value of the entry
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- @param additionalComment An optional comment that will be placed behind the value in the config file
- */
- inline ConfigFileEntryValue(const std::string& name, const std::string& value = "", bool bString = false, const std::string& additionalComment = "")
- : name_(name)
- , value_(value)
- , additionalComment_(additionalComment)
- , bString_(bString)
- { this->update(); }
-
- /// Destructor
- inline virtual ~ConfigFileEntryValue() {}
-
- inline virtual const std::string& getName() const
- { return this->name_; }
-
- inline virtual void setComment(const std::string& comment)
- { this->additionalComment_ = comment; this->update(); }
-
- inline virtual void setValue(const std::string& value)
- { this->value_ = value; this->update(); }
- inline virtual const std::string& getValue() const
- { return this->value_; }
-
- inline void virtual setString(bool bString)
- { this->bString_ = bString; this->update(); }
-
- inline virtual const std::string& getFileEntry() const
- { return this->fileEntry_; }
-
- /// Returns the "key" of the value (in this case it's just the name of the entry, but for vectors it's different)
- inline virtual const std::string& getKeyString() const
- { return this->name_; }
-
- protected:
- virtual void update();
-
- const std::string name_; ///< The name of the value
- std::string value_; ///< The value
- std::string additionalComment_; ///< The additional comment
- std::string fileEntry_; ///< The string as it will be stored in the config file
- bool bString_; ///< If true, the value is treated as string which means some special treatment of special characters.
- };
-
-
- ////////////////////////////////
- // ConfigFileEntryVectorValue //
- ////////////////////////////////
- /**
- @brief Subclass of ConfigFileEntryValue, represents an element of a vector.
- */
- class _CoreExport ConfigFileEntryVectorValue : public ConfigFileEntryValue
- {
- public:
- /**
- @brief Constructor: Initializes the entry.
-
- @param name The name of the vector
- @param index The index of the element in the vector
- @param value The value of the element
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- @param additionalComment An optional comment that will be placed behind the value in the config file
- */
- inline ConfigFileEntryVectorValue(const std::string& name, unsigned int index, const std::string& value = "", bool bString = false, const std::string& additionalComment = "")
- : ConfigFileEntryValue(name, value, bString, additionalComment)
- , index_(index)
- { this->update(); /*No virtual calls in base class ctor*/ }
-
- /// Destructor
- inline ~ConfigFileEntryVectorValue() {}
-
- inline unsigned int getIndex() const
- { return this->index_; }
-
- /// Returns the "key" of the value (the name of the vector plus the index of the element)
- inline const std::string& getKeyString() const
- { return this->keyString_; }
-
- private:
- void update();
-
- unsigned int index_; ///< The index of the element in the vector
- std::string keyString_; ///< The full name of the entry (the name of the vector plus the index of the element)
- };
-
-
- ////////////////////////////
- // ConfigFileEntryComment //
- ////////////////////////////
- /**
- @brief This class represents a line in the config file which contains only a comment.
- */
- class _CoreExport ConfigFileEntryComment : public ConfigFileEntry
- {
- public:
- /// Constructor: Initializes the object.
- inline ConfigFileEntryComment(const std::string& comment) : comment_(comment) {}
-
- /// Destructor
- inline virtual ~ConfigFileEntryComment() {}
-
- inline virtual const std::string& getName() const
- { return this->comment_; }
-
- inline virtual void setComment(const std::string& comment)
- { this->comment_ = comment; }
-
- inline virtual void setValue(const std::string& value)
- {}
- inline virtual const std::string& getValue() const
- { return BLANKSTRING; }
-
- inline void setString(bool bString)
- {}
-
- inline virtual const std::string& getFileEntry() const
- { return this->comment_; }
-
- private:
- std::string comment_; ///< The comment
- };
-
-
- ///////////////////////
- // ConfigFileSection //
- ///////////////////////
- /**
- @brief Represents a section in a config file.
-
- A section has a name and a list of config values.
- */
- class _CoreExport ConfigFileSection
- {
- friend class ConfigFile;
- friend class SettingsConfigFile;
-
- public:
- /**
- @brief Constructor: Initializes the section.
-
- @param name The name of the section
- @param additionalComment An additional comment placed after the title of the section in the config file
- */
- inline ConfigFileSection(const std::string& name, const std::string& additionalComment = "")
- : name_(name)
- , additionalComment_(additionalComment)
- , bUpdated_(false)
- {}
- ~ConfigFileSection();
-
- /// Returns the name of the section.
- inline const std::string& getName() const
- { return this->name_; }
-
- /// Changes the comment which is placed after the title of the section in the config file.
- inline void setComment(const std::string& comment)
- { this->additionalComment_ = comment; }
-
- /**
- @brief Stores a value in the section. If the entry doesn't exist, it's created.
-
- @param name The name of the entry
- @param value The new value
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- */
- inline void setValue(const std::string& name, const std::string& value, bool bString)
- { this->getOrCreateEntry(name, value, bString)->setValue(value); }
- /**
- @brief Returns the value of a given entry in the section. Returns a blank string if the value doesn't exist.
-
- @param name The name of the entry
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- */
- inline const std::string& getValue(const std::string& name, bool bString)
- {
- ConfigFileEntry* entry = this->getEntry(name);
- if (entry)
- {
- entry->setString(bString); // if the entry was loaded from the config file, we have to tell it if it's a string
- return entry->getValue();
- }
- return BLANKSTRING;
- }
- /**
- @brief Returns the value of a given entry in the section. If it doesn't exist, the entry is created using the fallback value.
-
- @param name The name of the entry
- @param fallback The value that will be used if the entry doesn't exist
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- */
- inline const std::string& getOrCreateValue(const std::string& name, const std::string& fallback, bool bString)
- { return this->getOrCreateEntry(name, fallback, bString)->getValue(); }
-
- /**
- @brief Stores the value of an element of a vector in the section. If the entry doesn't exist, it's created.
-
- @param name The name of the vector
- @param index The index of the element in the vector
- @param value The new value
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- */
- inline void setValue(const std::string& name, unsigned int index, const std::string& value, bool bString)
- { this->getOrCreateEntry(name, index, value, bString)->setValue(value); }
- /**
- @brief Returns the value of a given element of a vector in the section. Returns a blank string if the value doesn't exist.
-
- @param name The name of the vector
- @param index The index of the element in the vector
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- */
- inline const std::string& getValue(const std::string& name, unsigned int index, bool bString)
- {
- ConfigFileEntry* entry = this->getEntry(name, index);
- if (entry)
- {
- entry->setString(bString); // if the entry was loaded from the config file, we have to tell it if it's a string
- return entry->getValue();
- }
- return BLANKSTRING;
- }
- /**
- @brief Returns the value of a given element of a vector in the section. If it doesn't exist, the entry is created using the fallback value.
-
- @param name The name of the vector
- @param index The index of the element in the vector
- @param fallback The value that will be used if the entry doesn't exist
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- */
- inline const std::string& getOrCreateValue(const std::string& name, unsigned int index, const std::string& fallback, bool bString)
- { return this->getOrCreateEntry(name, index, fallback, bString)->getValue(); }
-
- void deleteVectorEntries(const std::string& name, unsigned int startindex = 0);
- unsigned int getVectorSize(const std::string& name) const;
-
- std::string getFileEntry() const;
-
- private:
- /// Returns the list of entries in this section.
- std::list<ConfigFileEntry*>& getEntries()
- { return this->entries_; }
- /// Returns the begin-iterator of the list of entries in this section.
- std::list<ConfigFileEntry*>::const_iterator getEntriesBegin() const
- { return this->entries_.begin(); }
- /// Returns the end-iterator of the list of entries in this section.
- std::list<ConfigFileEntry*>::const_iterator getEntriesEnd() const
- { return this->entries_.end(); }
-
- std::list<ConfigFileEntry*>::iterator getOrCreateEntryIterator(const std::string& name, const std::string& fallback, bool bString);
- std::list<ConfigFileEntry*>::iterator getOrCreateEntryIterator(const std::string& name, unsigned int index, const std::string& fallback, bool bString);
-
- ConfigFileEntry* getEntry(const std::string& name) const;
- /**
- @brief Returns the entry with given name. If it doesn't exist, the entry is created using the fallback value.
-
- @param name The name of the entry
- @param fallback The value that will be used if the entry doesn't exist
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- */
- inline ConfigFileEntry* getOrCreateEntry(const std::string& name, const std::string& fallback, bool bString)
- { return (*this->getOrCreateEntryIterator(name, fallback, bString)); }
-
- ConfigFileEntry* getEntry(const std::string& name, unsigned int index) const;
- /**
- @brief Returns the entry that contains an element of a vector with given name. If it doesn't exist, the entry is created using the fallback value.
-
- @param name The name of the entry
- @param index The index of the element in the vector
- @param fallback The value that will be used if the entry doesn't exist
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- */
- inline ConfigFileEntry* getOrCreateEntry(const std::string& name, unsigned int index, const std::string& fallback, bool bString)
- { return (*this->getOrCreateEntryIterator(name, index, fallback, bString)); }
-
- std::string name_; ///< The name of the section
- std::string additionalComment_; ///< The additional comment which is placed after the title of the section in the config file
- std::list<ConfigFileEntry*> entries_; ///< The list of entries in this section
- bool bUpdated_; ///< True if an entry is created
- };
-
-
- ////////////////
- // ConfigFile //
- ////////////////
- /**
- @brief This class represents a config file, which is stored on the hard-disk and contains config values in different sections.
-
- It provides an interface to manipulate the sections and values.
- */
- class _CoreExport ConfigFile
- {
- public:
- ConfigFile(const std::string& filename, bool bCopyFallbackFile = true);
- virtual ~ConfigFile();
-
- virtual void load();
- virtual void save() const;
- virtual void saveAs(const std::string& filename) const;
- virtual void clear();
-
- /// Returns the file-name of this config file
- inline const std::string& getFilename()
- { return this->filename_; }
-
- /**
- @brief Stores a value in the config file. If the entry or its section doesn't exist, it's created.
-
- @param section The name of the section
- @param name The name of the entry
- @param value The new value
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- */
- inline void setValue(const std::string& section, const std::string& name, const std::string& value, bool bString)
- {
- this->getOrCreateSection(section)->setValue(name, value, bString);
- this->save();
- }
- /**
- @brief Returns the value of a given entry in the config file. Returns a blank string if the value doesn't exist.
-
- @param section The name of the section
- @param name The name of the entry
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- */
- inline const std::string& getValue(const std::string& section, const std::string& name, bool bString)
- {
- ConfigFileSection* sectionPtr = this->getSection(section);
- return (sectionPtr ? sectionPtr->getValue(name, bString) : BLANKSTRING);
- }
- /**
- @brief Returns the value of a given entry in the config file. If it doesn't exist, the entry is created using the fallback value.
-
- @param section The name of the section
- @param name The name of the entry
- @param fallback The value that will be used if the entry doesn't exist
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- */
- inline const std::string& getOrCreateValue(const std::string& section, const std::string& name, const std::string& fallback, bool bString)
- {
- const std::string& output = this->getOrCreateSection(section)->getOrCreateValue(name, fallback, bString);
- this->saveIfUpdated();
- return output;
- }
-
- /**
- @brief Stores the value of an element of a vector in the config file. If the entry or its section doesn't exist, it's created.
-
- @param section The name of the section
- @param name The name of the vector
- @param index The index of the element in the vector
- @param value The new value
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- */
- inline void setValue(const std::string& section, const std::string& name, unsigned int index, const std::string& value, bool bString)
- {
- this->getOrCreateSection(section)->setValue(name, index, value, bString);
- this->save();
- }
- /**
- @brief Returns the value of a given element of a vector in the config file. Returns a blank string if the value doesn't exist.
-
- @param section The name of the section
- @param name The name of the vector
- @param index The index of the element in the vector
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- */
- inline const std::string& getValue(const std::string& section, const std::string& name, unsigned int index, bool bString)
- {
- ConfigFileSection* sectionPtr = this->getSection(section);
- return (sectionPtr ? sectionPtr->getValue(name, index, bString) : BLANKSTRING);
- }
- /**
- @brief Returns the value of a given element of a vector in the config file. If it doesn't exist, the entry is created using the fallback value.
-
- @param section The name of the section
- @param name The name of the vector
- @param index The index of the element in the vector
- @param fallback The value that will be used if the entry doesn't exist
- @param bString If true, the value is treated as string which means some special treatment of special characters.
- */
- const std::string& getOrCreateValue(const std::string& section, const std::string& name, unsigned int index, const std::string& fallback, bool bString)
- {
- const std::string& output = this->getOrCreateSection(section)->getOrCreateValue(name, index, fallback, bString);
- this->saveIfUpdated();
- return output;
- }
-
- void deleteVectorEntries(const std::string& section, const std::string& name, unsigned int startindex = 0);
- /**
- @brief Returns the size of a config vector.
- @param section The section of the vector
- @param name The name of the vector
- */
- inline unsigned int getVectorSize(const std::string& section, const std::string& name) const
- {
- ConfigFileSection* sectionPtr = this->getSection(section);
- return (sectionPtr ? sectionPtr->getVectorSize(name) : 0);
- }
-
- static const char* DEFAULT_CONFIG_FOLDER; ///< The folder where the default config files will be stored
-
- protected:
- ConfigFileSection* getSection(const std::string& section) const;
- ConfigFileSection* getOrCreateSection(const std::string& section);
-
- std::list<ConfigFileSection*> sections_; ///< A list of sections in this config file
-
- private:
- void saveIfUpdated();
-
- const std::string filename_; ///< The filename of this config file
- const bool bCopyFallbackFile_; ///< If true, the default config file is copied into the config-directory before loading the file
- bool bUpdated_; ///< Becomes true if a section is added
- };
-
-
- ////////////////////////
- // SettingsConfigFile //
- ////////////////////////
- /**
- @brief Child class of ConfigFile, used to store the settings of the game.
-
- In addition to ConfigFile, this class provides an interface to manipulate the settings
- with console commands and to cache entries in instances of ConfigValueContainer.
-
- SettingsConfigFile is a Singleton, meaning there's only one instance of this class
- (and thus only one config file that stores settings).
- */
- class _CoreExport SettingsConfigFile // tolua_export
- : public ConfigFile, public Singleton<SettingsConfigFile>
- { // tolua_export
- friend class Singleton<SettingsConfigFile>;
-
- public:
- typedef std::multimap<std::string, std::pair<std::string, ConfigValueContainer*> > ContainerMap;
-
- SettingsConfigFile(const std::string& filename);
- ~SettingsConfigFile();
-
- void load(); // tolua_export
- void setFilename(const std::string& filename); // tolua_export
- void clean(bool bCleanComments = false); // tolua_export
-
- void config(const std::string& section, const std::string& entry, const std::string& value); // tolua_export
- void tconfig(const std::string& section, const std::string& entry, const std::string& value); // tolua_export
- std::string getConfig(const std::string& section, const std::string& entry); // tolua_export
-
- void addConfigValueContainer(ConfigValueContainer* container);
- void removeConfigValueContainer(ConfigValueContainer* container);
-
- /// Returns a set containing the names of all sections in this config file.
- inline const std::set<std::string>& getSectionNames()
- { return this->sectionNames_; }
- /// Returns the lower-bound-iterator of the @ref ConfigValueContainer "config value containers" for the given section.
- inline ContainerMap::const_iterator getContainerLowerBound(const std::string section)
- { return this->containers_.lower_bound(section); }
- /// Returns the upper-bound-iterator of the @ref ConfigValueContainer "config value containers" for the given section.
- inline ContainerMap::const_iterator getContainerUpperBound(const std::string section)
- { return this->containers_.upper_bound(section); }
-
- static SettingsConfigFile& getInstance() { return Singleton<SettingsConfigFile>::getInstance(); } // tolua_export
-
- private:
- void updateConfigValues();
- bool configImpl(const std::string& section, const std::string& entry, const std::string& value, bool (ConfigValueContainer::*function)(const MultiType&));
-
- ContainerMap containers_; ///< Stores all @ref ConfigValueContainer "config value containers"
- std::set<std::string> sectionNames_; ///< Stores all section names
- static SettingsConfigFile* singletonPtr_s; ///< The singleton pointer
- }; // tolua_export
-
-
- ///////////////////////
- // ConfigFileManager //
- ///////////////////////
- /**
- @brief Manages the different config files (settings, calibration, etc). Implemented as Singleton.
- */
- class _CoreExport ConfigFileManager : public Singleton<ConfigFileManager>
- {
- friend class Singleton<ConfigFileManager>;
- public:
- ConfigFileManager();
- ~ConfigFileManager();
-
- void setFilename(ConfigFileType::Value type, const std::string& filename);
-
- /// Returns the config file of a given type (settings, calibration, etc.)
- inline ConfigFile* getConfigFile(ConfigFileType::Value type)
- {
- // Check array bounds
- return configFiles_.at(type);
- }
-
- private:
- ConfigFileManager(const ConfigFileManager&); ///< Copy-constructor: not implemented
-
- boost::array<ConfigFile*, 3> configFiles_; ///< Stores the config files for each type in an array (must have the same size like ConfigFileType::Value)
- static ConfigFileManager* singletonPtr_s; ///< Stores the singleton-pointer
- };
-} // tolua_export
-
-#endif /* _ConfigFileManager_H__ */
Deleted: code/trunk/src/libraries/core/ConfigValueContainer.cc
===================================================================
--- code/trunk/src/libraries/core/ConfigValueContainer.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/ConfigValueContainer.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,352 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief Implementation of the ConfigValueContainer class.
-*/
-
-#include "ConfigValueContainer.h"
-
-#include "util/Convert.h"
-#include "util/SubString.h"
-#include "ConfigFileManager.h"
-#include "Language.h"
-
-namespace orxonox
-{
- const unsigned int MAX_VECTOR_INDEX = 255; // to avoid up to 4*10^9 vector entries in the config file after accidentally using a wrong argument
-
- /**
- @brief Initializes the ConfigValueContainer with default values.
- */
- void ConfigValueContainer::init(ConfigFileType::Value type, Identifier* identifier, const std::string& sectionname, const std::string& varname)
- {
- this->type_ = type;
- this->identifier_ = identifier;
- this->sectionname_ = sectionname;
- this->varname_ = varname;
- this->callback_ = 0;
- this->bContainerIsNew_ = true;
- this->bDoInitialCallback_ = false;
- this->bAddedDescription_ = false;
-
- // Register containers for general settings
- if (this->type_ == ConfigFileType::Settings)
- SettingsConfigFile::getInstance().addConfigValueContainer(this);
- }
-
- /**
- @brief Does some special initialization for single config-values.
- */
- void ConfigValueContainer::initValue(const MultiType& defvalue)
- {
- this->value_ = defvalue;
- this->bIsVector_ = false;
-
- this->defvalueString_ = this->value_.get<std::string>();
- this->update();
- }
-
- /**
- @brief Does some special initialization for vector config-values.
- */
- void ConfigValueContainer::initVector()
- {
- this->bIsVector_ = true;
-
- for (unsigned int i = 0; i < this->valueVector_.size(); i++)
- {
- ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType<std::string>());
- this->defvalueStringVector_.push_back(this->valueVector_[i]);
- }
-
- this->update();
- }
-
- /**
- @brief Destructor: Deletes the callback object if necessary.
- */
- ConfigValueContainer::~ConfigValueContainer()
- {
- if (this->callback_)
- delete this->callback_;
-
- // Unregister general settings containers
- if (this->type_ == ConfigFileType::Settings && SettingsConfigFile::exists())
- SettingsConfigFile::getInstance().removeConfigValueContainer(this);
- }
-
- /**
- @brief Assigns a new value to the config-value of all objects and writes the change into the config-file.
- @param input The new value
- @return True if the new value was successfully assigned
- */
- bool ConfigValueContainer::set(const MultiType& input)
- {
- if (this->bIsVector_)
- {
- return this->callFunctionWithIndex(&ConfigValueContainer::set, input);
- }
- else
- {
- if (this->tset(input))
- {
- ConfigFileManager::getInstance().getConfigFile(this->type_)->setValue(this->sectionname_, this->varname_, input, this->value_.isType<std::string>());
- return true;
- }
- }
- return false;
- }
-
- /**
- @brief Assigns a new value to the config-value of all objects and writes the change into the config-file.
- @param index The index in the vector
- @param input The new value
- @return True if the new value was successfully assigned
- */
- bool ConfigValueContainer::set(unsigned int index, const MultiType& input)
- {
- if (this->bIsVector_)
- {
- if (this->tset(index, input))
- {
- ConfigFileManager::getInstance().getConfigFile(this->type_)->setValue(this->sectionname_, this->varname_, index, input, this->value_.isType<std::string>());
- return true;
- }
- }
- else
- {
- orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << endl;
- }
- return false;
- }
-
- /**
- @brief Assigns a new value to the config-value of all objects, but doesn't change the config-file (t stands for temporary).
- @param input The new value. If bIsVector_ then write "index value"
- @return True if the new value was successfully assigned
- */
- bool ConfigValueContainer::tset(const MultiType& input)
- {
- if (this->bIsVector_)
- {
- return this->callFunctionWithIndex(&ConfigValueContainer::tset, input);
- }
- else
- {
- this->value_ = input;
-
- if (this->identifier_)
- this->identifier_->updateConfigValues();
-
- return true;
- }
- }
-
- /**
- @brief Assigns a new value to the config-value of all objects, but doesn't change the config-file (t stands for temporary).
- @param index The index in the vector
- @param input The new value
- @return True if the new value was successfully assigned
- */
- bool ConfigValueContainer::tset(unsigned int index, const MultiType& input)
- {
- if (this->bIsVector_)
- {
- if (index > MAX_VECTOR_INDEX)
- {
- orxout(user_error, context::config) << "Index " << index << " is too large." << endl;
- return false;
- }
-
- if (index >= this->valueVector_.size())
- {
- for (unsigned int i = this->valueVector_.size(); i <= index; i++)
- {
- this->valueVector_.push_back(MultiType());
- }
- }
-
- this->valueVector_[index] = input;
-
- if (this->identifier_)
- this->identifier_->updateConfigValues();
-
- return true;
- }
- else
- {
- orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << endl;
- return false;
- }
- }
-
- /**
- @brief Adds a new entry to the end of the vector.
- @param input The new entry
- @return True if the new entry was successfully added
- */
- bool ConfigValueContainer::add(const MultiType& input)
- {
- if (this->bIsVector_)
- return this->set(this->valueVector_.size(), input);
-
- orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << endl;
- return false;
- }
-
- /**
- @brief Removes an existing entry from the vector.
- @param index The index of the entry
- @return True if the entry was removed
- */
- bool ConfigValueContainer::remove(unsigned int index)
- {
- if (this->bIsVector_)
- {
- if (index < this->valueVector_.size())
- {
- // Erase the entry from the vector, change (shift) all entries beginning with index in the config file, remove the last entry from the file
- this->valueVector_.erase(this->valueVector_.begin() + index);
- for (unsigned int i = index; i < this->valueVector_.size(); i++)
- ConfigFileManager::getInstance().getConfigFile(this->type_)->setValue(this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType<std::string>());
- ConfigFileManager::getInstance().getConfigFile(this->type_)->deleteVectorEntries(this->sectionname_, this->varname_, this->valueVector_.size());
-
- return true;
- }
- orxout(user_error, context::config) << "Invalid vector-index." << endl;
- }
-
- orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is not a vector." << endl;
- return false;
- }
-
- /**
- @brief Sets the value of the variable back to the default value and resets the config-file entry.
- */
- bool ConfigValueContainer::reset()
- {
- if (!this->bIsVector_)
- return this->set(this->defvalueString_);
- else
- {
- bool success = true;
- for (unsigned int i = 0; i < this->defvalueStringVector_.size(); i++)
- if (!this->set(i, this->defvalueStringVector_[i]))
- success = false;
- ConfigFileManager::getInstance().getConfigFile(this->type_)->deleteVectorEntries(this->sectionname_, this->varname_, this->defvalueStringVector_.size());
- return success;
- }
- }
-
- /**
- @brief Retrieves the configured value from the currently loaded config-file.
- */
- void ConfigValueContainer::update()
- {
- if (!this->bIsVector_)
- this->value_ = ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, this->defvalueString_, this->value_.isType<std::string>());
- else
- {
- this->valueVector_.clear();
- unsigned int vectorSize = ConfigFileManager::getInstance().getConfigFile(this->type_)->getVectorSize(this->sectionname_, this->varname_);
- for (unsigned int i = 0; i < vectorSize; i++)
- {
- if (i < this->defvalueStringVector_.size())
- {
- this->value_ = ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, i, this->defvalueStringVector_[i], this->value_.isType<std::string>());
- }
- else
- {
- this->value_ = ConfigFileManager::getInstance().getConfigFile(this->type_)->getOrCreateValue(this->sectionname_, this->varname_, i, MultiType(), this->value_.isType<std::string>());
- }
-
- this->valueVector_.push_back(this->value_);
- }
- }
- }
-
- /**
- @brief Calls the given function with parsed index and the parsed argument from the input string.
- @param function The function to call
- @param input The input string
- @return The returnvalue of the functioncall
- */
- bool ConfigValueContainer::callFunctionWithIndex(bool (ConfigValueContainer::* function) (unsigned int, const MultiType&), const std::string& input)
- {
- SubString token(input, " ", SubString::WhiteSpaces, true, '\\', false, '"', false, '\0', '\0', false, '\0');
- int index = -1;
- bool success = false;
-
- if (token.size() > 0)
- success = convertValue(&index, token[0]);
-
- if (!success || index < 0 || index > (signed int)MAX_VECTOR_INDEX)
- {
- if (!success)
- {
- orxout(user_error, context::config) << "Config-value '" << this->varname_ << "' in " << this->sectionname_ << " is a vector." << endl;
- }
- else
- {
- orxout(user_error, context::config) << "Invalid vector-index." << endl;
- }
- return false;
- }
-
- if (token.size() >= 2)
- return (this->*function)(index, token.subSet(1).join());
- else
- return (this->*function)(index, "");
- }
-
- /**
- @brief Adds a description to the config-value.
- @param description The description
- */
- ConfigValueContainer& ConfigValueContainer::description(const std::string& description)
- {
- if (!this->bAddedDescription_)
- {
- this->description_ = std::string("ConfigValueDescription::" + this->sectionname_ + "::" + this->varname_);
- AddLanguageEntry(this->description_, description);
- this->bAddedDescription_ = true;
- }
- return (*this);
- }
-
- /**
- @brief Returns the description of the config-value.
- @return The description
- */
- const std::string& ConfigValueContainer::getDescription() const
- {
- return GetLocalisation(this->description_);
- }
-}
Deleted: code/trunk/src/libraries/core/ConfigValueContainer.h
===================================================================
--- code/trunk/src/libraries/core/ConfigValueContainer.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/ConfigValueContainer.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,305 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @ingroup Config ConfigFile
- @brief Declaration of the ConfigValueContainer class, caches a config-value.
-
- The ConfigValueContainer class contains all needed information about a configurable variable:
- - the name of the variable
- - the name of the class the variable belongs to
- - the default value
- - the user-specified value
- - a pointer to the entry in the config-file
-
- This is needed to assign the configured values to all newly created objects.
-*/
-
-#ifndef _ConfigValueContainer_H__
-#define _ConfigValueContainer_H__
-
-#include "CorePrereqs.h"
-
-#include <string>
-#include <vector>
-
-#include "util/MultiType.h"
-#include "Identifier.h"
-
-namespace orxonox
-{
- class ConfigValueCallbackBase
- {
- public:
- virtual void call(void* object) = 0;
- inline virtual ~ConfigValueCallbackBase() {}
- };
-
- template <class T>
- class ConfigValueCallback: public ConfigValueCallbackBase
- {
- public:
- inline ConfigValueCallback(void (T::*function) (void)) : function_(function) {}
- inline virtual ~ConfigValueCallback() {}
- inline virtual void call(void* object)
- {
- if (!Identifier::isCreatingHierarchy())
- (static_cast<T*>(object)->*this->function_)();
- }
-
- private:
- void (T::*function_) (void);
- };
-
-
- /**
- @brief The ConfigValuecontainer contains all needed information about a configurable variable.
-
- The ConfigValueContainer class contains all needed information about a configurable variable:
- - the name of the variable
- - the name of the class the variable belongs to
- - the default value
- - the user-specified value
- - a pointer to the entry in the config-file
-
- This is needed to assign the configured values to all newly created objects.
-
- The container searches for the entry in the config file.
- If there is an entry, it parses the specified value and assigns it to the variable of the right type.
- If there is no entry, it adds the entry with the default-value to the section of the variables class.
- If there is no section, the section and the entry are added to the end of the config-file.
- */
- class _CoreExport ConfigValueContainer
- {
- public:
- /**
- @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
- @param type The type of the corresponding config-file
- @param identifier The identifier of the class the variable belongs to
- @param sectionname Name of the section the configValue should be put in.
- @param varname The name of the variable
- @param defvalue The default-value
- @param value Only needed do determine the right type.
- */
- template <class D, class V>
- ConfigValueContainer(ConfigFileType::Value type, Identifier* identifier, const std::string& sectionname, const std::string& varname, const D& defvalue, const V&)
- {
- this->init(type, identifier, sectionname, varname);
- this->initValue(static_cast<V>(defvalue));
- }
-
- /**
- @brief Constructor: Converts the default-value to a string, checks the config-file for a changed value, sets the intern value variable.
- @param type The type of the corresponding config-file
- @param identifier The identifier of the class the variable belongs to
- @param sectionname Name of the section the configValue should be put in.
- @param varname The name of the variable
- @param defvalue The default-value
- @param value Only needed do determine the right type.
- */
- template <class D, class V>
- ConfigValueContainer(ConfigFileType::Value type, Identifier* identifier, const std::string& sectionname, const std::string& varname, const std::vector<D>& defvalue, const std::vector<V>&)
- {
- this->init(type, identifier, sectionname, varname);
-
- this->value_ = V();
- for (unsigned int i = 0; i < defvalue.size(); i++)
- this->valueVector_.push_back(MultiType(defvalue[i]));
-
- this->initVector();
- }
-
- ~ConfigValueContainer();
-
- /**
- @brief Returns the configured value.
- @param value A pointer to the variable to store the value.
- @param object The object calling this function
- @return The ConfigValueContainer
- */
- template <typename T, class C>
- ConfigValueContainer& getValue(T* value, C* object)
- {
- if ((this->callback_ && object) || this->bContainerIsNew_)
- {
- T temp = *value;
- this->value_.getValue(value);
- if (this->bContainerIsNew_ || (*value) != temp)
- {
- this->bContainerIsNew_ = false;
- if (this->callback_ && object)
- this->callback_->call(object);
- else
- this->bDoInitialCallback_ = true;
- }
- }
- else
- {
- this->value_.getValue(value);
- }
- return *this;
- }
-
- /**
- @brief Returns the configured vector.
- @param value A pointer to the vector to store the values.
- @param object The object calling this function
- @return The ConfigValueContainer
- */
- template <typename T, class C>
- ConfigValueContainer& getValue(std::vector<T>* value, C* object)
- {
- if ((this->callback_ && object) || this->bContainerIsNew_)
- {
- if (this->bContainerIsNew_)
- this->bContainerIsNew_ = false;
-
- std::vector<T> temp = *value;
- value->clear();
- for (unsigned int i = 0; i < this->valueVector_.size(); ++i)
- value->push_back(this->valueVector_[i]);
-
- if (value->size() != temp.size())
- {
- if (this->callback_ && object)
- this->callback_->call(object);
- else
- this->bDoInitialCallback_ = true;
- }
- else
- {
- for (unsigned int i = 0; i < value->size(); ++i)
- {
- if ((*value)[i] != temp[i])
- {
- if (this->callback_ && object)
- this->callback_->call(object);
- else
- this->bDoInitialCallback_ = true;
- break;
- }
- }
- }
- }
- else
- {
- value->clear();
- for (unsigned int i = 0; i < this->valueVector_.size(); ++i)
- value->push_back(this->valueVector_[i]);
- }
- return *this;
- }
-
- /// Returns the name of this container.
- inline const std::string& getName() const
- { return this->varname_; }
- /// Returns the name of the section this config value is in.
- inline const std::string& getSectionName() const
- { return this->sectionname_; }
- /// Returns the associated identifier (can be NULL).
- inline Identifier* getIdentifier() const
- { return this->identifier_; }
- /// Returns true if this config-value is a vector.
- inline bool isVector() const
- { return this->bIsVector_; }
- /// Returns the vectors size (or zero if it's not a vector).
- inline unsigned int getVectorSize() const
- { return this->valueVector_.size(); }
-
- ConfigValueContainer& description(const std::string& description);
- const std::string& getDescription() const;
-
- /**
- @brief Adds a callback function, that gets called after getValue() if the newly assigned value differs from the old value of the variable.
- @param object The object to call the function
- @param function The callback function
- */
- template <class T>
- inline ConfigValueContainer& callback(T* object, void (T::*function) (void))
- {
- if (!this->callback_)
- {
- this->callback_ = new ConfigValueCallback<T>(function);
-
- if (this->bDoInitialCallback_)
- {
- this->bDoInitialCallback_ = false;
- this->callback_->call(object);
- }
- }
-
- return (*this);
- }
-
- bool set(const MultiType& input);
- bool tset(const MultiType& input);
-
- bool set(unsigned int index, const MultiType& input);
- bool tset(unsigned int index, const MultiType& input);
- bool add(const MultiType& input);
- bool remove(unsigned int index);
-
- bool reset();
- void update();
-
- /// Converts the config-value to a string.
- inline std::string toString() const
- { return this->value_; }
- /// Returns the typename of the assigned config-value.
- inline std::string getTypename() const
- { return this->value_.getTypename(); }
-
- private:
- void init(ConfigFileType::Value type, Identifier* identifier, const std::string& sectionname, const std::string& varname);
- void initValue(const MultiType& defvalue);
- void initVector();
- bool callFunctionWithIndex(bool (ConfigValueContainer::* function) (unsigned int, const MultiType&), const std::string& input);
-
- bool bIsVector_; //!< True if the container contains a std::vector
-
- ConfigFileType::Value type_; //!< The type of the corresponding config-file
- Identifier* identifier_; //!< The identifier of the class
- std::string sectionname_; //!< The name of the class the variable belongs to
- std::string varname_; //!< The name of the variable
- std::string defvalueString_; //!< The string of the default-value
- std::vector<std::string> defvalueStringVector_; //!< A vector, containg the strings of the default-values in case we're storing a vector
-
- MultiType value_; //!< The value
- std::vector<MultiType> valueVector_; //!< A vector, containg the values in case we're storing a vector
-
- bool bAddedDescription_; //!< True if a description was added
- LanguageEntryLabel description_; //!< The description
- ConfigValueCallbackBase* callback_; //!< A callback function to call after getValue if the value changed
-
- bool bContainerIsNew_; //!< True if it's the first time getValue() gets called
- bool bDoInitialCallback_; //!< True if the callback should be called as soon as it gets created
- };
-}
-
-#endif /* _ConfigValueContainer_H__ */
Deleted: code/trunk/src/libraries/core/ConfigValueIncludes.h
===================================================================
--- code/trunk/src/libraries/core/ConfigValueIncludes.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/ConfigValueIncludes.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,272 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * Reto Grieder (functions)
- *
- */
-
-/**
- @defgroup ConfigFile Config file
- @ingroup Config
-*/
-
-/**
- @file
- @ingroup Config ConfigFile
- @brief Definition of macros and functions for config-values.
-
- An example of how to use SetConfigValue():
-
- Definition of a class in the header-file:
- @code
- class MyClass : public BaseObject
- {
- public:
- MyClass(); // Constructor
- void setConfigValues(); // Inherited function
-
- const std::string& getName()
- { return this->name_; }
-
- float getVersion()
- { return this->version_; }
-
- private:
- std::string name_;
- float version_;
- };
- @endcode
-
- Implementation of the class source-file:
- @code
- MyClass::MyClass()
- {
- // Macro-call to create an Identifier
- RegisterObject(MyClass);
-
- // Function-call to assign the config-values to the new object
- this->setConfigValues();
- }
-
- void MyClass::setConfigValues()
- {
- SetConfigValue(name_, "Orxonox").description("The name of the game");
- SetConfigValue(version_, "1.0").description("The version-number");
- }
- @endcode
-
- Extract of orxonox.ini:
- @code
- [MyClass]
- name_ = "Orxonox"
- version_ = 1.1 // We have changed this value from 1.0 to 1.1
- @endcode
-
- Some other code:
- @code
- MyObject orxonoxobject;
- orxout() << "Name: " << orxonoxobject.getName() << endl;
- orxout() << "Version: " << orxonoxobject.getVersion() << endl;
- @endcode
-
- Output:
- @code
- Name: Orxonox
- Version: 1.1
- @endcode
-*/
-
-#ifndef _ConfigValueIncludes_H__
-#define _ConfigValueIncludes_H__
-
-#include "CorePrereqs.h"
-
-#include "Identifier.h"
-#include "ConfigValueContainer.h"
-
-namespace orxonox
-{
- /** Sets a runtime configurable value.
- If the container for the value doesn't yet exist, a new one is created.
- Also, the @a variable argument will be modified and set to the new value (default or from ini file).
- @param object
- Class instance that the config value should belong to (usually just 'this')
- @param variable
- Pointer to the variable where the value should be written to
- @param type
- Type of the config file, usually ConfigFileType::Settings
- @param sectionName
- Name of the section in the ini file (e.g. [MySection])
- @param entryName
- Name of the entry in the ini file (e.g. [MySection] myValue)
- @param defaultValue
- Value to be used if it cannot be read from the ini file
- */
- template <class T, class D, class V>
- inline ConfigValueContainer& setConfigValueGeneric(T* object, V* variable, ConfigFileType::Value type, const std::string& sectionName, const std::string& entryName, const D& defaultValue)
- {
- ConfigValueContainer* container = ClassIdentifier<T>::getIdentifier()->getConfigValueContainer(entryName);
- if (!container)
- {
- container = new ConfigValueContainer(type, ClassIdentifier<T>::getIdentifier(), sectionName, entryName, defaultValue, *variable);
- ClassIdentifier<T>::getIdentifier()->addConfigValueContainer(entryName, container);
- }
- return container->getValue(variable, object);
- }
-}
-
-/** Sets a runtime configurable value (simplified macro version of setConfigValueGeneric)
- If the container for the value doesn't yet exist, a new one is created.
- Also, the @a varname argument will be modified and set to the new value (default or from ini file).
- at param varname
- Variable name as C++ identifier. It will be used as entry name and as variable pointer
- at param defaultValue
- Value to be used if it cannot be read from the ini file
-*/
-#define SetConfigValue(varname, defaultValue) \
- orxonox::setConfigValueGeneric(this, &varname, ConfigFileType::Settings, this->getIdentifier()->getName(), #varname, defaultValue)
-
-/** Sets a runtime configurable value (simplified macro version of setConfigValueGeneric)
- If the container for the value doesn't yet exist, a new one is created.
- Also, the @a varname argument will be modified and set to the new value (default or from ini file).
- at param variable
- Variable name as C++ identifier.
- at param entryName
- Name of the entry in the ini file (e.g. [MySection] myValue)
- at param defaultValue
- Value to be used if it cannot be read from the ini file
-*/
-#define SetConfigValueAlias(variable, entryName, defaultValue) \
- orxonox::setConfigValueGeneric(this, &variable, ConfigFileType::Settings, this->getIdentifier()->getName(), entryName, defaultValue)
-
-/** Sets a runtime configurable value (simplified macro version of setConfigValueGeneric)
- If the container for the value doesn't yet exist, a new one is created.
- Also, the @a varname argument will be modified and set to the new value (default or from ini file).
- at param variable
- Variable name as C++ identifier.
- at param sectionName
- Name of the section in the ini file (e.g. [MySection])
- at param entryName
- Name of the entry in the ini file (e.g. [MySection] myValue)
- at param defaultValue
- Value to be used if it cannot be read from the ini file
-*/
-#define SetConfigValueExternal(variable, sectionName, entryName, defaultValue) \
- orxonox::setConfigValueGeneric(this, &variable, ConfigFileType::Settings, sectionName, entryName, defaultValue)
-
-
-namespace orxonox
-{
- /** Resets a runtime configurable value to its default.
- If the container for the value doesn't yet exist, a warning is displayed.
- Also, the @a variable argument will be modified and set to the default value.
- @param object
- Class instance that the config value should belong to (usually just 'this')
- @param variable
- Pointer to the variable where the value should be written to
- @param entryName
- Name of the entry in the ini file (e.g. [MySection] myValue)
- */
- template <class T, class V>
- inline void resetConfigValueGeneric(T* object, V* variable, const std::string& entryName)
- {
- ConfigValueContainer* container = ClassIdentifier<T>::getIdentifier()->getConfigValueContainer(entryName);
- if (container)
- {
- container->reset();
- container->getValue(variable, object);
- }
- else
- {
- orxout(user_warning, context::config) << "Couldn't reset config-value '" << entryName << "' in class '"
- << ClassIdentifier<T>::getIdentifier()->getName() << "', corresponding container doesn't exist." << endl;
- }
- }
-}
-
-/** Resets a runtime configurable value to its default (simplified macro version of modifyConfigValueGeneric)
- If the container for the value doesn't yet exist, a warning is displayed.
- Also, the @a varname argument will be modified and set to the default value.
- at param varname
- Variable name as C++ identifier. It will be used as entry name and as variable pointer
-*/
-#define ResetConfigValue(varname) \
- orxonox::resetConfigValueGeneric(this, &varname, #varname)
-
-
-/** Modifies a runtime configurable value by using a modifier and some arguments.
- If the container for the value doesn't yet exist, a warning is displayed.
- Also, the @a variable argument will be modified and set to the current value.
- at param object
- Class instance that the config value should belong to (usually just 'this')
- at param variable
- Pointer to the variable where the value should be written to
- at param entryName
- Name of the entry in the ini file (e.g. [MySection] myValue)
- at param modifier
- On of these functions: set, tset, add, remove, reset, update
- at param ...
- Arguments for the modifier function
-*/
-#define ModifyConfigValueGeneric(object, variable, entryName, modifier, ...) \
- if (orxonox::ConfigValueContainer* container = ClassByObjectType(object)->getConfigValueContainer(entryName)) \
- { \
- container->modifier(__VA_ARGS__); \
- container->getValue(variable, object); \
- } \
- else \
- { \
- orxout(user_warning, context::config) << "Couldn't modify config-value '" << entryName << "' in class '" \
- << ClassByObjectType(object)->getName() << "', corresponding container doesn't exist." << endl; \
- }
-
-/** Modifies a runtime configurable value by using a modifier and some arguments.
- If the container for the value doesn't yet exist, a warning is displayed.
- Also, the @a varname argument will be modified and set to the current value.
- at param varname
- Variable name as C++ identifier. It will be used as entry name and as variable pointer
- at param modifier
- On of these functions: set, tset, add, remove, reset, update
- at param ...
- Arguments for the modifier function
-*/
-#define ModifyConfigValue(varname, modifier, ...) \
- ModifyConfigValueGeneric(this, &varname, #varname, modifier, __VA_ARGS__)
-
-/** Modifies a runtime configurable value by using a modifier and some arguments.
- If the container for the value doesn't yet exist, a warning is displayed.
- Also, the @a variable argument will be modified and set to the current value.
- at param variable
- Pointer to the variable where the value should be written to
- at param entryName
- Name of the entry in the ini file (e.g. [MySection] myValue)
- at param modifier
- On of these functions: set, tset, add, remove, reset, update
- at param ...
- Arguments for the modifier function
-*/
-#define ModifyConfigValueExternal(variable, entryName, modifier, ...) \
- ModifyConfigValueGeneric(this, &variable, entryName, modifier, __VA_ARGS__)
-
-#endif /* _ConfigValueIncludes_H__ */
Modified: code/trunk/src/libraries/core/Core.cc
===================================================================
--- code/trunk/src/libraries/core/Core.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/Core.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -59,23 +59,23 @@
#include "util/ScopedSingletonManager.h"
#include "util/SignalHandler.h"
#include "PathConfig.h"
-#include "CommandLineParser.h"
-#include "ConfigFileManager.h"
-#include "ConfigValueIncludes.h"
+#include "config/CommandLineParser.h"
+#include "config/ConfigFileManager.h"
+#include "config/ConfigValueIncludes.h"
#include "CoreIncludes.h"
#include "DynLibManager.h"
#include "GameMode.h"
#include "GraphicsManager.h"
#include "GUIManager.h"
-#include "Identifier.h"
+#include "class/Identifier.h"
#include "Language.h"
#include "LuaState.h"
-#include "ObjectList.h"
#include "command/ConsoleCommand.h"
#include "command/IOConsole.h"
#include "command/TclBind.h"
#include "command/TclThreadManager.h"
#include "input/InputManager.h"
+#include "object/ObjectList.h"
namespace orxonox
{
@@ -91,6 +91,9 @@
SetCommandLineArgument(limitToCPU, 0).information("Limits the program to one CPU/core (1, 2, 3, etc.). Default is off = 0.");
#endif
+ // register Core as an abstract class to avoid problems if the class hierarchy is created within Core-constructor
+ RegisterAbstractClass(Core).inheritsFrom(Class(Configurable));
+
Core::Core(const std::string& cmdLine)
: pathConfig_(NULL)
, dynLibManager_(NULL)
@@ -175,7 +178,7 @@
// Do this soon after the ConfigFileManager has been created to open up the
// possibility to configure everything below here
- RegisterRootObject(Core);
+ RegisterObject(Core);
orxout(internal_info) << "configuring Core" << endl;
this->setConfigValues();
@@ -197,7 +200,7 @@
// creates the class hierarchy for all classes with factories
orxout(internal_info) << "creating class hierarchy" << endl;
- Identifier::createClassHierarchy();
+ IdentifierManager::getInstance().createClassHierarchy();
// Load OGRE excluding the renderer and the render window
orxout(internal_info) << "creating GraphicsManager:" << endl;
@@ -247,7 +250,8 @@
safeObjectDelete(&languageInstance_);
safeObjectDelete(&configFileManager_);
ConsoleCommand::destroyAll();
- Identifier::destroyAllIdentifiers();
+ Context::setRootContext(NULL);
+ IdentifierManager::getInstance().destroyAllIdentifiers();
safeObjectDelete(&signalHandler_);
safeObjectDelete(&dynLibManager_);
safeObjectDelete(&pathConfig_);
@@ -507,8 +511,10 @@
}
+ RegisterAbstractClass(DevModeListener).inheritsFrom(Class(Listable));
+
DevModeListener::DevModeListener()
{
- RegisterRootObject(DevModeListener);
+ RegisterObject(DevModeListener);
}
}
Modified: code/trunk/src/libraries/core/Core.h
===================================================================
--- code/trunk/src/libraries/core/Core.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/Core.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -46,12 +46,12 @@
#include <string>
#include "util/DestructionHelper.h"
#include "util/Singleton.h"
-#include "OrxonoxClass.h"
+#include "config/Configurable.h"
namespace orxonox
{
//! Informs about changes in the Development Mode.
- class DevModeListener : virtual public OrxonoxClass
+ class DevModeListener : virtual public Listable
{
public:
DevModeListener();
@@ -65,7 +65,7 @@
@remark
You should only create this singleton once because it destroys the identifiers!
*/
- class _CoreExport Core : public Singleton<Core>, public OrxonoxClass
+ class _CoreExport Core : public Singleton<Core>, public Configurable
{
friend class Singleton<Core>;
friend class Game;
Modified: code/trunk/src/libraries/core/CoreIncludes.h
===================================================================
--- code/trunk/src/libraries/core/CoreIncludes.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/CoreIncludes.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -27,27 +27,29 @@
*/
/**
- @defgroup Factory RegisterObject() and CreateFactory()
+ @defgroup Factory RegisterObject() and RegisterClass()
@ingroup Object
*/
/**
@file
@ingroup Object Factory Class Identifier
- @brief Defines several very important macros used to register objects, create factories, and to work with identifiers.
+ @brief Defines several very important macros used to register objects, register classes, and to work with identifiers.
- Every class needs the @c RegisterObject(class) macro in its constructor. If the class is an interface
- or the @c BaseObject itself, it needs the macro @c RegisterRootObject(class) instead.
+ Every class needs the @c RegisterObject(class) macro in its constructor.
- To allow the object being created through the factory, use the @c CreateFactory(class) macro outside
- of the class implementation, so it gets executed statically before @c main(). This will at the same time
- register @a class in the class-hierarchy. If you don't want @a class to be loadable, but still
- register it, call @c CreateUnloadableFactory(class).
+ To register @a class in the class-hierarchy, use the @c RegisterClass(class) macro outside of the class implementation,
+ so it gets executed statically before @c main(). If you don't want @a class to be loadable, but still register it, call
+ @c RegisterUnloadableClass(class).
+ Abstract classes are registered with @c RegisterAbstractClass(class). For abstract classes, the inheritance must be
+ defined manually with @c RegisterAbstractClass(class).inheritsFrom(Class(parent)). Multiple parent classes can be defined
+ by chaining the above command.
+
Example:
@code
- // Create the factory for MyClass
- CreateFactory(MyClass);
+ // register MyClass
+ RegisterClass(MyClass);
// Constructor:
MyClass::MyClass()
@@ -78,52 +80,61 @@
#include "CorePrereqs.h"
#include "util/Output.h"
-#include "Identifier.h"
-#include "ClassFactory.h"
-#include "ObjectList.h"
+#include "class/IdentifierManager.h"
+#include "object/ClassFactory.h"
+#include "object/ObjectList.h"
+// resolve macro conflict on windows
+#if defined(ORXONOX_PLATFORM_WINDOWS)
+# include <windows.h>
+# undef RegisterClass
+#endif
+
/**
- @brief Intern macro, containing the common parts of @c RegisterObject and @c RegisterRootObject.
+ @brief Registers the class in the framework.
@param ClassName The name of the class
- @param bRootClass True if the class is directly derived from orxonox::OrxonoxClass
*/
-#define InternRegisterObject(ClassName, bRootClass) \
- if (ClassIdentifier<ClassName>::getIdentifier(#ClassName)->initialiseObject(this, #ClassName, bRootClass)) \
- return; \
- else \
- ((void)0)
+#define RegisterClass(ClassName) \
+ RegisterClassWithFactory(ClassName, new orxonox::ClassFactoryWithContext<ClassName>(), true)
/**
- @brief Registers a newly created object in the core. Has to be called at the beginning of the constructor of @a ClassName.
+ @brief Registers the class in the framework (for classes without arguments in their constructor).
@param ClassName The name of the class
*/
-#define RegisterObject(ClassName) \
- InternRegisterObject(ClassName, false)
+#define RegisterClassNoArgs(ClassName) \
+ RegisterClassWithFactory(ClassName, new orxonox::ClassFactoryNoArgs<ClassName>(), true)
/**
- @brief Registers a newly created object in the core. Has to be called at the beginning of the constructor of @a ClassName.
+ @brief Registers the class in the framework (for classes which should not be loaded through XML).
@param ClassName The name of the class
+*/
+#define RegisterUnloadableClass(ClassName) \
+ RegisterClassWithFactory(ClassName, new orxonox::ClassFactoryWithContext<ClassName>(), false)
- In contrast to RegisterObject, this is used for classes that inherit directly from
- orxonox::OrxonoxClass, namely all interfaces and orxonox::BaseObject.
+/**
+ @brief Registers an abstract class in the framework.
+ @param ClassName The name of the class
*/
-#define RegisterRootObject(ClassName) \
- InternRegisterObject(ClassName, true)
+#define RegisterAbstractClass(ClassName) \
+ RegisterClassWithFactory(ClassName, static_cast<ClassFactory<ClassName>*>(NULL), false)
/**
- @brief Creates the Factory.
+ @brief Registers the class in the framework with a given Factory.
@param ClassName The name of the class
*/
-#define CreateFactory(ClassName) \
- Factory* _##ClassName##Factory = new orxonox::ClassFactory<ClassName>(#ClassName, true)
+#define RegisterClassWithFactory(ClassName, FactoryInstance, bLoadable) \
+ Identifier& _##ClassName##Identifier = orxonox::registerClass<ClassName>(#ClassName, FactoryInstance, bLoadable)
/**
- @brief Creates the Factory for classes which should not be loaded through XML.
+ @brief Registers a newly created object in the framework. Has to be called at the beginning of the constructor of @a ClassName.
@param ClassName The name of the class
*/
-#define CreateUnloadableFactory(ClassName) \
- Factory* _##ClassName##Factory = new orxonox::ClassFactory<ClassName>(#ClassName, false)
+#define RegisterObject(ClassName) \
+ if (ClassIdentifier<ClassName>::getIdentifier(#ClassName)->initializeObject(this)) \
+ return; \
+ else \
+ ((void)0)
/**
@brief Returns the Identifier of the given class.
@@ -136,12 +147,37 @@
namespace orxonox
{
/**
+ * @brief Overload of registerClass() which determines T implicitly by the template argument of the ClassFactory.
+ */
+ template <class T>
+ inline Identifier& registerClass(const std::string& name, ClassFactory<T>* factory, bool bLoadable = true)
+ {
+ return registerClass<T>(name, static_cast<Factory*>(factory), bLoadable);
+ }
+
+ /**
+ * @brief Registers a class in the framework.
+ * @param name The name of the class
+ * @param factory The factory which is able to create new instances of this class
+ * @param bLoadable Whether the class is allowed to be loaded through XML
+ */
+ template <class T>
+ inline Identifier& registerClass(const std::string& name, Factory* factory, bool bLoadable = true)
+ {
+ orxout(verbose, context::misc::factory) << "Create entry for " << name << " in Factory." << endl;
+ Identifier* identifier = ClassIdentifier<T>::getIdentifier(name);
+ identifier->setFactory(factory);
+ identifier->setLoadable(bLoadable);
+ return *identifier;
+ }
+
+ /**
@brief Returns the Identifier with a given name.
@param name The name of the class
*/
inline Identifier* ClassByString(const std::string& name)
{
- return Identifier::getIdentifierByString(name);
+ return IdentifierManager::getInstance().getIdentifierByString(name);
}
/**
@@ -150,7 +186,7 @@
*/
inline Identifier* ClassByLowercaseString(const std::string& name)
{
- return Identifier::getIdentifierByLowercaseString(name);
+ return IdentifierManager::getInstance().getIdentifierByLowercaseString(name);
}
/**
@@ -159,14 +195,14 @@
*/
inline Identifier* ClassByID(uint32_t id)
{
- return Identifier::getIdentifierByID(id);
+ return IdentifierManager::getInstance().getIdentifierByID(id);
}
/**
@brief Returns the Identifier with a given 'this' pointer.
- @note This of course only works with OrxonoxClasses.
+ @note This of course only works with Identifiables.
The only use is in conjunction with macros that don't know the class type.
- @param object Pointer to an OrxonoxClass
+ @param object Pointer to an Identifiable
*/
template <class T>
inline Identifier* ClassByObjectType(const T*)
Modified: code/trunk/src/libraries/core/CorePrereqs.h
===================================================================
--- code/trunk/src/libraries/core/CorePrereqs.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/CorePrereqs.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -126,6 +126,8 @@
template <class T>
class ClassFactory;
template <class T>
+ class ClassFactoryWithContext;
+ template <class T>
class ClassIdentifier;
class ClassTreeMask;
class ClassTreeMaskIterator;
@@ -139,8 +141,11 @@
class ConfigFileEntryValue;
class ConfigFileManager;
class ConfigFileSection;
+ class Configurable;
class ConfigValueContainer;
+ class Context;
class Core;
+ class Destroyable;
class DestructionListener;
class DynLib;
class DynLibManager;
@@ -153,16 +158,16 @@
struct GameStateTreeNode;
class GraphicsManager;
class GUIManager;
+ class Identifiable;
class Identifier;
template <class T>
class Iterator;
class Language;
+ class Listable;
class LuaFunctor;
class LuaState;
class MemoryArchive;
class MemoryArchiveFactory;
- class MetaObjectList;
- class MetaObjectListElement;
class Namespace;
class NamespaceNode;
template <class T>
@@ -175,6 +180,7 @@
class ObjectListIterator;
class OgreWindowEventListener;
class OrxonoxClass;
+ class OrxonoxInterface;
class PathConfig;
struct ResourceInfo;
class SettingsConfigFile;
Modified: code/trunk/src/libraries/core/Event.cc
===================================================================
--- code/trunk/src/libraries/core/Event.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/Event.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,7 +34,7 @@
#include "Event.h"
#include "BaseObject.h"
-#include "Identifier.h"
+#include "class/Identifier.h"
namespace orxonox
{
Modified: code/trunk/src/libraries/core/GUIManager.cc
===================================================================
--- code/trunk/src/libraries/core/GUIManager.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/GUIManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -77,7 +77,7 @@
#include "util/Math.h"
#include "util/OrxAssert.h"
#include "util/output/BaseWriter.h"
-#include "ConfigValueIncludes.h"
+#include "config/ConfigValueIncludes.h"
#include "Core.h"
#include "CoreIncludes.h"
#include "Game.h"
@@ -255,7 +255,7 @@
, camera_(NULL)
, destructionHelper_(this)
{
- RegisterRootObject(GUIManager);
+ RegisterObject(GUIManager);
orxout(internal_status) << "initializing GUIManager..." << endl;
Modified: code/trunk/src/libraries/core/GUIManager.h
===================================================================
--- code/trunk/src/libraries/core/GUIManager.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/GUIManager.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -48,7 +48,6 @@
#include "util/tribool.h"
#include "util/Singleton.h"
#include "input/InputHandler.h"
-#include "OrxonoxClass.h"
#include "WindowEventListener.h"
#if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7
Modified: code/trunk/src/libraries/core/Game.cc
===================================================================
--- code/trunk/src/libraries/core/Game.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/Game.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,10 +43,10 @@
#include "util/Exception.h"
#include "util/Sleep.h"
#include "util/SubString.h"
-#include "CommandLineParser.h"
#include "Core.h"
#include "CoreIncludes.h"
-#include "ConfigValueIncludes.h"
+#include "config/CommandLineParser.h"
+#include "config/ConfigValueIncludes.h"
#include "GameMode.h"
#include "GameState.h"
#include "GraphicsManager.h"
@@ -111,7 +111,7 @@
this->core_ = new Core(cmdLine);
// Do this after the Core creation!
- RegisterRootObject(Game);
+ RegisterObject(Game);
this->setConfigValues();
// After the core has been created, we can safely instantiate the GameStates that don't require graphics
Modified: code/trunk/src/libraries/core/Game.h
===================================================================
--- code/trunk/src/libraries/core/Game.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/Game.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -49,7 +49,7 @@
#include "util/Output.h"
#include "util/DestructionHelper.h"
#include "util/Singleton.h"
-#include "OrxonoxClass.h"
+#include "config/Configurable.h"
/**
@brief
@@ -81,7 +81,7 @@
// tolua_begin
class _CoreExport Game
// tolua_end
- : public Singleton<Game>, public OrxonoxClass
+ : public Singleton<Game>, public Configurable
{ // tolua_export
friend class Singleton<Game>;
typedef std::vector<shared_ptr<GameState> > GameStateVector;
Modified: code/trunk/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/trunk/src/libraries/core/GraphicsManager.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/GraphicsManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -51,7 +51,7 @@
#include "util/Exception.h"
#include "util/StringUtils.h"
#include "util/SubString.h"
-#include "ConfigValueIncludes.h"
+#include "config/ConfigValueIncludes.h"
#include "CoreIncludes.h"
#include "Core.h"
#include "Game.h"
Modified: code/trunk/src/libraries/core/GraphicsManager.h
===================================================================
--- code/trunk/src/libraries/core/GraphicsManager.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/GraphicsManager.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -51,7 +51,7 @@
#include "util/DestructionHelper.h"
#include "util/Singleton.h"
-#include "OrxonoxClass.h"
+#include "config/Configurable.h"
// tolua_begin
namespace orxonox
@@ -62,7 +62,7 @@
*/
class _CoreExport GraphicsManager
// tolua_end
- : public Singleton<GraphicsManager>, public OrxonoxClass, public Ogre::LogListener
+ : public Singleton<GraphicsManager>, public Configurable, public Ogre::LogListener
{ // tolua_export
friend class Singleton<GraphicsManager>;
public:
Deleted: code/trunk/src/libraries/core/Identifier.cc
===================================================================
--- code/trunk/src/libraries/core/Identifier.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/Identifier.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,507 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief Implementation of the Identifier class.
-*/
-
-#include "Identifier.h"
-
-#include <ostream>
-
-#include "util/StringUtils.h"
-#include "ConfigValueContainer.h"
-#include "ClassFactory.h"
-#include "XMLPort.h"
-
-namespace orxonox
-{
- // ###############################
- // ### Identifier ###
- // ###############################
- int Identifier::hierarchyCreatingCounter_s = 0;
- unsigned int Identifier::classIDCounter_s = 0;
-
- /**
- @brief Constructor: No factory, no object created, new ObjectList and a unique networkID.
- */
- Identifier::Identifier()
- : classID_(classIDCounter_s++)
- {
- this->objects_ = new ObjectListBase(this);
-
- this->bCreatedOneObject_ = false;
- this->bSetName_ = false;
- this->factory_ = 0;
- this->bLoadable_ = false;
-
- this->bHasConfigValues_ = false;
-
- // Default network ID is the class ID
- this->networkID_ = this->classID_;
- }
-
- /**
- @brief Destructor: Deletes the list containing the children.
- */
- Identifier::~Identifier()
- {
- delete this->objects_;
-
- if (this->factory_)
- delete this->factory_;
-
- for (std::map<std::string, ConfigValueContainer*>::iterator it = this->configValues_.begin(); it != this->configValues_.end(); ++it)
- delete (it->second);
- for (std::map<std::string, XMLPortParamContainer*>::iterator it = this->xmlportParamContainers_.begin(); it != this->xmlportParamContainers_.end(); ++it)
- delete (it->second);
- for (std::map<std::string, XMLPortObjectContainer*>::iterator it = this->xmlportObjectContainers_.begin(); it != this->xmlportObjectContainers_.end(); ++it)
- delete (it->second);
- }
-
- /**
- @brief Returns the identifier map with the names as received by typeid(). This is only used internally.
- */
- std::map<std::string, Identifier*>& Identifier::getTypeIDIdentifierMap()
- {
- static std::map<std::string, Identifier*> identifiers; //!< The map to store all Identifiers.
- return identifiers;
- }
-
- /**
- @brief Returns an identifier by name and adds it if not available
- @param name The name of the identifier as typeid().name() suggests
- @param proposal A pointer to a newly created identifier for the case of non existence in the map
- @return The identifier (unique instance)
- */
- Identifier* Identifier::getIdentifierSingleton(const std::string& name, Identifier* proposal)
- {
- std::map<std::string, Identifier*>::const_iterator it = getTypeIDIdentifierMap().find(name);
-
- if (it != getTypeIDIdentifierMap().end())
- {
- // There is already an entry: return it and delete the proposal
- delete proposal;
- return it->second;
- }
- else
- {
- // There is no entry: put the proposal into the map and return it
- getTypeIDIdentifierMap()[name] = proposal;
- return proposal;
- }
- }
-
- /**
- @brief Registers a class, which means that the name and the parents get stored.
- @param parents A list, containing the Identifiers of all parents of the class
- @param bRootClass True if the class is either an Interface or the BaseObject itself
- */
- void Identifier::initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass)
- {
- // Check if at least one object of the given type was created
- if (!this->bCreatedOneObject_ && Identifier::isCreatingHierarchy())
- {
- // If no: We have to store the information and initialize the Identifier
- orxout(verbose, context::identifier) << "Register Class in ClassIdentifier<" << this->getName() << ">-Singleton -> Initialize Singleton." << endl;
- if (bRootClass)
- this->initialize(0); // If a class is derived from two interfaces, the second interface might think it's derived from the first because of the order of constructor-calls. Thats why we set parents to zero in that case.
- else
- this->initialize(parents);
- }
- }
-
- /**
- @brief Initializes the Identifier with a list containing all parents of the class the Identifier belongs to.
- @param parents A list containing all parents
- */
- void Identifier::initialize(std::set<const Identifier*>* parents)
- {
- orxout(verbose, context::identifier) << "Initialize ClassIdentifier<" << this->name_ << ">-Singleton." << endl;
- this->bCreatedOneObject_ = true;
-
- if (parents)
- {
- this->parents_ = (*parents);
- this->directParents_ = (*parents);
-
- // Iterate through all parents
- for (std::set<const Identifier*>::iterator it = parents->begin(); it != parents->end(); ++it)
- {
- // Tell the parent we're one of it's children
- (*it)->children_.insert((*it)->children_.end(), this);
-
- // Erase all parents of our parent from our direct-parent-list
- for (std::set<const Identifier*>::const_iterator it1 = (*it)->getParents().begin(); it1 != (*it)->getParents().end(); ++it1)
- {
- // Search for the parent's parent in our direct-parent-list
- for (std::set<const Identifier*>::iterator it2 = this->directParents_.begin(); it2 != this->directParents_.end(); ++it2)
- {
- if ((*it1) == (*it2))
- {
- // We've found a non-direct parent in our list: Erase it
- this->directParents_.erase(it2);
- break;
- }
- }
- }
- }
-
- // Now iterate through all direct parents
- for (std::set<const Identifier*>::iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it)
- {
- // Tell the parent we're one of it's direct children
- (*it)->directChildren_.insert((*it)->directChildren_.end(), this);
-
- // Create the super-function dependencies
- (*it)->createSuperFunctionCaller();
- }
- }
- }
-
- /**
- @brief Creates the class-hierarchy by creating and destroying one object of each type.
- */
- void Identifier::createClassHierarchy()
- {
- orxout(internal_status) << "Create class-hierarchy" << endl;
- Identifier::startCreatingHierarchy();
- for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMap().begin(); it != Identifier::getStringIdentifierMap().end(); ++it)
- {
- // To create the new branch of the class-hierarchy, we create a new object and delete it afterwards.
- if (it->second->hasFactory())
- {
- BaseObject* temp = it->second->fabricate(0);
- temp->destroy();
- }
- }
- Identifier::stopCreatingHierarchy();
- orxout(internal_status) << "Finished class-hierarchy creation" << endl;
- }
-
- /**
- @brief Destroys all Identifiers. Called when exiting the program.
- */
- void Identifier::destroyAllIdentifiers()
- {
- for (std::map<std::string, Identifier*>::iterator it = Identifier::getTypeIDIdentifierMap().begin(); it != Identifier::getTypeIDIdentifierMap().end(); ++it)
- delete (it->second);
- }
-
- /**
- @brief Sets the name of the class.
- */
- void Identifier::setName(const std::string& name)
- {
- if (!this->bSetName_)
- {
- this->name_ = name;
- this->bSetName_ = true;
- Identifier::getStringIdentifierMapIntern()[name] = this;
- Identifier::getLowercaseStringIdentifierMapIntern()[getLowercase(name)] = this;
- Identifier::getIDIdentifierMapIntern()[this->networkID_] = this;
- }
- }
-
- /**
- @brief Creates an object of the type the Identifier belongs to.
- @return The new object
- */
- BaseObject* Identifier::fabricate(BaseObject* creator)
- {
- if (this->factory_)
- {
- return this->factory_->fabricate(creator); // We have to return a BaseObject, because we don't know the exact type.
- }
- else
- {
- orxout(user_error) << "An error occurred in Identifier.cc:" << endl;
- orxout(user_error) << "Cannot fabricate an object of type '" << this->name_ << "'. Class has no factory." << endl;
- orxout(user_error) << "Aborting..." << endl;
- abort();
- return 0;
- }
- }
-
- /**
- @brief Sets the network ID to a new value and changes the entry in the ID-Identifier-map.
- */
- void Identifier::setNetworkID(uint32_t id)
- {
-// Identifier::getIDIdentifierMapIntern().erase(this->networkID_);
- Identifier::getIDIdentifierMapIntern()[id] = this;
- this->networkID_ = id;
- }
-
- /**
- @brief Returns true, if the Identifier is at least of the given type.
- @param identifier The identifier to compare with
- */
- bool Identifier::isA(const Identifier* identifier) const
- {
- return (identifier == this || (this->parents_.find(identifier) != this->parents_.end()));
- }
-
- /**
- @brief Returns true, if the Identifier is exactly of the given type.
- @param identifier The identifier to compare with
- */
- bool Identifier::isExactlyA(const Identifier* identifier) const
- {
- return (identifier == this);
- }
-
- /**
- @brief Returns true, if the assigned identifier is a child of the given identifier.
- @param identifier The identifier to compare with
- */
- bool Identifier::isChildOf(const Identifier* identifier) const
- {
- return (this->parents_.find(identifier) != this->parents_.end());
- }
-
- /**
- @brief Returns true, if the assigned identifier is a direct child of the given identifier.
- @param identifier The identifier to compare with
- */
- bool Identifier::isDirectChildOf(const Identifier* identifier) const
- {
- return (this->directParents_.find(identifier) != this->directParents_.end());
- }
-
- /**
- @brief Returns true, if the assigned identifier is a parent of the given identifier.
- @param identifier The identifier to compare with
- */
- bool Identifier::isParentOf(const Identifier* identifier) const
- {
- return (this->children_.find(identifier) != this->children_.end());
- }
-
- /**
- @brief Returns true, if the assigned identifier is a direct parent of the given identifier.
- @param identifier The identifier to compare with
- */
- bool Identifier::isDirectParentOf(const Identifier* identifier) const
- {
- return (this->directChildren_.find(identifier) != this->directChildren_.end());
- }
-
- /**
- @brief Returns the map that stores all Identifiers with their names.
- @return The map
- */
- std::map<std::string, Identifier*>& Identifier::getStringIdentifierMapIntern()
- {
- static std::map<std::string, Identifier*> identifierMap;
- return identifierMap;
- }
-
- /**
- @brief Returns the map that stores all Identifiers with their names in lowercase.
- @return The map
- */
- std::map<std::string, Identifier*>& Identifier::getLowercaseStringIdentifierMapIntern()
- {
- static std::map<std::string, Identifier*> lowercaseIdentifierMap;
- return lowercaseIdentifierMap;
- }
-
- /**
- @brief Returns the map that stores all Identifiers with their network IDs.
- @return The map
- */
- std::map<uint32_t, Identifier*>& Identifier::getIDIdentifierMapIntern()
- {
- static std::map<uint32_t, Identifier*> identifierMap;
- return identifierMap;
- }
-
- /**
- @brief Returns the Identifier with a given name.
- @param name The name of the wanted Identifier
- @return The Identifier
- */
- Identifier* Identifier::getIdentifierByString(const std::string& name)
- {
- std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMapIntern().find(name);
- if (it != Identifier::getStringIdentifierMapIntern().end())
- return it->second;
- else
- return 0;
- }
-
- /**
- @brief Returns the Identifier with a given name in lowercase.
- @param name The name of the wanted Identifier
- @return The Identifier
- */
- Identifier* Identifier::getIdentifierByLowercaseString(const std::string& name)
- {
- std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseStringIdentifierMapIntern().find(name);
- if (it != Identifier::getLowercaseStringIdentifierMapIntern().end())
- return it->second;
- else
- return 0;
- }
-
- /**
- @brief Returns the Identifier with a given network ID.
- @param id The network ID of the wanted Identifier
- @return The Identifier
- */
- Identifier* Identifier::getIdentifierByID(const uint32_t id)
- {
- std::map<uint32_t, Identifier*>::const_iterator it = Identifier::getIDIdentifierMapIntern().find(id);
- if (it != Identifier::getIDIdentifierMapIntern().end())
- return it->second;
- else
- return 0;
- }
-
- /**
- @brief Cleans the NetworkID map (needed on clients for correct initialization)
- */
- void Identifier::clearNetworkIDs()
- {
- Identifier::getIDIdentifierMapIntern().clear();
- }
-
- /**
- @brief Adds the ConfigValueContainer of a variable, given by the string of its name.
- @param varname The name of the variablee
- @param container The container
- */
- void Identifier::addConfigValueContainer(const std::string& varname, ConfigValueContainer* container)
- {
- std::map<std::string, ConfigValueContainer*>::const_iterator it = this->configValues_.find(varname);
- if (it != this->configValues_.end())
- {
- orxout(internal_warning) << "Overwriting config-value with name " << varname << " in class " << this->getName() << '.' << endl;
- delete (it->second);
- }
-
- this->bHasConfigValues_ = true;
- this->configValues_[varname] = container;
- }
-
- /**
- @brief Returns the ConfigValueContainer of a variable, given by the string of its name.
- @param varname The name of the variable
- @return The ConfigValueContainer
- */
- ConfigValueContainer* Identifier::getConfigValueContainer(const std::string& varname)
- {
- std::map<std::string, ConfigValueContainer*>::const_iterator it = configValues_.find(varname);
- if (it != configValues_.end())
- return it->second;
- else
- return 0;
- }
-
- /**
- @brief Returns a XMLPortParamContainer that loads a parameter of this class.
- @param paramname The name of the parameter
- @return The container
- */
- XMLPortParamContainer* Identifier::getXMLPortParamContainer(const std::string& paramname)
- {
- std::map<std::string, XMLPortParamContainer*>::const_iterator it = this->xmlportParamContainers_.find(paramname);
- if (it != this->xmlportParamContainers_.end())
- return it->second;
- else
- return 0;
- }
-
- /**
- @brief Adds a new XMLPortParamContainer that loads a parameter of this class.
- @param paramname The name of the parameter
- @param container The container
- */
- void Identifier::addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container)
- {
- std::map<std::string, XMLPortParamContainer*>::const_iterator it = this->xmlportParamContainers_.find(paramname);
- if (it != this->xmlportParamContainers_.end())
- {
- orxout(internal_warning) << "Overwriting XMLPortParamContainer in class " << this->getName() << '.' << endl;
- delete (it->second);
- }
-
- this->xmlportParamContainers_[paramname] = container;
- }
-
- /**
- @brief Returns a XMLPortObjectContainer that attaches an object to this class.
- @param sectionname The name of the section that contains the attachable objects
- @return The container
- */
- XMLPortObjectContainer* Identifier::getXMLPortObjectContainer(const std::string& sectionname)
- {
- std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->xmlportObjectContainers_.find(sectionname);
- if (it != this->xmlportObjectContainers_.end())
- return it->second;
- else
- return 0;
- }
-
- /**
- @brief Adds a new XMLPortObjectContainer that attaches an object to this class.
- @param sectionname The name of the section that contains the attachable objects
- @param container The container
- */
- void Identifier::addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container)
- {
- std::map<std::string, XMLPortObjectContainer*>::const_iterator it = this->xmlportObjectContainers_.find(sectionname);
- if (it != this->xmlportObjectContainers_.end())
- {
- orxout(internal_warning) << "Overwriting XMLPortObjectContainer in class " << this->getName() << '.' << endl;
- delete (it->second);
- }
-
- this->xmlportObjectContainers_[sectionname] = container;
- }
-
- /**
- @brief Lists the names of all Identifiers in a std::set<const Identifier*>.
- @param out The outstream
- @param list The list (or set) of Identifiers
- @return The outstream
- */
- std::ostream& operator<<(std::ostream& out, const std::set<const Identifier*>& list)
- {
- for (std::set<const Identifier*>::const_iterator it = list.begin(); it != list.end(); ++it)
- {
- if (it != list.begin())
- out << ' ';
- out << (*it)->getName();
- }
-
- return out;
- }
-}
Deleted: code/trunk/src/libraries/core/Identifier.h
===================================================================
--- code/trunk/src/libraries/core/Identifier.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/Identifier.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,502 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @defgroup Identifier Identifier
- @ingroup Class
-*/
-
-/**
- @file
- @ingroup Class Identifier
- @brief Declaration of Identifier, definition of ClassIdentifier<T>; used to identify the class of an object.
-
- @anchor IdentifierExample
-
- An Identifier "identifies" the class of an object. It contains different information about
- the class: Its name and ID, a list of all instances of this class, a factory to create new
- instances of this class, and more.
-
- It also contains information about the inheritance of this class: It stores a list of the
- Identifiers of all parent-classes as well as a list of all child-classes. These relationships
- can be tested using functions like @c isA(), @c isChildOf(), @c isParentOf(), and more.
-
- Every Identifier is in fact a ClassIdentifier<T> (where T is the class that is identified
- by the Identifier), Identifier is just the common base-class.
-
- Example:
- @code
- MyClass* object = new MyClass(); // create an instance of MyClass
-
- object->getIdentifier()->getName(); // returns "MyClass"
-
- BaseObject* other = object->getIdentifier()->fabricate(0); // fabricates a new instance of MyClass
-
-
- // iterate through all objects of type MyClass:
- ObjectListBase* objects = object->getIdentifier()->getObjects(); // get a pointer to the object-list
- int count;
- for (Iterator<BaseObject> it = objects.begin(); it != objects.end(); ++it) // iterate through the objects
- ++count;
- orxout() << count << endl; // prints "2" because we created 2 instances of MyClass so far
-
-
- // test the class hierarchy
- object->getIdentifier()->isA(Class(MyClass)); // returns true
- object->isA(Class(MyClass)); // returns true (short version)
-
- object->isA(Class(BaseClass)); // returns true if MyClass is a child of BaseClass
-
- Class(ChildClass)->isChildOf(object->getIdentifier()); // returns true if ChildClass is a child of MyClass
- @endcode
-*/
-
-#ifndef _Identifier_H__
-#define _Identifier_H__
-
-#include "CorePrereqs.h"
-
-#include <cassert>
-#include <map>
-#include <set>
-#include <string>
-#include <typeinfo>
-#include <loki/TypeTraits.h>
-
-#include "util/Output.h"
-#include "MetaObjectList.h"
-#include "ObjectList.h"
-#include "ObjectListBase.h"
-#include "Super.h"
-
-namespace orxonox
-{
- // ###############################
- // ### Identifier ###
- // ###############################
- /**
- @brief The Identifier is used to identify the class of an object and to store information about the class.
-
- Each Identifier stores information about one class. The Identifier can then be used to identify
- this class. On the other hand it's also possible to get the corresponding Identifier of a class,
- for example by using the macro Class().
-
- @see See @ref IdentifierExample "Identifier.h" for more information and some examples.
-
- @note You can't directly create an Identifier, it's just the base-class of ClassIdentifier<T>.
- */
- class _CoreExport Identifier
- {
- public:
- /// Returns the name of the class the Identifier belongs to.
- inline const std::string& getName() const { return this->name_; }
- void setName(const std::string& name);
-
- /// Returns the network ID to identify a class through the network.
- inline uint32_t getNetworkID() const { return this->networkID_; }
- void setNetworkID(uint32_t id);
-
- /// Returns the unique ID of the class.
- ORX_FORCEINLINE unsigned int getClassID() const { return this->classID_; }
-
- /// Returns the list of all existing objects of this class.
- inline ObjectListBase* getObjects() const { return this->objects_; }
-
- /// Sets the Factory.
- inline void addFactory(Factory* factory) { this->factory_ = factory; }
- /// Returns true if the Identifier has a Factory.
- inline bool hasFactory() const { return (this->factory_ != 0); }
-
- BaseObject* fabricate(BaseObject* creator);
-
- /// Returns true if the class can be loaded through XML.
- inline bool isLoadable() const { return this->bLoadable_; }
- /// Set the class to be loadable through XML or not.
- inline void setLoadable(bool bLoadable) { this->bLoadable_ = bLoadable; }
-
- bool isA(const Identifier* identifier) const;
- bool isExactlyA(const Identifier* identifier) const;
- bool isChildOf(const Identifier* identifier) const;
- bool isDirectChildOf(const Identifier* identifier) const;
- bool isParentOf(const Identifier* identifier) const;
- bool isDirectParentOf(const Identifier* identifier) const;
-
-
- /////////////////////////////
- ////// Class Hierarchy //////
- /////////////////////////////
- static void createClassHierarchy();
-
- /// Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents.
- inline static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); }
-
- /// Returns the parents of the class the Identifier belongs to.
- inline const std::set<const Identifier*>& getParents() const { return this->parents_; }
- /// Returns the begin-iterator of the parents-list.
- inline std::set<const Identifier*>::const_iterator getParentsBegin() const { return this->parents_.begin(); }
- /// Returns the end-iterator of the parents-list.
- inline std::set<const Identifier*>::const_iterator getParentsEnd() const { return this->parents_.end(); }
-
- /// Returns the children of the class the Identifier belongs to.
- inline const std::set<const Identifier*>& getChildren() const { return this->children_; }
- /// Returns the begin-iterator of the children-list.
- inline std::set<const Identifier*>::const_iterator getChildrenBegin() const { return this->children_.begin(); }
- /// Returns the end-iterator of the children-list.
- inline std::set<const Identifier*>::const_iterator getChildrenEnd() const { return this->children_.end(); }
-
- /// Returns the direct parents of the class the Identifier belongs to.
- inline const std::set<const Identifier*>& getDirectParents() const { return this->directParents_; }
- /// Returns the begin-iterator of the direct-parents-list.
- inline std::set<const Identifier*>::const_iterator getDirectParentsBegin() const { return this->directParents_.begin(); }
- /// Returns the end-iterator of the direct-parents-list.
- inline std::set<const Identifier*>::const_iterator getDirectParentsEnd() const { return this->directParents_.end(); }
-
- /// Returns the direct children the class the Identifier belongs to.
- inline const std::set<const Identifier*>& getDirectChildren() const { return this->directChildren_; }
- /// Returns the begin-iterator of the direct-children-list.
- inline std::set<const Identifier*>::const_iterator getDirectChildrenBegin() const { return this->directChildren_.begin(); }
- /// Returns the end-iterator of the direct-children-list.
- inline std::set<const Identifier*>::const_iterator getDirectChildrenEnd() const { return this->directChildren_.end(); }
-
-
- //////////////////////////
- ///// Identifier Map /////
- //////////////////////////
- static void destroyAllIdentifiers();
-
- static Identifier* getIdentifierByString(const std::string& name);
- static Identifier* getIdentifierByLowercaseString(const std::string& name);
- static Identifier* getIdentifierByID(uint32_t id);
-
- static void clearNetworkIDs();
-
- /// Returns the map that stores all Identifiers with their names.
- static inline const std::map<std::string, Identifier*>& getStringIdentifierMap() { return Identifier::getStringIdentifierMapIntern(); }
- /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their names.
- static inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapBegin() { return Identifier::getStringIdentifierMap().begin(); }
- /// Returns a const_iterator to the end of the map that stores all Identifiers with their names.
- static inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapEnd() { return Identifier::getStringIdentifierMap().end(); }
-
- /// Returns the map that stores all Identifiers with their names in lowercase.
- static inline const std::map<std::string, Identifier*>& getLowercaseStringIdentifierMap() { return Identifier::getLowercaseStringIdentifierMapIntern(); }
- /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their names in lowercase.
- static inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapBegin() { return Identifier::getLowercaseStringIdentifierMap().begin(); }
- /// Returns a const_iterator to the end of the map that stores all Identifiers with their names in lowercase.
- static inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapEnd() { return Identifier::getLowercaseStringIdentifierMap().end(); }
-
- /// Returns the map that stores all Identifiers with their IDs.
- static inline const std::map<uint32_t, Identifier*>& getIDIdentifierMap() { return Identifier::getIDIdentifierMapIntern(); }
- /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their IDs.
- static inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapBegin() { return Identifier::getIDIdentifierMap().begin(); }
- /// Returns a const_iterator to the end of the map that stores all Identifiers with their IDs.
- static inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapEnd() { return Identifier::getIDIdentifierMap().end(); }
-
-
- /////////////////////////
- ///// Config Values /////
- /////////////////////////
- virtual void updateConfigValues(bool updateChildren = true) const = 0;
-
- /// Returns true if this class has at least one config value.
- inline bool hasConfigValues() const { return this->bHasConfigValues_; }
-
- void addConfigValueContainer(const std::string& varname, ConfigValueContainer* container);
- ConfigValueContainer* getConfigValueContainer(const std::string& varname);
-
-
- ///////////////////
- ///// XMLPort /////
- ///////////////////
- /// Returns the map that stores all XMLPort params.
- inline const std::map<std::string, XMLPortParamContainer*>& getXMLPortParamMap() const { return this->xmlportParamContainers_; }
- /// Returns a const_iterator to the beginning of the map that stores all XMLPort params.
- inline std::map<std::string, XMLPortParamContainer*>::const_iterator getXMLPortParamMapBegin() const { return this->xmlportParamContainers_.begin(); }
- /// Returns a const_iterator to the end of the map that stores all XMLPort params.
- inline std::map<std::string, XMLPortParamContainer*>::const_iterator getXMLPortParamMapEnd() const { return this->xmlportParamContainers_.end(); }
-
- /// Returns the map that stores all XMLPort objects.
- inline const std::map<std::string, XMLPortObjectContainer*>& getXMLPortObjectMap() const { return this->xmlportObjectContainers_; }
- /// Returns a const_iterator to the beginning of the map that stores all XMLPort objects.
- inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortObjectMapBegin() const { return this->xmlportObjectContainers_.begin(); }
- /// Returns a const_iterator to the end of the map that stores all XMLPort objects.
- inline std::map<std::string, XMLPortObjectContainer*>::const_iterator getXMLPortObjectMapEnd() const { return this->xmlportObjectContainers_.end(); }
-
- void addXMLPortParamContainer(const std::string& paramname, XMLPortParamContainer* container);
- XMLPortParamContainer* getXMLPortParamContainer(const std::string& paramname);
-
- void addXMLPortObjectContainer(const std::string& sectionname, XMLPortObjectContainer* container);
- XMLPortObjectContainer* getXMLPortObjectContainer(const std::string& sectionname);
-
-
- protected:
- Identifier();
- Identifier(const Identifier& identifier); // don't copy
- virtual ~Identifier();
-
- static Identifier* getIdentifierSingleton(const std::string& name, Identifier* proposal);
- virtual void createSuperFunctionCaller() const = 0;
-
- void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass);
-
- /// Returns the map that stores all Identifiers with their names.
- static std::map<std::string, Identifier*>& getStringIdentifierMapIntern();
- /// Returns the map that stores all Identifiers with their names in lowercase.
- static std::map<std::string, Identifier*>& getLowercaseStringIdentifierMapIntern();
- /// Returns the map that stores all Identifiers with their network IDs.
- static std::map<uint32_t, Identifier*>& getIDIdentifierMapIntern();
-
- /// Returns the children of the class the Identifier belongs to.
- inline std::set<const Identifier*>& getChildrenIntern() const { return this->children_; }
- /// Returns the direct children of the class the Identifier belongs to.
- inline std::set<const Identifier*>& getDirectChildrenIntern() const { return this->directChildren_; }
-
- ObjectListBase* objects_; //!< The list of all objects of this class
-
- private:
- /// Increases the hierarchyCreatingCounter_s variable, causing all new objects to store their parents.
- inline static void startCreatingHierarchy() { hierarchyCreatingCounter_s++; }
- /// Decreases the hierarchyCreatingCounter_s variable, causing the objects to stop storing their parents.
- inline static void stopCreatingHierarchy() { hierarchyCreatingCounter_s--; }
-
- static std::map<std::string, Identifier*>& getTypeIDIdentifierMap();
-
- void initialize(std::set<const Identifier*>* parents);
-
- std::set<const Identifier*> parents_; //!< The parents of the class the Identifier belongs to
- mutable std::set<const Identifier*> children_; //!< The children of the class the Identifier belongs to
-
- std::set<const Identifier*> directParents_; //!< The direct parents of the class the Identifier belongs to
- mutable std::set<const Identifier*> directChildren_; //!< The direct children of the class the Identifier belongs to
-
- bool bCreatedOneObject_; //!< True if at least one object of the given type was created (used to determine the need of storing the parents)
- bool bSetName_; //!< True if the name is set
- bool bLoadable_; //!< False = it's not permitted to load the object through XML
- std::string name_; //!< The name of the class the Identifier belongs to
- Factory* factory_; //!< The Factory, able to create new objects of the given class (if available)
- static int hierarchyCreatingCounter_s; //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading)
- uint32_t networkID_; //!< The network ID to identify a class through the network
- const unsigned int classID_; //!< Uniquely identifies a class (might not be the same as the networkID_)
- static unsigned int classIDCounter_s; //!< Static counter for the unique classIDs
-
- bool bHasConfigValues_; //!< True if this class has at least one assigned config value
- std::map<std::string, ConfigValueContainer*> configValues_; //!< A map to link the string of configurable variables with their ConfigValueContainer
-
- std::map<std::string, XMLPortParamContainer*> xmlportParamContainers_; //!< All loadable parameters
- std::map<std::string, XMLPortObjectContainer*> xmlportObjectContainers_; //!< All attachable objects
- };
-
- _CoreExport std::ostream& operator<<(std::ostream& out, const std::set<const Identifier*>& list);
-
-
- // ###############################
- // ### ClassIdentifier ###
- // ###############################
- /**
- @brief The ClassIdentifier is derived from Identifier and holds all class-specific functions and variables the Identifier cannot have.
-
- ClassIdentifier is a Singleton, which means that only one ClassIdentifier for a given type T exists.
- This makes it possible to store information about a class, sharing them with all
- objects of that class without defining static variables in every class.
-
- To be really sure that not more than exactly one object exists (even with libraries),
- ClassIdentifiers are stored in a static map in Identifier.
- */
- template <class T>
- class ClassIdentifier : public Identifier
- {
- #ifndef DOXYGEN_SHOULD_SKIP_THIS
- #define SUPER_INTRUSIVE_DECLARATION_INCLUDE
- #include "Super.h"
- #endif
-
- public:
- static ClassIdentifier<T>* getIdentifier();
- static ClassIdentifier<T>* getIdentifier(const std::string& name);
-
- bool initialiseObject(T* object, const std::string& className, bool bRootClass);
-
- void updateConfigValues(bool updateChildren = true) const;
-
- private:
- static void initialiseIdentifier();
- ClassIdentifier(const ClassIdentifier<T>& identifier) {} // don't copy
- ClassIdentifier()
- {
- SuperFunctionInitialization<0, T>::initialize(this);
- }
- ~ClassIdentifier()
- {
- SuperFunctionDestruction<0, T>::destroy(this);
- }
-
- static ClassIdentifier<T>* classIdentifier_s;
- };
-
- template <class T>
- ClassIdentifier<T>* ClassIdentifier<T>::classIdentifier_s = 0;
-
- /**
- @brief Returns the only instance of this class.
- @return The unique Identifier
- */
- template <class T>
- inline ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier()
- {
- // check if the Identifier already exists
- if (!ClassIdentifier<T>::classIdentifier_s)
- ClassIdentifier<T>::initialiseIdentifier();
-
- return ClassIdentifier<T>::classIdentifier_s;
- }
-
- /**
- @brief Does the same as getIdentifier() but sets the name if this wasn't done yet.
- @param name The name of this Identifier
- @return The Identifier
- */
- template <class T>
- inline ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier(const std::string& name)
- {
- ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier();
- identifier->setName(name);
- return identifier;
- }
-
- /**
- @brief Assigns the static field for the identifier singleton.
- */
- template <class T>
- void ClassIdentifier<T>::initialiseIdentifier()
- {
- // Get the name of the class
- std::string name = typeid(T).name();
-
- // create a new identifier anyway. Will be deleted in Identifier::getIdentifier if not used.
- ClassIdentifier<T>* proposal = new ClassIdentifier<T>();
-
- // Get the entry from the map
- ClassIdentifier<T>::classIdentifier_s = (ClassIdentifier<T>*)Identifier::getIdentifierSingleton(name, proposal);
-
- if (ClassIdentifier<T>::classIdentifier_s == proposal)
- {
- orxout(verbose, context::identifier) << "Requested Identifier for " << name << " was not yet existing and got created." << endl;
- }
- else
- {
- orxout(verbose, context::identifier) << "Requested Identifier for " << name << " was already existing and got assigned." << endl;
- }
- }
-
- /**
- @brief Adds an object of the given type to the ObjectList.
- @param object The object to add
- @param className The name of the class T
- @param bRootClass True if this is a root class (i.e. it inherits directly from OrxonoxClass)
- */
- template <class T>
- bool ClassIdentifier<T>::initialiseObject(T* object, const std::string& className, bool bRootClass)
- {
- if (bRootClass)
- orxout(verbose, context::object_list) << "Register Root-Object: " << className << endl;
- else
- orxout(verbose, context::object_list) << "Register Object: " << className << endl;
-
- object->identifier_ = this;
- if (Identifier::isCreatingHierarchy())
- {
- if (bRootClass && !object->parents_)
- object->parents_ = new std::set<const Identifier*>();
-
- if (object->parents_)
- {
- this->initializeClassHierarchy(object->parents_, bRootClass);
- object->parents_->insert(object->parents_->end(), this);
- }
-
- object->setConfigValues();
- return true;
- }
- else
- {
- orxout(verbose, context::object_list) << "Added object to " << this->getName() << "-list." << endl;
- object->metaList_->add(this->objects_, this->objects_->add(new ObjectListElement<T>(object)));
-
- // Add pointer of type T to the map in the OrxonoxClass instance that enables "dynamic_casts"
- object->objectPointers_.push_back(std::make_pair(this->getClassID(), static_cast<void*>(object)));
- return false;
- }
- }
-
- /**
- @brief Updates the config-values of all existing objects of this class by calling their setConfigValues() function.
- */
- template <class T>
- void ClassIdentifier<T>::updateConfigValues(bool updateChildren) const
- {
- if (!this->hasConfigValues())
- return;
-
- for (ObjectListIterator<T> it = ObjectList<T>::begin(); it; ++it)
- it->setConfigValues();
-
- if (updateChildren)
- for (std::set<const Identifier*>::const_iterator it = this->getChildrenBegin(); it != this->getChildrenEnd(); ++it)
- (*it)->updateConfigValues(false);
- }
-
-
- // ###############################
- // ### orxonox_cast ###
- // ###############################
- /**
- @brief
- Casts on object of type OrxonoxClass to any derived type that is
- registered in the class hierarchy.
- @return
- Returns NULL if the cast is not possible
- @note
- In case of NULL return (and using MSVC), a dynamic_cast might still be possible if
- a class forgot to register its objects.
- Also note that the function is implemented differently for GCC/MSVC.
- */
- template <class T, class U>
- ORX_FORCEINLINE T orxonox_cast(U* source)
- {
-#ifdef ORXONOX_COMPILER_MSVC
- typedef Loki::TypeTraits<typename Loki::TypeTraits<T>::PointeeType>::NonConstType ClassType;
- if (source != NULL)
- return source->template getDerivedPointer<ClassType>(ClassIdentifier<ClassType>::getIdentifier()->getClassID());
- else
- return NULL;
-#else
- return dynamic_cast<T>(source);
-#endif
- }
-}
-
-#endif /* _Identifier_H__ */
Deleted: code/trunk/src/libraries/core/Iterator.h
===================================================================
--- code/trunk/src/libraries/core/Iterator.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/Iterator.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,311 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @ingroup Object ObjectList
- @brief Definition of the Iterator class, used to iterate through object-lists.
-
- @anchor IteratorExample
-
- @ref orxonox::Iterator "Iterator" allows to iterate through an @ref orxonox::ObjectListBase
- "ObjectListBase". Objects in this list are cast to the template argument @a T of Iterator<T> using
- @c dynamic_cast. In contrast to @ref orxonox::ObjectListIterator "ObjectListIterator<T>",
- @ref orxonox::Iterator "Iterator<T>" can iterate through every object-list. In practice though it
- is limited to objects of type @a T and its subclasses. Because of the @c dynamic_cast, this iterator
- is much slower than ObjectListIterator.
-
- Usage:
- @code
- for (Iterator<myClass> it = anyidentifier->getObjects()->begin(); it != anyidentifier->getObjects()->end(); ++it)
- {
- it->someFunction(...);
- myClass* myObject = *it;
- }
- @endcode
-*/
-
-#ifndef _Iterator_H__
-#define _Iterator_H__
-
-#include "CorePrereqs.h"
-
-#include "Identifier.h"
-#include "ObjectListBase.h"
-
-namespace orxonox
-{
- /**
- @brief The Iterator allows to iterate through a given ObjectList.
-
- Independent of the object-list's type, the objects in the list are always casted
- to @a T using @c dynamic_cast.
-
- @see See @ref IteratorExample "Iterator.h" for more information an example.
- */
- template <class T = OrxonoxClass>
- class Iterator
- {
- public:
- /**
- @brief Constructor: Sets the element, whereon the iterator points, to zero.
- */
- inline Iterator()
- {
- this->element_ = 0;
- this->list_ = 0;
- }
-
- /**
- @brief Constructor: Sets this element to the exported element.
- @param exp The exported element
- */
- inline Iterator(const ObjectListBase::Export& exp)
- {
- this->element_ = exp.element_;
- this->list_ = exp.list_;
- this->list_->registerIterator(this);
- }
-
- /**
- @brief Constructor: Sets this element to the element of another Iterator.
- @param other The other Iterator
- */
- inline Iterator(const Iterator<T>& other)
- {
- this->element_ = other.element_;
- this->list_ = other.list_;
- this->list_->registerIterator(this);
- }
-
- /**
- @brief Constructor: Sets this element to a given element
- @param element The element
- */
- template <class O>
- inline Iterator(ObjectListElement<O>* element)
- {
- this->element_ = element;
- this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects();
- this->list_->registerIterator(this);
- }
-
- /**
- @brief Constructor: Sets this element to the element an ObjectListIterator.
- @param other The ObjectListIterator
- */
- template <class O>
- inline Iterator(const ObjectListIterator<O>& other)
- {
- this->element_ = other.element_;
- this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects();
- this->list_->registerIterator(this);
- }
-
- /**
- @brief Unregisters the Iterator from the ObjectList.
- */
- inline ~Iterator()
- {
- this->list_->unregisterIterator(this);
- }
-
- /**
- @brief Assigns an exported element.
- @param exp The exported element
- */
- inline Iterator<T>& operator=(const ObjectListBase::Export& exp)
- {
- if (this->list_)
- this->list_->unregisterIterator(this);
-
- this->element_ = exp.element_;
- this->list_ = exp.list_;
- this->list_->registerIterator(this);
-
- return (*this);
- }
-
- /**
- @brief Assigns the element of another Iterator.
- @param other The other Iterator
- */
- inline Iterator<T>& operator=(const Iterator<T>& other)
- {
- if (this->list_)
- this->list_->unregisterIterator(this);
-
- this->element_ = other.element_;
- this->list_ = other.list_;
- this->list_->registerIterator(this);
-
- return (*this);
- }
-
- /**
- @brief Assigns a given element.
- @param element The element
- */
- template <class O>
- inline Iterator<T>& operator=(ObjectListElement<O>* element)
- {
- if (this->list_)
- this->list_->unregisterIterator(this);
-
- this->element_ = element;
- this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects();
- this->list_->registerIterator(this);
-
- return (*this);
- }
-
- /**
- @brief Assigns the element of an ObjectListIterator.
- @param other The ObjectListIterator
- */
- template <class O>
- inline Iterator<T>& operator=(const ObjectListIterator<O>& other)
- {
- if (this->list_)
- this->list_->unregisterIterator(this);
-
- this->element_ = other.element_;
- this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects();
- this->list_->registerIterator(this);
-
- return (*this);
- }
-
- /**
- @brief Overloading of the ++it operator: Iterator points to the next object in the list.
- @return The Iterator itself
- */
- inline const Iterator<T>& operator++()
- {
- this->element_ = this->element_->next_;
- return *this;
- }
-
- /**
- @brief Overloading of the it++ operator: Iterator points to the next object in the list.
- @return The Iterator itself
- */
- inline Iterator<T> operator++(int)
- {
- Iterator<T> copy = *this;
- this->element_ = this->element_->next_;
- return copy;
- }
-
- /**
- @brief Overloading of the --it operator: Iterator points to the previous object in the list.
- @return The Iterator itself
- */
- inline const Iterator<T>& operator--()
- {
- this->element_ = this->element_->prev_;
- return *this;
- }
-
- /**
- @brief Overloading of the it-- operator: Iterator points to the previous object in the list.
- @return The Iterator itself
- */
- inline Iterator<T> operator--(int i)
- {
- Iterator<T> copy = *this;
- this->element_ = this->element_->prev_;
- return copy;
- }
-
- /**
- @brief Overloading of the *it operator: returns the pointer to the object.
- @return The object the Iterator points at
- */
- inline T* operator*() const
- {
- return orxonox_cast<T*>(this->element_->objectBase_);
- }
-
- /**
- @brief Overloading of the it-> operator: returns the pointer to the object.
- @return The object the Iterator points at
- */
- inline T* operator->() const
- {
- return orxonox_cast<T*>(this->element_->objectBase_);
- }
-
- /**
- @brief Overloading of the typecast-operator to bool: returns true if the iterator points to an existing object.
- @return True if the Iterator points to an existing object.
- */
- inline operator bool() const
- {
- return (this->element_ != 0);
- }
-
- /**
- @brief Overloading of the == operator to compare with another Iterator.
- @param compare The other Iterator
- @return True if the iterators point to the same element
- */
- inline bool operator==(const Iterator<T>& compare) const
- {
- return (this->element_ == compare.element_);
- }
-
- /**
- @brief Overloading of the != operator to compare with another Iterator.
- @param compare The other Iterator
- @return True if the iterators point to different elements
- */
- inline bool operator!=(const Iterator<T>& compare) const
- {
- return (this->element_ != compare.element_);
- }
-
- /**
- @brief Increments the Iterator if it points at the given object.
- @param object The object to compare with
- */
- inline void incrementIfEqual(OrxonoxClass* object)
- {
- if (this->element_ && this->element_->objectBase_ == object)
- this->operator++();
- }
-
- protected:
- ObjectListBaseElement* element_; //!< The element the Iterator points at
- ObjectListBase* list_; //!< The list wherein the element is
- };
-
- typedef Iterator<OrxonoxClass> BaseIterator;
-}
-
-#endif /* _Iterator_H__ */
Modified: code/trunk/src/libraries/core/Loader.cc
===================================================================
--- code/trunk/src/libraries/core/Loader.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/Loader.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,12 +36,12 @@
#include "util/Exception.h"
#include "util/StringUtils.h"
#include "BaseObject.h"
-#include "Iterator.h"
-#include "ObjectList.h"
#include "LuaState.h"
#include "Namespace.h"
#include "Resource.h"
#include "XMLFile.h"
+#include "object/Iterator.h"
+#include "object/ObjectList.h"
namespace orxonox
{
@@ -208,7 +208,7 @@
rootElement.InsertEndChild(*child);
orxout(verbose, context::loader) << " creating root-namespace..." << endl;
- Namespace* rootNamespace = new Namespace(0);
+ Namespace* rootNamespace = new Namespace(Context::getRootContext());
rootNamespace->setLoaderIndentation(" ");
rootNamespace->setFile(file);
rootNamespace->setNamespace(rootNamespace);
Deleted: code/trunk/src/libraries/core/MetaObjectList.cc
===================================================================
--- code/trunk/src/libraries/core/MetaObjectList.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/MetaObjectList.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,103 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief Implementation of the MetaObjectList class.
-*/
-
-#include "MetaObjectList.h"
-
-#include "util/Output.h"
-#include "Identifier.h"
-#include "ObjectListBase.h"
-
-namespace orxonox
-{
- // ###############################
- // ### MetaObjectListElement ###
- // ###############################
- /**
- @brief Destructor: Removes the ObjectListBaseElement from the ObjectListBase by linking next_ and prev_ of the ObjectListBaseElement.
- */
- MetaObjectListElement::~MetaObjectListElement()
- {
- orxout(verbose, context::object_list) << "Removing Object from " << this->list_->getIdentifier()->getName() << "-list." << endl;
- this->list_->notifyIterators(this->element_->objectBase_);
-
- if (this->element_->next_)
- this->element_->next_->prev_ = this->element_->prev_;
- else
- this->list_->last_ = this->element_->prev_; // If there is no next_, we deleted the last object and have to update the last_ pointer of the list
-
- if (this->element_->prev_)
- this->element_->prev_->next_ = this->element_->next_;
- else
- this->list_->first_ = this->element_->next_; // If there is no prev_, we deleted the first object and have to update the first_ pointer of the list
-
- delete this->element_;
- }
-
-
- // ###############################
- // ### MetaObjectList ###
- // ###############################
- /**
- @brief Constructor: Sets first_ to zero.
- */
- MetaObjectList::MetaObjectList()
- {
- this->first_ = 0;
- }
-
- /**
- @brief Destructor: Removes all elements from the list, causing them to remove the stored ObjectListElement from the ObjectList.
- */
- MetaObjectList::~MetaObjectList()
- {
- MetaObjectListElement* temp;
- while (this->first_)
- {
- temp = this->first_->next_;
- delete this->first_;
- this->first_ = temp;
- }
- }
-
- /**
- @brief Adds an ObjectList and an element of that list to the MetaObjectList.
- @param list The ObjectList wherein the element is
- @param element The element wherein the object is
- */
- void MetaObjectList::add(ObjectListBase* list, ObjectListBaseElement* element)
- {
- MetaObjectListElement* temp = this->first_;
- this->first_ = new MetaObjectListElement(list, element);
- this->first_->next_ = temp;
- }
-}
Deleted: code/trunk/src/libraries/core/MetaObjectList.h
===================================================================
--- code/trunk/src/libraries/core/MetaObjectList.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/MetaObjectList.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,86 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @ingroup Object ObjectList
- @brief Declaration of the MetaObjectList class.
-
- The MetaObjectList is a single-linked list, containing all list-elements and their
- lists wherein the object, owning the MetaObjectList, is registered.
- This allows much faster deletion of objects because no iteration is needed.
-*/
-
-#ifndef _MetaObjectList_H__
-#define _MetaObjectList_H__
-
-#include "CorePrereqs.h"
-
-namespace orxonox
-{
- // ###############################
- // ### MetaObjectListElement ###
- // ###############################
- /// The list-element of the MetaObjectList
- class _CoreExport MetaObjectListElement
- {
- public:
- /**
- @brief Constructor: Creates the list-element with given list and element.
- */
- MetaObjectListElement(ObjectListBase* list, ObjectListBaseElement* element) : next_(0), element_(element), list_(list) {}
- ~MetaObjectListElement();
-
- MetaObjectListElement* next_; //!< The next Element in the list
- ObjectListBaseElement* element_; //!< The list element, containing the object
- ObjectListBase* list_; //!< The list, containing the element
- };
-
-
- // ###############################
- // ### MetaObjectList ###
- // ###############################
- /**
- @brief The MetaObjectList contains ObjectListBaseElements and their ObjectListBases.
-
- The MetaObjectList is a single-linked list, containing all list-elements and their
- lists wherein the object that owns the MetaObjectList is registered.
- This allows much faster deletion of objects because no iteration is needed.
- */
- class _CoreExport MetaObjectList
- {
- public:
- MetaObjectList();
- ~MetaObjectList();
- void add(ObjectListBase* list, ObjectListBaseElement* element);
-
- MetaObjectListElement* first_; //!< The first element in the list
- };
-}
-
-#endif /* _MetaObjectList_H__ */
Modified: code/trunk/src/libraries/core/Namespace.cc
===================================================================
--- code/trunk/src/libraries/core/Namespace.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/Namespace.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,9 +37,9 @@
namespace orxonox
{
- CreateFactory(Namespace);
+ RegisterClass(Namespace);
- Namespace::Namespace(BaseObject* creator) : BaseObject(creator),
+ Namespace::Namespace(Context* context) : BaseObject(context), Context(context),
bAutogeneratedFileRootNamespace_(false),
bRoot_(false),
operator_("or")
Modified: code/trunk/src/libraries/core/Namespace.h
===================================================================
--- code/trunk/src/libraries/core/Namespace.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/Namespace.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,13 +39,14 @@
#include <set>
#include <string>
#include "BaseObject.h"
+#include "object/Context.h"
namespace orxonox
{
- class Namespace : public BaseObject
+ class Namespace : public BaseObject, public Context
{
public:
- Namespace(BaseObject* creator);
+ Namespace(Context* context);
virtual ~Namespace();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Deleted: code/trunk/src/libraries/core/ObjectList.h
===================================================================
--- code/trunk/src/libraries/core/ObjectList.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/ObjectList.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,101 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @defgroup ObjectList Object-lists and iterators
- @ingroup Object
-*/
-
-/**
- @file
- @ingroup Object ObjectList
- @brief Definition of the ObjectList class, a wrapper of ObjectListBase.
-
- @ref orxonox::ObjectList "ObjectList<T>" is a wrapper of an @ref orxonox::ObjectListBase
- "ObjectListBase" of class @a T. Use @ref orxonox::ObjectListIterator "ObjectListIterator<T>"
- to iterate through the list.
-*/
-
-#ifndef _ObjectList_H__
-#define _ObjectList_H__
-
-#include "CorePrereqs.h"
-
-#include "Identifier.h"
-#include "ObjectListBase.h"
-#include "ObjectListIterator.h"
-
-namespace orxonox
-{
- // ###############################
- // ### ObjectList ###
- // ###############################
- /**
- @brief The ObjectList contains all objects of the given class.
-
- Wraps the ObjectListBase which contains all objects of type @a T. Use @ref ObjectListIterator
- "ObjectListIterator<T>" or its typedef ObjectList<T>::iterator to iterate through all objects
- in the list.
- */
- template <class T>
- class ObjectList
- {
- public:
- typedef ObjectListIterator<T> iterator;
-
- /// Returns an Iterator to the first element in the list.
- inline static ObjectListElement<T>* begin()
- {
- ObjectListBase* list = ClassIdentifier<T>::getIdentifier()->getObjects();
- return static_cast<ObjectListElement<T>*>(list->begin().element_);
- }
-
- /// Returns an Iterator to the element after the last element in the list.
- inline static ObjectListElement<T>* end()
- {
- ObjectListBase* list = ClassIdentifier<T>::getIdentifier()->getObjects();
- return static_cast<ObjectListElement<T>*>(list->end().element_);
- }
-
- /// Returns an Iterator to the last element in the list.
- inline static ObjectListElement<T>* rbegin()
- {
- ObjectListBase* list = ClassIdentifier<T>::getIdentifier()->getObjects();
- return static_cast<ObjectListElement<T>*>(list->rbegin().element_);
- }
-
- /// Returns an Iterator to the element before the first element in the list.
- inline static ObjectListElement<T>* rend()
- {
- ObjectListBase* list = ClassIdentifier<T>::getIdentifier()->getObjects();
- return static_cast<ObjectListElement<T>*>(list->rend().element_);
- }
- };
-}
-
-#endif /* _ObjectList_H__ */
Deleted: code/trunk/src/libraries/core/ObjectListBase.cc
===================================================================
--- code/trunk/src/libraries/core/ObjectListBase.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/ObjectListBase.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,103 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief Implementation of the ObjectListBase class.
-*/
-
-#include "ObjectListBase.h"
-
-#include <set>
-#include "Identifier.h"
-#include "Iterator.h"
-#include "ObjectListIterator.h"
-
-namespace orxonox
-{
- /**
- @brief Constructor: Sets default values.
- */
- ObjectListBase::ObjectListBase(Identifier* identifier)
- {
- this->identifier_ = identifier;
- this->first_ = 0;
- this->last_ = 0;
- }
-
- /**
- @brief Destructor: Deletes all list-elements, but NOT THE OBJECTS.
- */
- ObjectListBase::~ObjectListBase()
- {
- ObjectListBaseElement* temp;
- while (this->first_)
- {
- temp = this->first_->next_;
- delete this->first_;
- this->first_ = temp;
- }
- }
-
- /**
- @brief Increases all Iterators that currently point on the given element (because it gets removed).
- @param object The object that gets removed
- */
- void ObjectListBase::notifyIterators(OrxonoxClass* object) const
- {
- for (std::vector<void*>::const_iterator it = this->iterators_.begin(); it != this->iterators_.end(); ++it)
- ((Iterator<OrxonoxClass>*)(*it))->incrementIfEqual(object);
- for (std::vector<void*>::const_iterator it = this->objectListIterators_.begin(); it != this->objectListIterators_.end(); ++it)
- ((ObjectListIterator<OrxonoxClass>*)(*it))->incrementIfEqual(object);
- }
-
- /**
- @brief Adds a new object to the end of the list.
- @param element The element to add
- @return The pointer to the new ObjectListBaseElement, needed by the MetaObjectList of the added object
- */
- ObjectListBaseElement* ObjectListBase::add(ObjectListBaseElement* element)
- {
- if (!this->last_)
- {
- // If the list is empty
- this->last_ = element;
- this->first_ = this->last_; // There's only one object in the list now
- }
- else
- {
- // If the list isn't empty
- ObjectListBaseElement* temp = this->last_;
- this->last_ = element;
- this->last_->prev_ = temp;
- temp->next_ = this->last_;
- }
-
- return this->last_;
- }
-}
Deleted: code/trunk/src/libraries/core/ObjectListBase.h
===================================================================
--- code/trunk/src/libraries/core/ObjectListBase.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/ObjectListBase.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,157 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @ingroup Object ObjectList
- @brief Declaration of the ObjectListBase class which stores all objects of each class.
-
- orxonox::ObjectListBase is a double-linked list, used by @ref orxonox::Identifier "Identifiers"
- to store all objects of a given class. Newly created objects are added to the list through the
- @c RegisterObject() macro in the constructor.
-*/
-
-#ifndef _ObjectListBase_H__
-#define _ObjectListBase_H__
-
-#include "CorePrereqs.h"
-#include <vector>
-
-namespace orxonox
-{
- // ###############################
- // ### ObjectListBaseElement ###
- // ###############################
- /// The list-element of the ObjectListBase
- class _CoreExport ObjectListBaseElement
- {
- public:
- /**
- @brief Constructor: Creates the list-element with an object.
- @param objectBase The object to store
- */
- ObjectListBaseElement(OrxonoxClass* objectBase) : next_(0), prev_(0), objectBase_(objectBase) {}
-
- ObjectListBaseElement* next_; //!< The next element in the list
- ObjectListBaseElement* prev_; //!< The previous element in the list
- OrxonoxClass* objectBase_;
- };
-
-
- // ###############################
- // ### ObjectListElement ###
- // ###############################
- /// The list-element that actually contains the object
- template <class T>
- class ObjectListElement : public ObjectListBaseElement
- {
- public:
- ObjectListElement(T* object) : ObjectListBaseElement(static_cast<OrxonoxClass*>(object)), object_(object) {}
- T* object_; //!< The object
- };
-
-
- // ###############################
- // ### ObjectListBase ###
- // ###############################
- /**
- @brief The ObjectListBase contains all objects of a given class.
-
- The ObjectListBase is used by Identifiers to store all objects of their class.
- You can use Identifier::getObjects() to get the object-list from an Identifier.
- Use @ref Iterator "Iterator<T>" to iterate through them.
-
- Alternatively you can also use the static helper class @ref orxonox::ObjectList "ObjectList<T>"
- to get the list of all objects of type @a T. Use @ref ObjectListIterator "ObjectListIterator<T>"
- or @ref Iterator "Iterator<T>" to iterate through them.
- */
- class _CoreExport ObjectListBase
- {
- friend class MetaObjectListElement;
-
- public:
- ObjectListBase(Identifier* identifier);
- ~ObjectListBase();
-
- ObjectListBaseElement* add(ObjectListBaseElement* element);
-
- /// Helper struct, used to export an element and the list to an instance of Iterator.
- struct Export
- {
- Export(ObjectListBase* list, ObjectListBaseElement* element) : list_(list), element_(element) {}
- ObjectListBase* list_;
- ObjectListBaseElement* element_;
- };
-
- /// Returns a pointer to the first element in the list. Works only with Iterator.
- inline Export begin() { return ObjectListBase::Export(this, this->first_); }
- /// Returns a pointer to the element after the last element in the list. Works only with Iterator.
- inline Export end() { return ObjectListBase::Export(this, 0); }
- /// Returns a pointer to the last element in the list. Works only with Iterator.
- inline Export rbegin() { return ObjectListBase::Export(this, this->last_); }
- /// Returns a pointer to the element in front of the first element in the list. Works only with Iterator.
- inline Export rend() { return ObjectListBase::Export(this, 0); }
-
- inline void registerIterator(void* iterator) { this->iterators_.push_back(iterator); }
- inline void unregisterIterator(void* iterator)
- {
- for (unsigned int i = 0; i < this->iterators_.size(); ++i)
- {
- if (iterators_[i] == iterator)
- {
- iterators_.erase(iterators_.begin() + i);
- break;
- }
- }
- }
- inline void registerObjectListIterator(void* iterator) { this->objectListIterators_.push_back(iterator); }
- inline void unregisterObjectListIterator(void* iterator)
- {
- for (unsigned int i = 0; i < this->objectListIterators_.size(); ++i)
- {
- if (objectListIterators_[i] == iterator)
- {
- objectListIterators_.erase(objectListIterators_.begin() + i);
- break;
- }
- }
- }
- void notifyIterators(OrxonoxClass* object) const;
-
- inline Identifier* getIdentifier() const { return this->identifier_; }
-
- private:
- Identifier* identifier_; //!< The Iterator owning this list
- ObjectListBaseElement* first_; //!< The first element in the list
- ObjectListBaseElement* last_; //!< The last element in the list
- std::vector<void*> iterators_; //!< A list of Iterators pointing on an element in this list
- std::vector<void*> objectListIterators_; //!< A list of ObjectListIterators pointing on an element in this list
- };
-}
-
-#endif /* _ObjectListBase_H__ */
Deleted: code/trunk/src/libraries/core/ObjectListIterator.h
===================================================================
--- code/trunk/src/libraries/core/ObjectListIterator.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/ObjectListIterator.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,236 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @ingroup Object ObjectList
- @brief Definition of the ObjectListIterator class, used to iterate through object-lists.
-
- @anchor ObjectListIteratorExample
-
- @ref orxonox::ObjectListIterator "ObjectListIterator<T>" allows to iterate through
- @ref orxonox::ObjectList "ObjectList<T>", containing all objects of type @a T. In contrast to
- @ref orxonox::Iterator "Iterator<T>", this iterator is limited to the object-list of type @a T.
- It is, however, much faster as it doesn't need a @c dynamic_cast.
-
- Usage:
- @code
- for (ObjectListIterator<myClass> it = ObjectList<myClass>::begin(); it != ObjectList<myClass>::end(); ++it)
- {
- it->someFunction(...);
- myClass* myObject = *it;
- }
- @endcode
-
- @note @ref orxonox::ObjectList::iterator "ObjectList<T>::iterator" is identical to
- @ref orxonox::ObjectListIterator "ObjectListIterator<T>" (it's just a typedef).
-*/
-
-#ifndef _ObjectListIterator_H__
-#define _ObjectListIterator_H__
-
-#include "CorePrereqs.h"
-#include "Identifier.h"
-#include "ObjectList.h"
-
-namespace orxonox
-{
- /**
- @brief ObjectListIterator<T> allows to iterate through the ObjectList of class @a T.
-
- @see See @ref ObjectListIteratorExample "ObjectListIterator.h" for more information an example.
- */
- template <class T>
- class ObjectListIterator
- {
- template <class I>
- friend class Iterator;
-
- public:
- /**
- @brief Constructor: Sets the element, whereon the ObjectListIterator points, to zero.
- */
- inline ObjectListIterator()
- {
- this->element_ = 0;
- ClassIdentifier<T>::getIdentifier()->getObjects()->registerObjectListIterator(this);
- }
-
- /**
- @brief Constructor: Sets this element to a given element.
- @param element The element to start with
- */
- inline ObjectListIterator(ObjectListElement<T>* element)
- {
- this->element_ = element;
- ClassIdentifier<T>::getIdentifier()->getObjects()->registerObjectListIterator(this);
- }
-
- /**
- @brief Constructor: Sets this element to the element of another ObjectListIterator.
- @param other The other ObjectListIterator
- */
- inline ObjectListIterator(const ObjectListIterator<T>& other)
- {
- this->element_ = other.element_;
- ClassIdentifier<T>::getIdentifier()->getObjects()->registerObjectListIterator(this);
- }
-
- /**
- @brief Unregisters the ObjectListIterator from the ObjectList.
- */
- inline ~ObjectListIterator()
- {
- ClassIdentifier<T>::getIdentifier()->getObjects()->unregisterObjectListIterator(this);
- }
-
- /**
- @brief Assigns an ObjectListElement.
- @param element The ObjectListElement
- */
- inline ObjectListIterator<T>& operator=(ObjectListElement<T>* element)
- {
- this->element_ = element;
- return (*this);
- }
-
- /**
- @brief Assigns the element of another ObjectListIterator.
- @param other The other ObjectListIterator
- */
- inline ObjectListIterator<T>& operator=(const ObjectListIterator<T>& other)
- {
- this->element_ = other.element_;
- return (*this);
- }
-
- /**
- @brief Overloading of the ++it operator: ObjectListIterator points to the next object in the list.
- @return The ObjectListIterator itself
- */
- inline const ObjectListIterator<T>& operator++()
- {
- this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_);
- return *this;
- }
-
- /**
- @brief Overloading of the it++ operator: ObjectListIterator points to the next object in the list.
- @return The ObjectListIterator itself
- */
- inline ObjectListIterator<T> operator++(int)
- {
- ObjectListIterator<T> copy = *this;
- this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_);
- return copy;
- }
-
- /**
- @brief Overloading of the --it operator: ObjectListIterator points to the previous object in the list.
- @return The ObjectListIterator itself
- */
- inline const ObjectListIterator<T>& operator--()
- {
- this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_);
- return *this;
- }
-
- /**
- @brief Overloading of the it-- operator: ObjectListIterator points to the previous object in the list.
- @return The ObjectListIterator itself
- */
- inline ObjectListIterator<T> operator--(int i)
- {
- ObjectListIterator<T> copy = *this;
- this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_);
- return copy;
- }
-
- /**
- @brief Overloading of the *it operator: returns the pointer to the object.
- @return The object the ObjectListIterator points at
- */
- inline T* operator*() const
- {
- return this->element_->object_;
- }
-
- /**
- @brief Overloading of the it-> operator: returns the pointer to the object.
- @return The object the ObjectListIterator points at
- */
- inline T* operator->() const
- {
- return this->element_->object_;
- }
-
- /**
- @brief Overloading of the typecast-operator to bool: returns true if the ObjectListIterator points to an existing object.
- @return True if the ObjectListIterator points to an existing object.
- */
- inline operator bool() const
- {
- return (this->element_ != 0);
- }
-
- /**
- @brief Overloading of the == operator to compare with another ObjectListIterator.
- @param compare The other ObjectListIterator
- @return True if the ObjectListIterator point to the same element
- */
- inline bool operator==(const ObjectListIterator<T>& compare) const
- {
- return (this->element_ == compare.element_);
- }
-
- /**
- @brief Overloading of the != operator to compare with another ObjectListIterator.
- @param compare The other ObjectListIterator
- @return True if the ObjectListIterator point to different elements
- */
- inline bool operator!=(const ObjectListIterator<T>& compare) const
- {
- return (this->element_ != compare.element_);
- }
-
- /**
- @brief Increments the ObjectListIterator if it points at the given object.
- @param object The object to compare with
- */
- inline void incrementIfEqual(OrxonoxClass* object)
- {
- if (this->element_ && this->element_->objectBase_ == object)
- this->operator++();
- }
-
- private:
- ObjectListElement<T>* element_; //!< The element the iterator points at
- };
-}
-
-#endif /* _ObjectListIterator_H__ */
Deleted: code/trunk/src/libraries/core/OrxonoxClass.cc
===================================================================
--- code/trunk/src/libraries/core/OrxonoxClass.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/OrxonoxClass.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,140 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief Implementation of OrxonoxClass.
-*/
-
-#include "OrxonoxClass.h"
-
-#include <cassert>
-#include "MetaObjectList.h"
-#include "Identifier.h"
-
-namespace orxonox
-{
- /**
- @brief Constructor: Sets the default values.
- */
- OrxonoxClass::OrxonoxClass()
- {
- this->identifier_ = 0;
- this->parents_ = 0;
- this->metaList_ = new MetaObjectList();
- this->referenceCount_ = 0;
- this->requestedDestruction_ = false;
- // Optimisation
- this->objectPointers_.reserve(6);
- }
-
- /**
- @brief Destructor: Removes the object from the object-lists, notifies all DestructionListener (for example @ref WeakPtr "weak pointers") that this object is being deleted.
- */
- OrxonoxClass::~OrxonoxClass()
- {
-// if (!this->requestedDestruction_)
-// orxout(internal_warning) << "Destroyed object without destroy() (" << this->getIdentifier()->getName() << ')' << endl;
-
- assert(this->referenceCount_ <= 0);
-
- this->unregisterObject();
-
- // parents_ exists only if isCreatingHierarchy() of the associated Identifier returned true while creating the class
- if (this->parents_)
- delete this->parents_;
-
- // notify all destruction listeners
- for (std::set<DestructionListener*>::iterator it = this->destructionListeners_.begin(); it != this->destructionListeners_.end(); )
- (*(it++))->objectDeleted();
- }
-
- /**
- @brief Deletes the object if no @ref orxonox::SmartPtr "smart pointers" point to this object. Otherwise schedules the object to be deleted as soon as possible.
- */
- void OrxonoxClass::destroy()
- {
- assert(this); // Just in case someone tries to delete a NULL pointer
- this->requestedDestruction_ = true;
- if (this->referenceCount_ == 0)
- {
- this->preDestroy();
- if (this->referenceCount_ == 0)
- delete this;
- }
- }
-
- /**
- @brief Removes this object from the object-lists.
- */
- void OrxonoxClass::unregisterObject()
- {
- if (this->metaList_)
- delete this->metaList_;
- this->metaList_ = 0;
- }
-
- /// Returns true if the object's class is of the given type or a derivative.
- bool OrxonoxClass::isA(const Identifier* identifier)
- { return this->getIdentifier()->isA(identifier); }
- /// Returns true if the object's class is exactly of the given type.
- bool OrxonoxClass::isExactlyA(const Identifier* identifier)
- { return this->getIdentifier()->isExactlyA(identifier); }
- /// Returns true if the object's class is a child of the given type.
- bool OrxonoxClass::isChildOf(const Identifier* identifier)
- { return this->getIdentifier()->isChildOf(identifier); }
- /// Returns true if the object's class is a direct child of the given type.
- bool OrxonoxClass::isDirectChildOf(const Identifier* identifier)
- { return this->getIdentifier()->isDirectChildOf(identifier); }
- /// Returns true if the object's class is a parent of the given type.
- bool OrxonoxClass::isParentOf(const Identifier* identifier)
- { return this->getIdentifier()->isParentOf(identifier); }
- /// Returns true if the object's class is a direct parent of the given type.
- bool OrxonoxClass::isDirectParentOf(const Identifier* identifier)
- { return this->getIdentifier()->isDirectParentOf(identifier); }
-
-
- /// Returns true if the object's class is of the given type or a derivative.
- bool OrxonoxClass::isA(const OrxonoxClass* object)
- { return this->getIdentifier()->isA(object->getIdentifier()); }
- /// Returns true if the object's class is exactly of the given type.
- bool OrxonoxClass::isExactlyA(const OrxonoxClass* object)
- { return this->getIdentifier()->isExactlyA(object->getIdentifier()); }
- /// Returns true if the object's class is a child of the given type.
- bool OrxonoxClass::isChildOf(const OrxonoxClass* object)
- { return this->getIdentifier()->isChildOf(object->getIdentifier()); }
- /// Returns true if the object's class is a direct child of the given type.
- bool OrxonoxClass::isDirectChildOf(const OrxonoxClass* object)
- { return this->getIdentifier()->isDirectChildOf(object->getIdentifier()); }
- /// Returns true if the object's class is a parent of the given type.
- bool OrxonoxClass::isParentOf(const OrxonoxClass* object)
- { return this->getIdentifier()->isParentOf(object->getIdentifier()); }
- /// Returns true if the object's class is a direct child of the given type.
- bool OrxonoxClass::isDirectParentOf(const OrxonoxClass* object)
- { return this->getIdentifier()->isDirectParentOf(object->getIdentifier()); }
-}
Deleted: code/trunk/src/libraries/core/OrxonoxClass.h
===================================================================
--- code/trunk/src/libraries/core/OrxonoxClass.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/OrxonoxClass.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,199 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @defgroup OrxonoxClass OrxonoxClass
- @ingroup Class
-*/
-
-/**
- @file
- @ingroup Class OrxonoxClass
- @brief Declaration of OrxonoxClass, the base class of all objects and interfaces in Orxonox.
-
- All objects and interfaces of the game-logic (not the engine) are derived from OrxonoxClass.
- It stores the Identifier and the MetaObjectList and has all needed functions to create and use the class-hierarchy.
-*/
-
-#ifndef _OrxonoxClass_H__
-#define _OrxonoxClass_H__
-
-#include "CorePrereqs.h"
-
-#include <set>
-#include <vector>
-#include "Super.h"
-
-namespace orxonox
-{
- /**
- @brief The class all objects and interfaces of the game-logic (not the engine) are derived from.
-
- The BaseObject and Interfaces are derived with @c virtual @c public @c OrxonoxClass from OrxonoxClass.
- OrxonoxClass is needed to create the class-hierarchy at startup and to store the Identifier and the
- MetaObjectList, as well as to provide an interface for SmartPtr and WeakPtr.
- */
- class _CoreExport OrxonoxClass
- {
- template <class T>
- friend class ClassIdentifier;
-
- template <class T>
- friend class SmartPtr;
-
- friend class DestructionListener;
-
- public:
- OrxonoxClass();
- virtual ~OrxonoxClass();
-
- void destroy();
- void unregisterObject();
-
- /// Function to collect the SetConfigValue-macro calls.
- void setConfigValues() {};
-
- /// Returns the Identifier of the object.
- inline Identifier* getIdentifier() const { return this->identifier_; }
-
- bool isA(const Identifier* identifier);
- bool isExactlyA(const Identifier* identifier);
- bool isChildOf(const Identifier* identifier);
- bool isDirectChildOf(const Identifier* identifier);
- bool isParentOf(const Identifier* identifier);
- bool isDirectParentOf(const Identifier* identifier);
-
- /// Returns true if the object's class is of the given type or a derivative.
- template <class B> inline bool isA(const SubclassIdentifier<B>* identifier)
- { return this->isA(*identifier); }
- /// Returns true if the object's class is exactly of the given type.
- template <class B> inline bool isExactlyA(const SubclassIdentifier<B>* identifier)
- { return this->isExactlyA(*identifier); }
- /// Returns true if the object's class is a child of the given type.
- template <class B> inline bool isChildOf(const SubclassIdentifier<B>* identifier)
- { return this->isChildOf(*identifier); }
- /// Returns true if the object's class is a direct child of the given type.
- template <class B> inline bool isDirectChildOf(const SubclassIdentifier<B>* identifier)
- { return this->isDirectChildOf(*identifier); }
- /// Returns true if the object's class is a parent of the given type.
- template <class B> inline bool isParentOf(const SubclassIdentifier<B>* identifier)
- { return this->isParentOf(*identifier); }
- /// Returns true if the object's class is a direct parent of the given type.
- template <class B> inline bool isDirectParentOf(const SubclassIdentifier<B>* identifier)
- { return this->isDirectParentOf(*identifier); }
-
- bool isA(const OrxonoxClass* object);
- bool isExactlyA(const OrxonoxClass* object);
- bool isChildOf(const OrxonoxClass* object);
- bool isDirectChildOf(const OrxonoxClass* object);
- bool isParentOf(const OrxonoxClass* object);
- bool isDirectParentOf(const OrxonoxClass* object);
-
- /// Returns the number of @ref orxonox::SmartPtr "smart pointers" that point to this object.
- inline unsigned int getReferenceCount() const
- { return this->referenceCount_; }
-
- /**
- @brief
- Returns a valid pointer of any derived type that is
- registered in the class hierarchy.
- @return
- Returns NULL if the no pointer was found.
- */
- ORX_FORCEINLINE void* getDerivedPointer(unsigned int classID)
- {
- for (int i = this->objectPointers_.size() - 1; i >= 0; --i)
- {
- if (this->objectPointers_[i].first == classID)
- return this->objectPointers_[i].second;
- }
- return NULL;
- }
-
- /// Version of getDerivedPointer with template
- template <class T> ORX_FORCEINLINE T* getDerivedPointer(unsigned int classID)
- { return static_cast<T*>(this->getDerivedPointer(classID)); }
- /// Const version of getDerivedPointer with template
- template <class T> ORX_FORCEINLINE const T* getDerivedPointer(unsigned int classID) const
- { return const_cast<OrxonoxClass*>(this)->getDerivedPointer<T>(classID); }
-
- protected:
- /// This virtual function is called if destroy() is called and no SmartPtr points to this object. Used in some cases to create a new SmartPtr to prevent destruction.
- virtual void preDestroy() {}
-
- private:
- /// Increments the reference counter (for smart pointers).
- inline void incrementReferenceCount()
- { ++this->referenceCount_; }
- /// Decrements the reference counter (for smart pointers).
- inline void decrementReferenceCount()
- {
- --this->referenceCount_;
- if (this->referenceCount_ == 0 && this->requestedDestruction_)
- this->destroy();
- }
-
- /// Register a destruction listener (for example a weak pointer which points to this object).
- inline void registerDestructionListener(DestructionListener* pointer)
- { this->destructionListeners_.insert(pointer); }
- /// Unegister a destruction listener (for example a weak pointer which pointed to this object before).
- inline void unregisterDestructionListener(DestructionListener* pointer)
- { this->destructionListeners_.erase(pointer); }
-
- Identifier* identifier_; //!< The Identifier of the object
- std::set<const Identifier*>* parents_; //!< List of all parents of the object
- MetaObjectList* metaList_; //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in
- int referenceCount_; //!< Counts the references from smart pointers to this object
- bool requestedDestruction_; //!< Becomes true after someone called delete on this object
- std::set<DestructionListener*> destructionListeners_; //!< All destruction listeners (for example weak pointers which point to this object and like to get notified if it dies)
-
- /// 'Fast map' that holds this-pointers of all derived types
- std::vector<std::pair<unsigned int, void*> > objectPointers_;
- };
-
- /**
- @brief This listener is used to inform weak pointers if an object of type OrxonoxClass gets destroyed.
- */
- class _CoreExport DestructionListener
- {
- friend class OrxonoxClass;
-
- protected:
- virtual ~DestructionListener() {}
-
- inline void registerAsDestructionListener(OrxonoxClass* object)
- { if (object) { object->registerDestructionListener(this); } }
- inline void unregisterAsDestructionListener(OrxonoxClass* object)
- { if (object) { object->unregisterDestructionListener(this); } }
-
- virtual void objectDeleted() = 0;
- };
-
-}
-
-#endif /* _OrxonoxClass_H__ */
Modified: code/trunk/src/libraries/core/PathConfig.cc
===================================================================
--- code/trunk/src/libraries/core/PathConfig.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/PathConfig.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -52,7 +52,7 @@
#include "SpecialConfig.h"
#include "util/Output.h"
#include "util/Exception.h"
-#include "CommandLineParser.h"
+#include "config/CommandLineParser.h"
// Differentiate Boost Filesystem v2 and v3
#if (BOOST_FILESYSTEM_VERSION < 3)
Deleted: code/trunk/src/libraries/core/SmartPtr.h
===================================================================
--- code/trunk/src/libraries/core/SmartPtr.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/SmartPtr.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,317 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-// Inspired by boost::intrusive_ptr by Peter Dimov
-
-/**
- @defgroup SmartPtr SmartPtr<T> and WeakPtr<T>
- @ingroup Object
-*/
-
-/**
- @file
- @ingroup Object SmartPtr
- @brief Definition of SmartPtr<T>, wraps a pointer to an object and keeps it alive.
-
- @anchor SmartPtrExample
-
- orxonox::SmartPtr is an implementation of a smart pointer - it wraps a pointer to an
- object and keeps this object alive until no SmartPtr points to this object anymore.
- In contrast to orxonox::SharedPtr, SmartPtr works only with classes that are derived
- from orxonox::OrxonoxClass, because it's an intrusive implementation, meaning the
- reference counter is stored in the object itself.
-
- It's possible to use normal pointers and smart pointers to an object simultaneously.
- You don't have to use SmartPtr all the time, you can create a SmartPtr for an object
- at any time and also convert it back to a normal pointer if you like. This is possible
- because the reference counter is stored in the object itself and not in SmartPtr (in
- contrast to SharedPtr).
-
- @b Important: If you want to delete an object, you must not use @c delete @c object but
- rather @c object->destroy(). This function will check if there are smart pointers
- pointing to the object. If yes, the object will be kept alive until all smart pointes
- are destroyed. If no, the object is deleted instantly.
-
- If all smart pointers that point to an object are destroyed, but you never called
- @c object->destroy() before, the object will not be deleted! All a SmartPtr will do
- is to really just keep an object alive, but it will not delete it automatically
- unless you tried to destroy it before.
-
- Example:
- @code
- class MyClass // class declaration
- {
- public:
- void setObject(OtherClass* object) // passes a normal pointer which will be stored in a SmartPtr
- { this->object_ = object; }
-
- OtherClass* getObject() const // converts the SmartPtr to a normal pointer and returns it
- { return this->object_; }
-
- private:
- SmartPtr<OtherClass> object_; // a pointer to an instance of OtherClass is stored in a SmartPtr
- };
- @endcode
- In this example we assume that OtherClass is a child of OrxonoxClass. We don't care
- about the inheritance of MyClass though.
-
- Now we create an instance of MyClass and assign a pointer to an instance of OtherClass:
- @code
- MyClass* myclass = new MyClass(); // create an instance of MyClass
- OtherClass* object = new OtherClass(); // create an instance of OtherClass
- myclass->setObject(object); // the object is now stored in a SmartPtr inside myclass
-
- object->destroy(); // we try to destroy object, but there's still a SmartPtr pointing at it.
-
- # object still exists at this point (because a SmartPtr points at it)
-
- delete myclass; // now we delete myclass, which also destroys the SmartPtr
-
- # object doesn't exist anymore (because the SmartPtr is now destroyed)
- @endcode
-
- Now we look at the same example, but we first delete myclass, then destroy object:
- @code
- MyClass* myclass = new MyClass(); // create an instance of MyClass
- OtherClass* object = new OtherClass(); // create an instance of OtherClass
- myclass->setObject(object); // the object is now stored in a SmartPtr inside myclass
-
- delete myclass; // we delete myclass, which also destroys the SmartPtr
-
- # object still exists at this point (because destroy() was not called yet)
-
- object->destroy(); // now we try to destroy object, which works instantly
-
- # object doesn't exist anymore (because we just destroyed it)
- @endcode
-
- Note that in any case @c object->destroy() has to be called to delete the object.
- However if a SmartPtr points at it, the destruction is delayed until all SmartPtr
- are destroyed.
-*/
-
-#ifndef _SmartPtr_H__
-#define _SmartPtr_H__
-
-#include "CorePrereqs.h"
-
-#include <cassert>
-
-#include "Identifier.h"
-#include "OrxonoxClass.h"
-#include "WeakPtr.h"
-
-namespace orxonox
-{
- /**
- @brief A smart pointer which wraps a pointer to an object and keeps this object alive as long as the smart pointer exists.
-
- @see See @ref SmartPtrExample "this description" for more information and an example.
- */
- template <class T>
- class SmartPtr
- {
- public:
- /// Constructor: Initializes the smart pointer with a null pointer.
- inline SmartPtr() : pointer_(0), base_(0)
- {
- }
-
- /// Constructor: Used to explicitly initialize the smart pointer with a null pointer
- inline SmartPtr(int) : pointer_(0), base_(0)
- {
- }
-
- /// Constructor: Initializes the smart pointer with a pointer to an object. @param pointer The pointer @param bAddRef If true, the reference counter is increased. Don't set this to false unless you know exactly what you're doing! (for example to avoid circular references if the @c this pointer of the possessing object is stored)
- inline SmartPtr(T* pointer, bool bAddRef = true) : pointer_(pointer), base_(pointer)
- {
- if (this->base_ && bAddRef)
- this->base_->incrementReferenceCount();
- }
-
- /// Copy-constructor
- inline SmartPtr(const SmartPtr& other) : pointer_(other.pointer_), base_(other.base_)
- {
- if (this->base_)
- this->base_->incrementReferenceCount();
- }
-
- /// Copy-constructor for smart pointers to objects of another class.
- template <class O>
- inline SmartPtr(const SmartPtr<O>& other) : pointer_(other.get()), base_(other.base_)
- {
- if (this->base_)
- this->base_->incrementReferenceCount();
- }
-
- /// Constructor: Initializes the smart pointer with the pointer that is stored in a WeakPtr.
- template <class O>
- inline SmartPtr(const WeakPtr<O>& other) : pointer_(other.get()), base_(other.getBase())
- {
- if (this->base_)
- this->base_->incrementReferenceCount();
- }
-
- /// Destructor: Decrements the reference counter.
- inline ~SmartPtr()
- {
- if (this->base_)
- this->base_->decrementReferenceCount();
- }
-
- /// Used to assign a null pointer.
- inline SmartPtr& operator=(int)
- {
- SmartPtr(0).swap(*this);
- return *this;
- }
-
- /// Assigns a new pointer.
- inline SmartPtr& operator=(T* pointer)
- {
- SmartPtr(pointer).swap(*this);
- return *this;
- }
-
- /// Assigns the wrapped pointer of another SmartPtr.
- inline SmartPtr& operator=(const SmartPtr& other)
- {
- SmartPtr(other).swap(*this);
- return *this;
- }
-
- /// Assigns the wrapped pointer of a SmartPtr of another class
- template <class O>
- inline SmartPtr& operator=(const SmartPtr<O>& other)
- {
- SmartPtr(other).swap(*this);
- return *this;
- }
-
- /// Assigns the wrapped pointer of a WeakPtr.
- template <class O>
- inline SmartPtr& operator=(const WeakPtr<O>& other)
- {
- SmartPtr(other).swap(*this);
- return *this;
- }
-
- /// Returns the wrapped pointer as @c T*
- inline T* get() const
- {
- return this->pointer_;
- }
-
- /// Returns the wrapped pointer as @c OrxonoxClass*
- inline OrxonoxClass* getBase() const
- {
- return this->base_;
- }
-
- /// Implicitly converts the SmartPtr to a pointer of type @c T*
- inline operator T*() const
- {
- return this->pointer_;
- }
-
- /// Overloaded operator, returns a pointer to the stored object.
- inline T* operator->() const
- {
- assert(this->pointer_ != 0);
- return this->pointer_;
- }
-
- /// Overloaded operator, returns a reference to the stored object.
- inline T& operator*() const
- {
- assert(this->pointer_ != 0);
- return *this->pointer_;
- }
-
- /// Returns true if the wrapped pointer is NULL.
- inline bool operator!() const
- {
- return (this->pointer_ == 0);
- }
-
- /// Swaps the contents of two smart pointers.
- inline void swap(SmartPtr& other)
- {
- {
- T* temp = this->pointer_;
- this->pointer_ = other.pointer_;
- other.pointer_ = temp;
- }
- {
- OrxonoxClass* temp = this->base_;
- this->base_ = other.base_;
- other.base_ = temp;
- }
- }
-
- /// Resets the smart pointer (equivalent to assigning a NULL pointer).
- inline void reset()
- {
- SmartPtr().swap(*this);
- }
-
- private:
- T* pointer_; ///< The wrapped pointer to an object of type @a T
- OrxonoxClass* base_; ///< The wrapped pointer, casted up to OrxonoxClass (this is needed because with just a T* pointer, SmartPtr couln't be used with forward declarations)
- };
-
- /// Swaps the contents of two smart pointers.
- template <class T>
- void swap(SmartPtr<T>& a, SmartPtr<T>& b)
- {
- a.swap(b);
- }
-
- /// Uses a static_cast to cast a pointer of type U* to a pointer of type T* and returns it in a new SmartPtr<T>.
- template <class T, class U>
- SmartPtr<T> static_pointer_cast(const SmartPtr<U>& p)
- {
- return static_cast<T*>(p.get());
- }
-
- /// Uses a const_cast to cast a pointer of type U* to a pointer of type T* and returns it in a new SmartPtr<T>.
- template <class T, class U>
- SmartPtr<T> const_pointer_cast(const SmartPtr<U>& p)
- {
- return const_cast<T*>(p.get());
- }
-
- /// Uses a dynamic_cast to cast a pointer of type U* to a pointer of type T* and returns it in a new SmartPtr<T>.
- template <class T, class U>
- SmartPtr<T> dynamic_pointer_cast(const SmartPtr<U>& p)
- {
- return orxonox_cast<T*>(p.get());
- }
-}
-
-#endif /* _SmartPtr_H__ */
Deleted: code/trunk/src/libraries/core/SubclassIdentifier.h
===================================================================
--- code/trunk/src/libraries/core/SubclassIdentifier.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/SubclassIdentifier.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,204 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @ingroup Class Identifier
- @brief Definition of SubclassIdentifier.
-
- @anchor SubclassIdentifierExample
-
- SubclassIdentifier is a separated class, acting like an Identifier, but has a given class.
- You can only assign Identifiers of exactly the given class or of a derivative to a SubclassIdentifier.
-
- Example:
-
- You can assign an Identifier either through the constructor or by using the assignment @c operator=:
- @code
- SubclassIdentifier<BaseClass> identifier = Class(SubClass);
- @endcode
-
- The @c operator-> is overloaded an returns the assigned Identifier. That way you can just call
- functions of the assigned Identifier by using @c ->function():
- @code
- SubclassIdentifier<BaseClass> identifier = Class(SubClass);
- identifier->getName(); // returns "SubClass"
- @endcode
-
- There are two possibilities to create an object out of a SubclassIdentifier: Either you just use
- the @c fabricate() function of the assigned Identifier through the overloaded @c operator->, which
- returns a @c BaseObject* pointer, or you use the function of SubclassIdentifier, this time by using
- @c operator., which returns a @c BaseClass* pointer (@a BaseClass is the baseclass specified by the
- template argument):
- @code
- identifier->fabricate(); // calls Identifier::fabricate(), creates a SubClass, returns a BaseObject* pointer
-
- identifier.fabricate(); // calls SubclassIdentifier::fabricate(), creates a SubClass, returns a BaseClass* pointer
- @endcode
-*/
-
-#ifndef _SubclassIdentifier_H__
-#define _SubclassIdentifier_H__
-
-#include "CorePrereqs.h"
-
-#include <cstdlib>
-#include "util/Output.h"
-#include "Identifier.h"
-
-namespace orxonox
-{
- // ###############################
- // ### SubclassIdentifier ###
- // ###############################
- /**
- @brief The SubclassIdentifier acts almost like an Identifier, but has some prerequisites.
-
- You can only assign an Identifier that belongs to a class T (or derived) to a SubclassIdentifier<T>.
- If you assign something else, the program prints an error.
-
- Because we know the base-type, a @c dynamic_cast is done, which makes it easier to create a new object.
-
- @see See @ref SubclassIdentifierExample "SubclassIdentifier.h" for some examples.
- */
- template <class T>
- class SubclassIdentifier
- {
- public:
- /// Constructor: Automaticaly assigns the Identifier of the given class.
- SubclassIdentifier()
- {
- this->identifier_ = ClassIdentifier<T>::getIdentifier();
- }
-
- /// Constructor: Assigns the given Identifier.
- SubclassIdentifier(Identifier* identifier)
- {
- this->operator=(identifier);
- }
-
- /// Copyconstructor: Assigns the identifier of another SubclassIdentifier.
- template <class O>
- SubclassIdentifier(const SubclassIdentifier<O>& identifier)
- {
- this->operator=(identifier.getIdentifier());
- }
-
- /**
- @brief Overloading of the = operator: assigns the identifier and checks its type.
- @param identifier The Identifier to assign
- @return The SubclassIdentifier itself
- */
- SubclassIdentifier<T>& operator=(Identifier* identifier)
- {
- if (!identifier || !identifier->isA(ClassIdentifier<T>::getIdentifier()))
- {
- orxout(internal_error) << "An error occurred in SubclassIdentifier (Identifier.h):" << endl;
- if (identifier)
- {
- orxout(internal_error) << "Class " << identifier->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << '!' << endl;
- orxout(internal_error) << "SubclassIdentifier<" << ClassIdentifier<T>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden." << endl;
- }
- else
- {
- orxout(internal_error) << "Can't assign NULL identifier" << endl;
- }
- }
- else
- {
- this->identifier_ = identifier;
- }
- return *this;
- }
-
- /// Overloading of the = operator: assigns the identifier of another SubclassIdentifier.
- template <class O>
- SubclassIdentifier<T>& operator=(const SubclassIdentifier<O>& identifier)
- {
- return this->operator=(identifier.getIdentifier());
- }
-
- /// Overloading of the * operator: returns the assigned identifier.
- inline Identifier* operator*() const
- {
- return this->identifier_;
- }
-
- /// Overloading of the -> operator: returns the assigned identifier.
- inline Identifier* operator->() const
- {
- return this->identifier_;
- }
-
- /// Returns the assigned identifier. This allows you to assign a SubclassIdentifier to a normal Identifier*.
- inline operator Identifier*() const
- {
- return this->identifier_;
- }
-
- /// Creates a new object of the type of the assigned Identifier and dynamic_casts it to the minimal type given by T.
- T* fabricate(BaseObject* creator) const
- {
- BaseObject* newObject = this->identifier_->fabricate(creator);
-
- // Check if the creation was successful
- if (newObject)
- {
- return orxonox_cast<T*>(newObject);
- }
- else
- {
- // Something went terribly wrong
- if (this->identifier_)
- {
- orxout(user_error) << "An error occurred in SubclassIdentifier (Identifier.h):" << endl;
- orxout(user_error) << "Class " << this->identifier_->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << '!' << endl;
- orxout(user_error) << "Couldn't fabricate a new Object." << endl;
- }
- else
- {
- orxout(user_error) << "An error occurred in SubclassIdentifier (Identifier.h):" << endl;
- orxout(user_error) << "Couldn't fabricate a new Object - Identifier is undefined." << endl;
- }
-
- orxout(user_error) << "Aborting..." << endl;
- abort();
- return 0;
- }
- }
-
- /// Returns the assigned identifier.
- inline Identifier* getIdentifier() const
- { return this->identifier_; }
-
- private:
- Identifier* identifier_; //!< The assigned identifier
- };
-}
-
-#endif /* _SubclassIdentifier_H__ */
Deleted: code/trunk/src/libraries/core/Super.h
===================================================================
--- code/trunk/src/libraries/core/Super.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/Super.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,634 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @defgroup Super Super
- @ingroup Class
-*/
-
-/**
- @file
- @ingroup Class Super
- @brief Definition of all super-function related macros, used to call functions of the base class.
-
- This file defines all macros needed to add a new "super-function". If you add
- a super-function, you can call <tt>SUPER(myclass, functionname, arguments)</tt>
- inside your code and the function of the parent-class gets called. This is comparable
- to <tt>super.functionname(arguments)</tt> in Java or other languages.
-
- This works only with virtual functions that return nothing (@c void) and belong to
- classes that have an @ref orxonox::Identifier "Identifier". Arguments however are
- supported, there's no limitation for their number and type, except that the type has
- to be known in Super.h.
-
- To add a new super-function, you have to process 4 steps:
-
- -# Add a new @c SUPER macro <br />
- This allows you to call the super-function in your code. <br />
- Location: This file (Super.h), marked with "--> HERE <--" comments (1/3)
- -# Call the @c SUPER_FUNCTION_GLOBAL_DECLARATION_PART1/2 macros. <br />
- This defines some global classes and templates, needed to create and call the super-functions. <br />
- Location: This file (Super.h), marked with "--> HERE <--" comments (2/3)
- -# Call the @c SUPER_INTRUSIVE_DECLARATION macro. <br />
- This will be included into the declaration of @c ClassIdentifier<T>. <br />
- Location: This file (Super.h), marked with "--> HERE <--" comments (3/3)
- -# Call the @c SUPER_FUNCTION macro. <br />
- This defines a partially specialized template that will decide if a class is "super" to another class.
- If the check returns true, a @c SuperFunctionCaller gets created, which will be used by the @c SUPER macro.
- You have to add this into the header-file of the baseclass of the super-function (the class that first
- implements the function), below the class declaration. You can't call it directly in this file, because
- otherwise you had to include the headerfile right here, which would cause some ugly back-dependencies,
- include loops and slower compilation. <br />
- Dont forget to include Super.h in the header-file. <br />
- Location: The header-file of the baseclass (Baseclass.h), below the class declaration
-*/
-
-#ifndef _Super_H__
-#define _Super_H__
-
-#include "CorePrereqs.h"
-#include "util/Output.h"
-
-///////////////////////
-// Macro definitions //
-///////////////////////
-
-//// Common macros ////
-
- /**
- @brief Declares a new super-function by creating a specialized template. Add this below the class declaration of the baseclass.
- @param functionnumber Each super-function needs a unique number, starting with zero, increasing by one
- @param baseclass The baseclass of the super-function (~the root)
- @param functionname The name of the super-function
- @param purevirtualbase "true" if the function is pure virtual in the baseclass, "false" if the function is implemented (without "")
- */
- #define SUPER_FUNCTION(functionnumber, baseclass, functionname, purevirtualbase) \
- template <class T, int templatehack2> \
- struct SuperFunctionCondition<functionnumber, T, 0, templatehack2> \
- { \
- static void superCheck() \
- { \
- SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0)); \
- SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::superCheck(); \
- } \
- \
- static void apply(void*) {} \
- \
- static void apply(baseclass*) \
- { \
- ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier(); \
- for (std::set<const Identifier*>::iterator it = identifier->getDirectChildrenIntern().begin(); it != identifier->getDirectChildrenIntern().end(); ++it) \
- { \
- if (((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_) \
- { \
- delete ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_; \
- ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = 0; \
- ((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ = false; \
- } \
- \
- if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_) \
- { \
- orxout(verbose, context::super) << "Added SuperFunctionCaller for " << #functionname << ": " << ClassIdentifier<T>::getIdentifier()->getName() << " <- " << ((ClassIdentifier<T>*)(*it))->getName() << endl; \
- ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>; \
- } \
- else if (((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier()) \
- orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*)(*it))->getName() << " calls function of " << ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl; \
- } \
- } \
- }; \
- \
- SUPER_FUNCTION_PUREVIRTUAL_WORKAROUND##purevirtualbase(functionnumber, baseclass)
-
- #define SUPER_FUNCTION_PUREVIRTUAL_WORKAROUND0(functionnumber, baseclass) SUPER_FUNCTION_PUREVIRTUAL_WORKAROUNDfalse(functionnumber, baseclass)
- #define SUPER_FUNCTION_PUREVIRTUAL_WORKAROUND1(functionnumber, baseclass) SUPER_FUNCTION_PUREVIRTUAL_WORKAROUNDtrue(functionnumber, baseclass)
- #define SUPER_FUNCTION_PUREVIRTUAL_WORKAROUNDfalse(functionnumber, baseclass)
- #define SUPER_FUNCTION_PUREVIRTUAL_WORKAROUNDtrue(functionnumber, baseclass) \
- template <int templatehack2> \
- struct SuperFunctionCondition<functionnumber, baseclass, 0, templatehack2> \
- { \
- static void superCheck() \
- { \
- SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>::superCheck(); \
- } \
- };
-
-
- /*
- //// Comments about the macro ////
-
- // Partially specialized template (templatehack is now specialized too).
- //
- // This ensures the compiler takes THIS template if the header-file of the super-function
- // is included. In any other case, the compiler just uses the fallback template which is
- // defined in this file.
- template <class T, templatehack2>
- struct SuperFunctionCondition<functionnumber, T, 0, templatehack2>
- {
- static void superCheck()
- {
- // This call to the apply-function is the whole check. By calling the function with
- // a T* pointer, the right function get's called.
- SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0));
-
- // Go go the superCheck for of next super-function (functionnumber + 1)
- SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::superCheck();
- }
-
- // This function gets called if T is not a child of the baseclass.
- // The function does nothing.
- static void apply(void* temp) {}
-
- // This function gets called if T is a child of the baseclass and can therefore be converted.
- // The function adds a SuperFunctionCaller to the Identifier of all subclasses of T.
- static void apply(baseclass* temp)
- {
- ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier();
-
- // Iterate through all children
- for (std::set<const Identifier*>::iterator it = identifier->getDirectChildrenIntern().begin(); it != identifier->getDirectChildrenIntern().end(); ++it)
- {
- // Check if the caller is a fallback-caller
- if (((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_)
- {
- // Delete the fallback caller an prepare to get a real caller
- delete ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_;
- ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = 0;
- ((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ = false;
- }
-
- // Check if there's not already a caller
- if (!((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_)
- {
- // Add the SuperFunctionCaller
- orxout(verbose, context::super) << "adding functionpointer to " << ((ClassIdentifier<T>*)(*it))->getName() << endl;
- ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_##functionname <T>;
- }
-
- // If there is already a caller, but for another parent, print a warning
- else if (((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier() != ClassIdentifier<T>::getIdentifier())
- orxout(internal_warning, context::super) << "SuperFunctionCaller for " << #functionname << " in " << ((ClassIdentifier<T>*)(*it))->getName() << " calls function of " << ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_->getParentIdentifier()->getName() << " but " << ClassIdentifier<T>::getIdentifier()->getName() << " is also possible (do you use multiple inheritance?)" << endl;
- }
- }
- };
- SUPER_FUNCTION_PUREVIRTUAL_WORKAROUND##purevirtualbase
-
-
- // The following piece of code is only added if purevirtualbase = true
-
- // Explicit specialization of the Condition template for the baseclass to avoid
- // errors if the function is pure virtual in the baseclass.
- template <int templatehack2> \
- struct SuperFunctionCondition<functionnumber, baseclass, 0, templatehack2> \
- { \
- // The superCheck function acts like the fallback - it advances to the check for the next super-function (functionnumber + 1)
- static void superCheck() \
- { \
- SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>::superCheck(); \
- } \
- };
- */
-
- /// SUPER-macro: Calls Parent::functionname(...) where Parent is the direct parent of @a classname
- #ifdef ORXONOX_COMPILER_MSVC
- #define SUPER(classname, functionname, ...) \
- __super::functionname(__VA_ARGS__)
- #else
- #define SUPER(classname, functionname, ...) \
- SUPER_##functionname(classname, functionname, __VA_ARGS__)
- #endif
-
- // helper macro: for functions without arguments
- #define SUPER_NOARGS(classname, functionname) \
- (*ClassIdentifier<classname>::getIdentifier()->superFunctionCaller_##functionname##_)(this)
-
- // helper macro: for functions with arguments
- #define SUPER_ARGS(classname, functionname, ...) \
- (*ClassIdentifier<classname>::getIdentifier()->superFunctionCaller_##functionname##_)(this, __VA_ARGS__)
-
-
-//// Function-specific macros ////
-
- /*
- Add a macro for each super-function
-
- Example (no arguments):
- #define SUPER_myfunction(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- Example (with arguments):
- #define SUPER_myfunction(classname, functionname, ...) \
- SUPER_ARGS(classname, functionname, __VA_ARGS__)
- */
-
- // (1/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
- #define SUPER_XMLPort(classname, functionname, ...) \
- SUPER_ARGS(classname, functionname, __VA_ARGS__)
-
- #define SUPER_tick(classname, functionname, ...) \
- SUPER_ARGS(classname, functionname, __VA_ARGS__)
-
- #define SUPER_changedActivity(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_changedVisibility(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_XMLEventPort(classname, functionname, ...) \
- SUPER_ARGS(classname, functionname, __VA_ARGS__)
-
- #define SUPER_changedScale(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_changedOwner(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_changedOverlayGroup(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_changedName(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_changedGametype(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_changedUsed(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_changedCarrier(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- #define SUPER_changedPickedUp(classname, functionname, ...) \
- SUPER_NOARGS(classname, functionname)
-
- // (1/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
-
-
-namespace orxonox
-{
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // This code gets included by Identifier.h and every other header file that needs a super-function //
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- //// Common code ////
-
- // Base templates
- /**
- @brief Creates the SuperFunctionCaller if T is a child of the super-functions baseclass.
- */
- template <int functionnumber, class T, int templatehack1, int templatehack2>
- struct SuperFunctionCondition
- {
- static void superCheck() {}
- };
-
- /**
- @brief Initializes the SuperFunctionCaller-pointer with zero.
- */
- template <int functionnumber, class T>
- struct SuperFunctionInitialization
- {
- static void initialize(ClassIdentifier<T>*) {}
- };
-
- /**
- @brief Deletes the SuperFunctionCaller.
- */
- template <int functionnumber, class T>
- struct SuperFunctionDestruction
- {
- static void destroy(ClassIdentifier<T>*) {}
- };
-
-
- //// Function-specific code ////
-
- /**
- @brief Creates the needed objects and templates to call a super-function.
- @param functionnumber Each super-function needs a unique number, starting with zero, increasing by one
- @param functionname The name of the super-function
- @param hasarguments "false" if the function doesn't take any arguments, "true" if it does (without "")
- @param ... Variadic: If the function takes arguments, add them here with type and name. Example: int myvalue, float myothervalue
- */
- #define SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(functionnumber, functionname, hasarguments, ...) \
- template <class T, int templatehack1, int templatehack2> \
- struct SuperFunctionCondition<functionnumber, T, templatehack1, templatehack2> \
- { \
- static void superCheck() \
- { \
- SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>::superCheck(); \
- } \
- }; \
- \
- class _CoreExport SuperFunctionCaller_##functionname \
- { \
- public: \
- virtual void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) = 0; \
- virtual ~SuperFunctionCaller_##functionname () {} \
- virtual Identifier* getParentIdentifier() const = 0; \
- }; \
- \
- template <class T> \
- class SuperFunctionClassCaller_purevirtualfallback_##functionname : public SuperFunctionCaller_##functionname \
- { \
- public: \
- inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) \
- { \
- } \
- \
- Identifier* getParentIdentifier() const \
- { \
- return ClassIdentifier<T>::getIdentifier(); \
- } \
- }; \
- \
- template <class T> \
- struct SuperFunctionInitialization<functionnumber, T> \
- { \
- static void initialize(ClassIdentifier<T>* identifier) \
- { \
- identifier->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_purevirtualfallback_##functionname <T>; \
- identifier->bSuperFunctionCaller_##functionname##_isFallback_ = true; \
- SuperFunctionInitialization<functionnumber + 1, T>::initialize(identifier); \
- } \
- }; \
- \
- template <class T> \
- struct SuperFunctionDestruction<functionnumber, T> \
- { \
- static void destroy(ClassIdentifier<T>* identifier) \
- { \
- if (identifier->superFunctionCaller_##functionname##_) \
- delete identifier->superFunctionCaller_##functionname##_; \
- SuperFunctionDestruction<functionnumber + 1, T>::destroy(identifier); \
- } \
- }; \
- \
- template <class T> \
- class SuperFunctionClassCaller_##functionname : public SuperFunctionCaller_##functionname \
- { \
- public: \
- inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) \
- { \
- (orxonox_cast<T*>(object))->T:: functionname
-
- /*
- JUST ADD THE FUNCTION ARGUMENTS BETWEEN BOTH MACROS, ENCLOSED BY BRACKETS
- EXAMPLE:
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(0, myfunction, true, int myvalue, float myothervalue) <-- !!! DONT ADD A SEMICOLON HERE !!!
- (myvalue, myothervalue)
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2
- */
-
- #define SUPER_FUNCTION_GLOBAL_DECLARATION_PART2 \
- ; \
- } \
- \
- Identifier* getParentIdentifier() const \
- { \
- return ClassIdentifier<T>::getIdentifier(); \
- } \
- };
-
- #define SUPER_CALL_ARGUMENTSfalse(...) OrxonoxClass* object
- #define SUPER_CALL_ARGUMENTS0(...) OrxonoxClass* object
- #define SUPER_CALL_ARGUMENTStrue(...) OrxonoxClass* object, __VA_ARGS__
- #define SUPER_CALL_ARGUMENTS1(...) OrxonoxClass* object, __VA_ARGS__
-
-
- /*
- //// COMMENTS ABOUT THE MACRO ////
-
- // Partially specialized template (templatehack not yet specialized, this
- // will be done by the real condition in the header-file of the super-function)
- // Only used as fallback
- template <class T, int templatehack1, int templatehack2>
- struct SuperFunctionCondition<functionnumber, T, templatehack1, templatehack2>
- {
- // If this function gets called, the header-file of the super function is not
- // included, so this fallback template (templatehack not specialized) is used
- static void superCheck()
- {
- // Calls the condition-check of the next super-function (functionnumber + 1)
- SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>::superCheck();
- }
- };
-
- // Baseclass of the super-function caller. The real call will be done by a
- // templatized subclass through the virtual () operator.
- class _CoreExport SuperFunctionCaller_##functionname
- {
- public:
- virtual void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) = 0;
- virtual ~SuperFunctionCaller_##functionname () {}
- virtual Identifier* getParentIdentifier() const = 0;
- };
-
- // Fallback if the base is pure virtual
- template <class T>
- class SuperFunctionClassCaller_purevirtualfallback_##functionname : public SuperFunctionCaller_##functionname
- {
- public:
- // Fallback does nothing
- inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) )
- {
- }
-
- Identifier* getParentIdentifier() const
- {
- return ClassIdentifier<T>::getIdentifier();
- }
- };
-
- // Initializes the SuperFunctionCaller-pointer with a fallback caller in case the base function is pure virtual
- template <class T>
- struct SuperFunctionInitialization<functionnumber, T>
- {
- static void initialize(ClassIdentifier<T>* identifier)
- {
- identifier->superFunctionCaller_##functionname##_ = new SuperFunctionClassCaller_purevirtualfallback_##functionname <T>;
- identifier->bSuperFunctionCaller_##functionname##_isFallback_ = true;
-
- // Calls the initialization of the next super-function (functionnumber + 1)
- SuperFunctionInitialization<functionnumber + 1, T>::initialize(identifier);
- }
- };
-
- // Deletes the SuperFunctionCaller.
- template <class T>
- struct SuperFunctionDestruction<functionnumber, T>
- {
- static void destroy(ClassIdentifier<T>* identifier)
- {
- if (identifier->superFunctionCaller_##functionname##_)
- delete identifier->superFunctionCaller_##functionname##_;
-
- // Calls the destruction of the next super-function (functionnumber + 1)
- SuperFunctionDestruction<functionnumber + 1, T>::destroy(identifier);
- }
- };
-
- // The real super-function caller: Calls T::functionname()
- // T should be the parent, but this will be done by the spezialized condition template
- template <class T>
- class SuperFunctionClassCaller_##functionname : public SuperFunctionCaller_##functionname
- {
- public:
- // @brief Calls the function.
- // @param object The object to call the function on
- // @param ... The arguments of the function
- inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) )
- {
- (orxonox_cast<T*>(object))->T:: functionname ( Call the function with it's arguments );
- }
-
- Identifier* getParentIdentifier() const
- {
- return ClassIdentifier<T>::getIdentifier();
- }
- }
- */
-
-
- //// Execute the code for each super-function ////
-
- // (2/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(0, XMLPort, true, Element& xmlelement, XMLPort::Mode mode)
- (xmlelement, mode)
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(1, tick, true, float dt)
- (dt)
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(2, changedActivity, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(3, changedVisibility, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(4, XMLEventPort, true, Element& xmlelement, XMLPort::Mode mode)
- (xmlelement, mode)
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(5, changedScale, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(6, changedOwner, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(7, changedOverlayGroup, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(8, changedName, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(9, changedGametype, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(10, changedUsed, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(11, changedCarrier, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(12, changedPickedUp, false)
- ()
- SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
-
- // (2/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
-
-}
-
-#else /* _Super_H__ */
- #ifdef SUPER_INTRUSIVE_DECLARATION_INCLUDE
-
-//////////////////////////////////////////////////////////////////////////
-// This code gets included within the declaration of ClassIdentifier<T> //
-//////////////////////////////////////////////////////////////////////////
-
-//// Common code ////
-
- private:
-
- template <int functionnumber, class TT, int templatehack1, int templatehack2>
- friend struct SuperFunctionCondition;
-
- // Creates the super-function-callers by calling the first SuperFunctionCondition check
- // This get's called within the initialization of an Identifier
- virtual void createSuperFunctionCaller() const
- {
- SuperFunctionCondition<0, T, 0, 0>::superCheck();
- }
-
-
-//// Function-specific code ////
-
- public:
- /**
- @brief Adds a pointer to the SuperFunctionCaller as a member of ClassIdentifier.
- @param functionname The name of the super-function
- */
- #ifndef SUPER_INTRUSIVE_DECLARATION
- #define SUPER_INTRUSIVE_DECLARATION(functionname) \
- SuperFunctionCaller_##functionname * superFunctionCaller_##functionname##_; \
- bool bSuperFunctionCaller_##functionname##_isFallback_
- #endif
-
-
-//// Execute the code for each super-function ////
-
- // (3/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
- SUPER_INTRUSIVE_DECLARATION(XMLPort);
- SUPER_INTRUSIVE_DECLARATION(tick);
- SUPER_INTRUSIVE_DECLARATION(changedActivity);
- SUPER_INTRUSIVE_DECLARATION(changedVisibility);
- SUPER_INTRUSIVE_DECLARATION(XMLEventPort);
- SUPER_INTRUSIVE_DECLARATION(changedScale);
- SUPER_INTRUSIVE_DECLARATION(changedOwner);
- SUPER_INTRUSIVE_DECLARATION(changedOverlayGroup);
- SUPER_INTRUSIVE_DECLARATION(changedName);
- SUPER_INTRUSIVE_DECLARATION(changedGametype);
- SUPER_INTRUSIVE_DECLARATION(changedUsed);
- SUPER_INTRUSIVE_DECLARATION(changedCarrier);
- SUPER_INTRUSIVE_DECLARATION(changedPickedUp);
- // (3/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
-
-
- #undef SUPER_INTRUSIVE_DECLARATION_INCLUDE
- #endif /* SUPER_INTRUSIVE_DECLARATION_INCLUDE */
-#endif /* _Super_H__ */
Modified: code/trunk/src/libraries/core/Template.cc
===================================================================
--- code/trunk/src/libraries/core/Template.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/Template.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,9 +37,9 @@
namespace orxonox
{
- CreateFactory(Template);
+ RegisterClass(Template);
- Template::Template(BaseObject* creator) : BaseObject(creator)
+ Template::Template(Context* context) : BaseObject(context)
{
this->xmlelement_ = new TiXmlElement("");
@@ -149,7 +149,7 @@
orxout(verbose, context::templates) << object->getLoaderIndentation() << " aplying Template \"" << this->getName() << "\"..." << endl;
// check if the template is applied on an object of the right type
- Identifier* identifier = Identifier::getIdentifierByString(this->getXMLElement().Value());
+ Identifier* identifier = ClassByString(this->getXMLElement().Value());
if (!object->getIdentifier()->isA(identifier))
orxout(internal_warning, context::templates) << "Template was defined for " << identifier->getName() << " but the object is of type " << object->getIdentifier()->getName() << endl;
Modified: code/trunk/src/libraries/core/Template.h
===================================================================
--- code/trunk/src/libraries/core/Template.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/Template.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -50,7 +50,7 @@
class _CoreExport Template : public BaseObject
{
public:
- Template(BaseObject* creator);
+ Template(Context* context);
virtual ~Template();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/libraries/core/ViewportEventListener.cc
===================================================================
--- code/trunk/src/libraries/core/ViewportEventListener.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/ViewportEventListener.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -31,8 +31,10 @@
namespace orxonox
{
+ RegisterAbstractClass(ViewportEventListener).inheritsFrom(Class(Listable));
+
ViewportEventListener::ViewportEventListener()
{
- RegisterRootObject(ViewportEventListener);
+ RegisterObject(ViewportEventListener);
}
}
Modified: code/trunk/src/libraries/core/ViewportEventListener.h
===================================================================
--- code/trunk/src/libraries/core/ViewportEventListener.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/ViewportEventListener.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,11 +32,11 @@
#include "CorePrereqs.h"
#include "util/OgreForwardRefs.h"
-#include "OrxonoxClass.h"
+#include "object/Listable.h"
namespace orxonox
{
- class _CoreExport ViewportEventListener : virtual public OrxonoxClass
+ class _CoreExport ViewportEventListener : virtual public Listable
{
public:
virtual void cameraChanged(Ogre::Viewport* viewport, Ogre::Camera* oldCamera) {}
Deleted: code/trunk/src/libraries/core/WeakPtr.h
===================================================================
--- code/trunk/src/libraries/core/WeakPtr.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/WeakPtr.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,286 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-// Inspired by boost::intrusive_ptr by Peter Dimov
-
-/**
- @file
- @ingroup Object SmartPtr
- @brief Definition of WeakPtr<T>, wraps a pointer to an object.
-
- @anchor WeakPtrExample
-
- A WeakPtr wraps a pointer to an object. If the object gets deleted, the WeakPtr becomes
- NULL. This can be used to store pointers to objects without knowing when they will be
- destroyed.
-
- WeakPtr works only with objects that are derived from orxonox::OrxonoxClass, because
- WeakPtr is intrusive and registers itself in the stored object, to get a notification if
- the object is being deleted.
-
- Example:
- @code
- MyClass* object = new MyClass(); // create an instance of MyClass
-
- WeakPtr<MyClass> pointer = object; // create a WeakPtr and assign the object
-
- if (pointer) // checks if pointer is not NULL (which is true)
- pointer->someFunction(); // calls MyClass::someFunction()
-
- object->destroy(); // calls destroy() which deletes the object
-
- if (pointer) // checks if pointer is not NULL (which is now false)
- pointer->someFunction(); // this will not be executed
- @endcode
- In this example we assumed that MyClass is derived of OrxonoxClass (otherwise it couldn't
- be used with a WeakPtr).
-
- A callback can be registerd with the WeakPtr that will be called if the object gets deleted.
- @code
- void myCallback() // definition of the callback function
- {
- orxout() << "Object destroyed" << endl;
- }
-
- MyClass* object = new MyClass(); // create an instance of MyClass
-
- WeakPtr<MyClass> pointer = object; // create a WeakPtr and assign the object
-
- pointer.setCallback(createFunctor(&myCallback)); // defines a callback
-
- object->destroy(); // calls destroy() which deletes the object. prints "Object destroyed" to the console
- @endcode
-*/
-
-#ifndef _WeakPtr_H__
-#define _WeakPtr_H__
-
-#include "CorePrereqs.h"
-
-#include <cassert>
-#include "Identifier.h"
-#include "OrxonoxClass.h"
-#include "command/Functor.h"
-
-namespace orxonox
-{
- /**
- @brief WeakPtr wraps a pointer to an object, which becomes NULL if the object is deleted.
-
- @see See @ref WeakPtrExample "this description" for more information and an example.
- */
- template <class T>
- class WeakPtr : public DestructionListener
- {
- public:
- /// Constructor: Initializes the weak pointer with a null pointer.
- inline WeakPtr() : pointer_(0), base_(0), callback_(0)
- {
- }
-
- /// Constructor: Used to explicitly initialize the weak pointer with a null pointer
- inline WeakPtr(int) : pointer_(0), base_(0), callback_(0)
- {
- }
-
- /// Constructor: Initializes the weak pointer with a pointer to an object.
- inline WeakPtr(T* pointer) : pointer_(pointer), base_(pointer), callback_(0)
- {
- this->registerAsDestructionListener(this->base_);
- }
-
- /// Copy-constructor
- inline WeakPtr(const WeakPtr& other) : pointer_(other.pointer_), base_(other.base_), callback_(0)
- {
- this->registerAsDestructionListener(this->base_);
- }
-
- /// Copy-constructor for weak pointers to objects of another class.
- template <class O>
- inline WeakPtr(const WeakPtr<O>& other) : pointer_(other.get()), base_(other.base_), callback_(0)
- {
- this->registerAsDestructionListener(this->base_);
- }
-
- /// Destructor
- inline virtual ~WeakPtr()
- {
- this->unregisterAsDestructionListener(this->base_);
- }
-
- /// Used to assign a null pointer.
- inline WeakPtr& operator=(int)
- {
- WeakPtr(0).swap(*this);
- return *this;
- }
-
- /// Assigns a new pointer.
- inline WeakPtr& operator=(T* pointer)
- {
- WeakPtr(pointer).swap(*this);
- return *this;
- }
-
- /// Assigns the wrapped pointer of another WeakPtr.
- inline WeakPtr& operator=(const WeakPtr& other)
- {
- WeakPtr(other).swap(*this);
- return *this;
- }
-
- /// Assigns the wrapped pointer of a WeakPtr of another class
- template <class O>
- inline WeakPtr& operator=(const WeakPtr<O>& other)
- {
- WeakPtr(other).swap(*this);
- return *this;
- }
-
- /// Returns the wrapped pointer as @c T*
- inline T* get() const
- {
- return this->pointer_;
- }
-
- /// Returns the wrapped pointer as @c OrxonoxClass*
- inline OrxonoxClass* getBase() const
- {
- return this->base_;
- }
-
- /// Implicitly converts the WeakPtr to a pointer of type @c T*
- inline operator T*() const
- {
- return this->pointer_;
- }
-
- /// Overloaded operator, returns a pointer to the stored object.
- inline T* operator->() const
- {
- assert(this->pointer_ != 0);
- return this->pointer_;
- }
-
- /// Overloaded operator, returns a reference to the stored object.
- inline T& operator*() const
- {
- assert(this->pointer_ != 0);
- return *this->pointer_;
- }
-
- /// Returns true if the wrapped pointer is NULL.
- inline bool operator!() const
- {
- return (this->pointer_ == 0);
- }
-
- /// Swaps the contents of two weak pointers.
- inline void swap(WeakPtr& other)
- {
- this->unregisterAsDestructionListener(this->base_);
- other.unregisterAsDestructionListener(other.base_);
-
- {
- T* temp = this->pointer_;
- this->pointer_ = other.pointer_;
- other.pointer_ = temp;
- }
- {
- OrxonoxClass* temp = this->base_;
- this->base_ = other.base_;
- other.base_ = temp;
- }
-
- this->registerAsDestructionListener(this->base_);
- other.registerAsDestructionListener(other.base_);
- }
-
- /// Resets the weak pointer (equivalent to assigning a NULL pointer).
- inline void reset()
- {
- WeakPtr().swap(*this);
- }
-
- /// Registers a callback that will be executed if the stored object is destroyed.
- inline void setCallback(const FunctorPtr& callback)
- {
- this->callback_ = callback;
- }
-
- /// Returns the registered callback.
- inline const FunctorPtr& getCallback() const
- {
- return this->callback_;
- }
-
- private:
- /// Will be called by OrxonoxClass::~OrxonoxClass() if the stored object is deleted. Resets the wrapped pointer and executes the callback.
- inline void objectDeleted()
- {
- this->base_ = 0;
- this->pointer_ = 0;
- if (this->callback_)
- (*this->callback_)();
- }
-
- T* pointer_; ///< The wrapped pointer to an object of type @a T
- OrxonoxClass* base_; ///< The wrapped pointer, casted up to OrxonoxClass (this is needed because with just a T* pointer, WeakPtr couln't be used with forward declarations)
- FunctorPtr callback_; ///< This callback will be executed if the stored object is deleted
- };
-
- /// Swaps the contents of two weak pointers.
- template <class T>
- void swap(WeakPtr<T>& a, WeakPtr<T>& b)
- {
- a.swap(b);
- }
-
- /// Uses a static_cast to cast a pointer of type U* to a pointer of type T* and returns it in a new WeakPtr<T>.
- template <class T, class U>
- WeakPtr<T> static_pointer_cast(const WeakPtr<U>& p)
- {
- return static_cast<T*>(p.get());
- }
-
- /// Uses a const_cast to cast a pointer of type U* to a pointer of type T* and returns it in a new WeakPtr<T>.
- template <class T, class U>
- WeakPtr<T> const_pointer_cast(const WeakPtr<U>& p)
- {
- return const_cast<T*>(p.get());
- }
-
- /// Uses a dynamic_cast to cast a pointer of type U* to a pointer of type T* and returns it in a new WeakPtr<T>.
- template <class T, class U>
- WeakPtr<T> dynamic_pointer_cast(const WeakPtr<U>& p)
- {
- return orxonox_cast<T*>(p.get());
- }
-}
-
-#endif /* _WeakPtr_H__ */
Modified: code/trunk/src/libraries/core/WindowEventListener.cc
===================================================================
--- code/trunk/src/libraries/core/WindowEventListener.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/WindowEventListener.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,9 +34,11 @@
unsigned int WindowEventListener::windowWidth_s = 0;
unsigned int WindowEventListener::windowHeight_s = 0;
+ RegisterAbstractClass(WindowEventListener).inheritsFrom(Class(Listable));
+
WindowEventListener::WindowEventListener()
{
- RegisterRootObject(WindowEventListener);
+ RegisterObject(WindowEventListener);
}
//! Calls all registered objects
Modified: code/trunk/src/libraries/core/WindowEventListener.h
===================================================================
--- code/trunk/src/libraries/core/WindowEventListener.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/WindowEventListener.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,12 +35,12 @@
#define _WindowEventListener_H__
#include "CorePrereqs.h"
-#include "OrxonoxClass.h"
+#include "object/Listable.h"
namespace orxonox
{
//! Interface for receiving window events like resize, moved and focusChanged
- class _CoreExport WindowEventListener : virtual public OrxonoxClass
+ class _CoreExport WindowEventListener : virtual public Listable
{
friend class OgreWindowEventListener;
Modified: code/trunk/src/libraries/core/XMLNameListener.cc
===================================================================
--- code/trunk/src/libraries/core/XMLNameListener.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/XMLNameListener.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -31,8 +31,10 @@
namespace orxonox
{
+ RegisterAbstractClass(XMLNameListener).inheritsFrom(Class(Listable));
+
XMLNameListener::XMLNameListener()
{
- RegisterRootObject(XMLNameListener);
+ RegisterObject(XMLNameListener);
}
}
Modified: code/trunk/src/libraries/core/XMLNameListener.h
===================================================================
--- code/trunk/src/libraries/core/XMLNameListener.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/XMLNameListener.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,11 +35,11 @@
#define _XMLNameListener_H__
#include "CorePrereqs.h"
-#include "OrxonoxClass.h"
+#include "object/Listable.h"
namespace orxonox
{
- class _CoreExport XMLNameListener : virtual public OrxonoxClass
+ class _CoreExport XMLNameListener : virtual public Listable
{
public:
XMLNameListener();
Modified: code/trunk/src/libraries/core/XMLPort.cc
===================================================================
--- code/trunk/src/libraries/core/XMLPort.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/XMLPort.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -28,6 +28,7 @@
#include "XMLPort.h"
+#include "CoreIncludes.h"
#include "Loader.h"
#include "Namespace.h"
@@ -58,7 +59,7 @@
for (ticpp::Iterator<ticpp::Element> child = xmlsubelement->FirstChildElement(false); child != child.end(); child++)
{
- Identifier* identifier = Identifier::getIdentifierByString(child->Value());
+ Identifier* identifier = ClassByString(child->Value());
if (!identifier)
{
if (!this->sectionname_.empty())
@@ -88,7 +89,7 @@
{
orxout(verbose, context::xml) << object->getLoaderIndentation() << "fabricating " << child->Value() << "..." << endl;
- BaseObject* newObject = identifier->fabricate(object);
+ BaseObject* newObject = orxonox_cast<BaseObject*>(identifier->fabricate(object->getContext()));
newObject->setLoaderIndentation(object->getLoaderIndentation() + " ");
if (this->bLoadBefore_)
Modified: code/trunk/src/libraries/core/XMLPort.h
===================================================================
--- code/trunk/src/libraries/core/XMLPort.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/XMLPort.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -57,7 +57,7 @@
#include "util/MultiType.h"
#include "util/OrxAssert.h"
#include "util/StringUtils.h"
-#include "Identifier.h"
+#include "class/Identifier.h"
#include "BaseObject.h"
#include "command/Executor.h"
Modified: code/trunk/src/libraries/core/class/CMakeLists.txt
===================================================================
--- code/branches/core6/src/libraries/core/class/CMakeLists.txt 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/class/CMakeLists.txt 2013-08-25 19:08:42 UTC (rev 9667)
@@ -2,4 +2,6 @@
Identifiable.cc
Identifier.cc
IdentifierManager.cc
+ OrxonoxClass.cc
+ OrxonoxInterface.cc
)
Modified: code/trunk/src/libraries/core/class/Identifiable.cc
===================================================================
--- code/branches/core6/src/libraries/core/class/Identifiable.cc 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/class/Identifiable.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,30 +34,23 @@
#include "Identifiable.h"
#include <cassert>
+#include "core/CoreIncludes.h"
#include "core/object/Context.h"
#include "Identifier.h"
namespace orxonox
{
+ RegisterClassNoArgs(Identifiable);
+
/**
@brief Constructor: Sets the default values.
*/
Identifiable::Identifiable()
{
this->identifier_ = 0;
- this->parents_ = 0;
- // Optimisation
- this->objectPointers_.reserve(6);
- }
+ this->objectPointers_.reserve(6); // Optimisation
- /**
- @brief Destructor: Removes the object from the object-lists
- */
- Identifiable::~Identifiable()
- {
- // parents_ exists only if isCreatingHierarchy() of the associated Identifier returned true while creating the class
- if (this->parents_)
- delete this->parents_;
+ RegisterObject(Identifiable);
}
/// Returns true if the object's class is of the given type or a derivative.
Modified: code/trunk/src/libraries/core/class/Identifiable.h
===================================================================
--- code/branches/core6/src/libraries/core/class/Identifiable.h 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/class/Identifiable.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -54,7 +54,7 @@
public:
Identifiable();
- virtual ~Identifiable();
+ virtual ~Identifiable() {}
/// Returns the Identifier of the object.
inline Identifier* getIdentifier() const { return this->identifier_; }
@@ -118,7 +118,6 @@
private:
Identifier* identifier_; //!< The Identifier of the object
- std::set<const Identifier*>* parents_; //!< List of all parents of the object
/// 'Fast map' that holds this-pointers of all derived types
std::vector<std::pair<unsigned int, void*> > objectPointers_;
Modified: code/trunk/src/libraries/core/class/Identifier.cc
===================================================================
--- code/branches/core6/src/libraries/core/class/Identifier.cc 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/class/Identifier.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,6 +36,7 @@
#include <ostream>
#include "util/StringUtils.h"
+#include "core/CoreIncludes.h"
#include "core/config/ConfigValueContainer.h"
#include "core/XMLPort.h"
#include "core/object/ClassFactory.h"
@@ -49,13 +50,10 @@
@brief Constructor: No factory, no object created, new ObjectList and a unique networkID.
*/
Identifier::Identifier()
- : classID_(IdentifierManager::classIDCounter_s++)
+ : classID_(IdentifierManager::getInstance().getUniqueClassId())
{
- this->objects_ = new ObjectListBase();
-
- this->bCreatedOneObject_ = false;
- this->bSetName_ = false;
this->factory_ = 0;
+ this->bInitialized_ = false;
this->bLoadable_ = false;
this->bHasConfigValues_ = false;
@@ -69,8 +67,6 @@
*/
Identifier::~Identifier()
{
- delete this->objects_;
-
if (this->factory_)
delete this->factory_;
@@ -83,96 +79,35 @@
}
/**
- @brief Registers a class, which means that the name and the parents get stored.
- @param parents A list, containing the Identifiers of all parents of the class
- @param bRootClass True if the class is either an Interface or the BaseObject itself
+ @brief Sets the name of the class.
*/
- void Identifier::initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass)
+ void Identifier::setName(const std::string& name)
{
- // Check if at least one object of the given type was created
- if (!this->bCreatedOneObject_ && IdentifierManager::isCreatingHierarchy())
+ if (name != this->name_)
{
- // If no: We have to store the information and initialize the Identifier
- orxout(verbose, context::identifier) << "Register Class in ClassIdentifier<" << this->getName() << ">-Singleton -> Initialize Singleton." << endl;
- if (bRootClass)
- this->initialize(0); // If a class is derived from two interfaces, the second interface might think it's derived from the first because of the order of constructor-calls. Thats why we set parents to zero in that case.
- else
- this->initialize(parents);
+ this->name_ = name;
+ IdentifierManager::getInstance().addIdentifierToLookupMaps(this);
}
}
- /**
- @brief Initializes the Identifier with a list containing all parents of the class the Identifier belongs to.
- @param parents A list containing all parents
- */
- void Identifier::initialize(std::set<const Identifier*>* parents)
+ void Identifier::setFactory(Factory* factory)
{
- orxout(verbose, context::identifier) << "Initialize ClassIdentifier<" << this->name_ << ">-Singleton." << endl;
- this->bCreatedOneObject_ = true;
+ if (this->factory_)
+ delete this->factory_;
- if (parents)
- {
- this->parents_ = (*parents);
- this->directParents_ = (*parents);
-
- // Iterate through all parents
- for (std::set<const Identifier*>::iterator it = parents->begin(); it != parents->end(); ++it)
- {
- // Tell the parent we're one of it's children
- (*it)->children_.insert((*it)->children_.end(), this);
-
- // Erase all parents of our parent from our direct-parent-list
- for (std::set<const Identifier*>::const_iterator it1 = (*it)->getParents().begin(); it1 != (*it)->getParents().end(); ++it1)
- {
- // Search for the parent's parent in our direct-parent-list
- for (std::set<const Identifier*>::iterator it2 = this->directParents_.begin(); it2 != this->directParents_.end(); ++it2)
- {
- if ((*it1) == (*it2))
- {
- // We've found a non-direct parent in our list: Erase it
- this->directParents_.erase(it2);
- break;
- }
- }
- }
- }
-
- // Now iterate through all direct parents
- for (std::set<const Identifier*>::iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it)
- {
- // Tell the parent we're one of it's direct children
- (*it)->directChildren_.insert((*it)->directChildren_.end(), this);
-
- // Create the super-function dependencies
- (*it)->createSuperFunctionCaller();
- }
- }
+ this->factory_ = factory;
}
- /**
- @brief Sets the name of the class.
- */
- void Identifier::setName(const std::string& name)
- {
- if (!this->bSetName_)
- {
- this->name_ = name;
- this->bSetName_ = true;
- IdentifierManager::getStringIdentifierMapIntern()[name] = this;
- IdentifierManager::getLowercaseStringIdentifierMapIntern()[getLowercase(name)] = this;
- IdentifierManager::getIDIdentifierMapIntern()[this->networkID_] = this;
- }
- }
/**
@brief Creates an object of the type the Identifier belongs to.
@return The new object
*/
- OrxonoxClass* Identifier::fabricate(BaseObject* creator)
+ Identifiable* Identifier::fabricate(Context* context)
{
if (this->factory_)
{
- return this->factory_->fabricate(creator);
+ return this->factory_->fabricate(context);
}
else
{
@@ -189,12 +124,109 @@
*/
void Identifier::setNetworkID(uint32_t id)
{
-// Identifier::getIDIdentifierMapIntern().erase(this->networkID_);
- IdentifierManager::getIDIdentifierMapIntern()[id] = this;
this->networkID_ = id;
+ IdentifierManager::getInstance().addIdentifierToLookupMaps(this);
}
/**
+ * @brief Used to define the direct parents of an Identifier of an abstract class.
+ */
+ Identifier& Identifier::inheritsFrom(Identifier* directParent)
+ {
+ if (this->parents_.empty())
+ this->directParents_.insert(directParent);
+ else
+ orxout(internal_error) << "Trying to add " << directParent->getName() << " as a direct parent of " << this->getName() << " after the latter was already initialized" << endl;
+
+ return *this;
+ }
+
+ /**
+ * @brief Initializes the parents of this Identifier while creating the class hierarchy.
+ * @param identifiers All identifiers that were used to create an instance of this class (including this identifier itself)
+ */
+ void Identifier::initializeParents(const std::set<const Identifier*>& identifiers)
+ {
+ if (!IdentifierManager::getInstance().isCreatingHierarchy())
+ {
+ orxout(internal_warning) << "Identifier::initializeParents() created outside of class hierarchy creation" << endl;
+ return;
+ }
+
+ for (std::set<const Identifier*>::const_iterator it = identifiers.begin(); it != identifiers.end(); ++it)
+ if (*it != this)
+ this->parents_.insert(*it);
+ }
+
+ /**
+ * @brief Initializes the direct parents of this Identifier while creating the class hierarchy. This is only intended for abstract classes.
+ */
+ void Identifier::initializeDirectParentsOfAbstractClass()
+ {
+ if (!IdentifierManager::getInstance().isCreatingHierarchy())
+ {
+ orxout(internal_warning) << "Identifier::initializeDirectParentsOfAbstractClass() created outside of class hierarchy creation" << endl;
+ return;
+ }
+
+ // only Identifiable is allowed to have no parents (even tough it's currently not abstract)
+ if (this->directParents_.empty() && !this->isExactlyA(Class(Identifiable)))
+ {
+ orxout(internal_error) << "Identifier " << this->getName() << " / " << this->getTypeidName() << " is marked as abstract but has no direct parents defined" << endl;
+ orxout(internal_error) << " If this class is not abstract, use RegisterClass(ThisClass);" << endl;
+ orxout(internal_error) << " If this class is abstract, use RegisterAbstractClass(ThisClass).inheritsFrom(Class(BaseClass));" << endl;
+ }
+ }
+
+ /**
+ * @brief Finishes the initialization of this Identifier after creating the class hierarchy by wiring the (direct) parent/child references correctly.
+ */
+ void Identifier::finishInitialization()
+ {
+ if (!IdentifierManager::getInstance().isCreatingHierarchy())
+ {
+ orxout(internal_warning) << "Identifier::finishInitialization() created outside of class hierarchy creation" << endl;
+ return;
+ }
+
+ if (this->isInitialized())
+ return;
+
+ // if no direct parents were defined, initialize them with the set of all parents
+ if (this->directParents_.empty())
+ this->directParents_ = this->parents_;
+
+ // initialize all parents before continuing to initialize this identifier
+ for (std::set<const Identifier*>::const_iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it)
+ {
+ Identifier* directParent = const_cast<Identifier*>(*it);
+ directParent->finishInitialization(); // initialize parent
+ this->parents_.insert(directParent); // direct parent is also a parent
+ this->parents_.insert(directParent->parents_.begin(), directParent->parents_.end()); // parents of direct parent are also parents
+ }
+
+ // parents of parents are no direct parents of this identifier
+ for (std::set<const Identifier*>::const_iterator it_parent = this->parents_.begin(); it_parent != this->parents_.end(); ++it_parent)
+ for (std::set<const Identifier*>::const_iterator it_parent_parent = const_cast<Identifier*>(*it_parent)->parents_.begin(); it_parent_parent != const_cast<Identifier*>(*it_parent)->parents_.end(); ++it_parent_parent)
+ this->directParents_.erase(*it_parent_parent);
+
+ // tell all parents that this identifier is a child
+ for (std::set<const Identifier*>::const_iterator it = this->parents_.begin(); it != this->parents_.end(); ++it)
+ const_cast<Identifier*>(*it)->children_.insert(this);
+
+ // tell all direct parents that this identifier is a direct child
+ for (std::set<const Identifier*>::const_iterator it = this->directParents_.begin(); it != this->directParents_.end(); ++it)
+ {
+ const_cast<Identifier*>(*it)->directChildren_.insert(this);
+
+ // Create the super-function dependencies
+ (*it)->createSuperFunctionCaller();
+ }
+
+ this->bInitialized_ = true;
+ }
+
+ /**
@brief Returns true, if the Identifier is at least of the given type.
@param identifier The identifier to compare with
*/
Modified: code/trunk/src/libraries/core/class/Identifier.h
===================================================================
--- code/branches/core6/src/libraries/core/class/Identifier.h 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/class/Identifier.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -55,17 +55,9 @@
object->getIdentifier()->getName(); // returns "MyClass"
- OrxonoxClass* other = object->getIdentifier()->fabricate(0); // fabricates a new instance of MyClass
+ Identifiable* other = object->getIdentifier()->fabricate(0); // fabricates a new instance of MyClass
- // iterate through all objects of type MyClass:
- ObjectListBase* objects = object->getIdentifier()->getObjects(); // get a pointer to the object-list
- int count;
- for (Iterator<MyClass> it = objects.begin(); it != objects.end(); ++it) // iterate through the objects
- ++count;
- orxout() << count << endl; // prints "2" because we created 2 instances of MyClass so far
-
-
// test the class hierarchy
object->getIdentifier()->isA(Class(MyClass)); // returns true
object->isA(Class(MyClass)); // returns true (short version)
@@ -89,9 +81,11 @@
#include <loki/TypeTraits.h>
#include "util/Output.h"
-#include "core/object/MetaObjectList.h"
#include "core/object/ObjectList.h"
-#include "core/object/ObjectListBase.h"
+#include "core/object/Listable.h"
+#include "core/object/Context.h"
+#include "core/object/Destroyable.h"
+#include "core/object/WeakPtr.h"
#include "IdentifierManager.h"
#include "Super.h"
@@ -111,15 +105,20 @@
@note You can't directly create an Identifier, it's just the base-class of ClassIdentifier<T>.
*/
- class _CoreExport Identifier
+ class _CoreExport Identifier : public Destroyable
{
- friend class IdentifierManager;
-
public:
+ Identifier();
+ Identifier(const Identifier& identifier); // don't copy
+ virtual ~Identifier();
+
/// Returns the name of the class the Identifier belongs to.
inline const std::string& getName() const { return this->name_; }
void setName(const std::string& name);
+ /// Returns the name of the class as it is returned by typeid(T).name()
+ virtual const std::string& getTypeidName() = 0;
+
/// Returns the network ID to identify a class through the network.
inline uint32_t getNetworkID() const { return this->networkID_; }
void setNetworkID(uint32_t id);
@@ -127,21 +126,31 @@
/// Returns the unique ID of the class.
ORX_FORCEINLINE unsigned int getClassID() const { return this->classID_; }
- /// Returns the list of all existing objects of this class.
- inline ObjectListBase* getObjects() const { return this->objects_; }
-
/// Sets the Factory.
- inline void addFactory(Factory* factory) { this->factory_ = factory; }
+ void setFactory(Factory* factory);
/// Returns true if the Identifier has a Factory.
inline bool hasFactory() const { return (this->factory_ != 0); }
- OrxonoxClass* fabricate(BaseObject* creator);
+ Identifiable* fabricate(Context* context);
/// Returns true if the class can be loaded through XML.
inline bool isLoadable() const { return this->bLoadable_; }
/// Set the class to be loadable through XML or not.
inline void setLoadable(bool bLoadable) { this->bLoadable_ = bLoadable; }
+ /// Returns true if the Identifier was completely initialized.
+ inline bool isInitialized() const { return this->bInitialized_; }
+
+
+ /////////////////////////////
+ ////// Class Hierarchy //////
+ /////////////////////////////
+ Identifier& inheritsFrom(Identifier* directParent);
+
+ void initializeParents(const std::set<const Identifier*>& identifiers);
+ void initializeDirectParentsOfAbstractClass();
+ void finishInitialization();
+
bool isA(const Identifier* identifier) const;
bool isExactlyA(const Identifier* identifier) const;
bool isChildOf(const Identifier* identifier) const;
@@ -149,10 +158,6 @@
bool isParentOf(const Identifier* identifier) const;
bool isDirectParentOf(const Identifier* identifier) const;
-
- /////////////////////////////
- ////// Class Hierarchy //////
- /////////////////////////////
/// Returns the parents of the class the Identifier belongs to.
inline const std::set<const Identifier*>& getParents() const { return this->parents_; }
/// Returns the begin-iterator of the parents-list.
@@ -219,32 +224,16 @@
protected:
- Identifier();
- Identifier(const Identifier& identifier); // don't copy
- virtual ~Identifier();
-
virtual void createSuperFunctionCaller() const = 0;
- void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass);
-
- /// Returns the children of the class the Identifier belongs to.
- inline std::set<const Identifier*>& getChildrenIntern() const { return this->children_; }
- /// Returns the direct children of the class the Identifier belongs to.
- inline std::set<const Identifier*>& getDirectChildrenIntern() const { return this->directChildren_; }
-
- ObjectListBase* objects_; //!< The list of all objects of this class
-
private:
- void initialize(std::set<const Identifier*>* parents);
-
std::set<const Identifier*> parents_; //!< The parents of the class the Identifier belongs to
- mutable std::set<const Identifier*> children_; //!< The children of the class the Identifier belongs to
+ std::set<const Identifier*> children_; //!< The children of the class the Identifier belongs to
std::set<const Identifier*> directParents_; //!< The direct parents of the class the Identifier belongs to
- mutable std::set<const Identifier*> directChildren_; //!< The direct children of the class the Identifier belongs to
+ std::set<const Identifier*> directChildren_; //!< The direct children of the class the Identifier belongs to
- bool bCreatedOneObject_; //!< True if at least one object of the given type was created (used to determine the need of storing the parents)
- bool bSetName_; //!< True if the name is set
+ bool bInitialized_; //!< Is true if the Identifier was completely initialized
bool bLoadable_; //!< False = it's not permitted to load the object through XML
std::string name_; //!< The name of the class the Identifier belongs to
Factory* factory_; //!< The Factory, able to create new objects of the given class (if available)
@@ -286,7 +275,7 @@
static ClassIdentifier<T>* getIdentifier();
static ClassIdentifier<T>* getIdentifier(const std::string& name);
- bool initialiseObject(T* object, const std::string& className, bool bRootClass);
+ bool initializeObject(T* object);
void setConfigValues(T* object, Configurable*) const;
void setConfigValues(T* object, Identifiable*) const;
@@ -294,13 +283,18 @@
void addObjectToList(T* object, Listable*);
void addObjectToList(T* object, Identifiable*);
- void updateConfigValues(bool updateChildren = true) const;
+ virtual void updateConfigValues(bool updateChildren = true) const;
+ virtual const std::string& getTypeidName()
+ { return this->typeidName_; }
+
private:
- static void initialiseIdentifier();
+ static void initializeIdentifier();
+
ClassIdentifier(const ClassIdentifier<T>& identifier) {} // don't copy
ClassIdentifier()
{
+ this->typeidName_ = typeid(T).name();
SuperFunctionInitialization<0, T>::initialize(this);
}
~ClassIdentifier()
@@ -308,11 +302,15 @@
SuperFunctionDestruction<0, T>::destroy(this);
}
- static ClassIdentifier<T>* classIdentifier_s;
+ void updateConfigValues(bool updateChildren, Listable*) const;
+ void updateConfigValues(bool updateChildren, Identifiable*) const;
+
+ std::string typeidName_;
+ static WeakPtr<ClassIdentifier<T> > classIdentifier_s;
};
template <class T>
- ClassIdentifier<T>* ClassIdentifier<T>::classIdentifier_s = 0;
+ WeakPtr<ClassIdentifier<T> > ClassIdentifier<T>::classIdentifier_s;
/**
@brief Returns the only instance of this class.
@@ -323,7 +321,7 @@
{
// check if the Identifier already exists
if (!ClassIdentifier<T>::classIdentifier_s)
- ClassIdentifier<T>::initialiseIdentifier();
+ ClassIdentifier<T>::initializeIdentifier();
return ClassIdentifier<T>::classIdentifier_s;
}
@@ -345,53 +343,37 @@
@brief Assigns the static field for the identifier singleton.
*/
template <class T>
- void ClassIdentifier<T>::initialiseIdentifier()
+ /*static */ void ClassIdentifier<T>::initializeIdentifier()
{
- // Get the name of the class
- std::string name = typeid(T).name();
-
- // create a new identifier anyway. Will be deleted in Identifier::getIdentifier if not used.
+ // create a new identifier anyway. Will be deleted if not used.
ClassIdentifier<T>* proposal = new ClassIdentifier<T>();
// Get the entry from the map
- ClassIdentifier<T>::classIdentifier_s = (ClassIdentifier<T>*)IdentifierManager::getIdentifierSingleton(name, proposal);
+ ClassIdentifier<T>::classIdentifier_s = (ClassIdentifier<T>*)IdentifierManager::getInstance().getGloballyUniqueIdentifier(proposal);
if (ClassIdentifier<T>::classIdentifier_s == proposal)
- {
- orxout(verbose, context::identifier) << "Requested Identifier for " << name << " was not yet existing and got created." << endl;
- }
+ orxout(verbose, context::identifier) << "Requested Identifier for " << proposal->getTypeidName() << " was not yet existing and got created." << endl;
else
{
- orxout(verbose, context::identifier) << "Requested Identifier for " << name << " was already existing and got assigned." << endl;
+ orxout(verbose, context::identifier) << "Requested Identifier for " << proposal->getTypeidName() << " was already existing and got assigned." << endl;
+ delete proposal; // delete proposal (it is not used anymore)
}
}
/**
@brief Adds an object of the given type to the ObjectList.
@param object The object to add
- @param className The name of the class T
- @param bRootClass True if this is a root class (i.e. it inherits directly from OrxonoxClass)
*/
template <class T>
- bool ClassIdentifier<T>::initialiseObject(T* object, const std::string& className, bool bRootClass)
+ bool ClassIdentifier<T>::initializeObject(T* object)
{
- if (bRootClass)
- orxout(verbose, context::object_list) << "Register Root-Object: " << className << endl;
- else
- orxout(verbose, context::object_list) << "Register Object: " << className << endl;
+ orxout(verbose, context::object_list) << "Register Object: " << this->getName() << endl;
object->identifier_ = this;
- if (IdentifierManager::isCreatingHierarchy())
+ if (IdentifierManager::getInstance().isCreatingHierarchy())
{
- if (bRootClass && !object->parents_)
- object->parents_ = new std::set<const Identifier*>();
+ IdentifierManager::getInstance().createdObject(object);
- if (object->parents_)
- {
- this->initializeClassHierarchy(object->parents_, bRootClass);
- object->parents_->insert(object->parents_->end(), this);
- }
-
this->setConfigValues(object, object);
return true;
}
@@ -424,10 +406,10 @@
* @brief Only adds the object to the object list if is a @ref Listable
*/
template <class T>
- void ClassIdentifier<T>::addObjectToList(T* object, Listable*)
+ void ClassIdentifier<T>::addObjectToList(T* object, Listable* listable)
{
- orxout(verbose, context::object_list) << "Added object to " << this->getName() << "-list." << endl;
- object->metaList_->add(this->objects_, this->objects_->add(object));
+ if (listable->getContext())
+ listable->getContext()->addObject(object);
}
template <class T>
@@ -442,6 +424,12 @@
template <class T>
void ClassIdentifier<T>::updateConfigValues(bool updateChildren) const
{
+ this->updateConfigValues(updateChildren, static_cast<T*>(NULL));
+ }
+
+ template <class T>
+ void ClassIdentifier<T>::updateConfigValues(bool updateChildren, Listable*) const
+ {
if (!this->hasConfigValues())
return;
@@ -453,7 +441,13 @@
(*it)->updateConfigValues(false);
}
+ template <class T>
+ void ClassIdentifier<T>::updateConfigValues(bool updateChildren, Identifiable*) const
+ {
+ // no action
+ }
+
// ###############################
// ### orxonox_cast ###
// ###############################
Modified: code/trunk/src/libraries/core/class/IdentifierManager.cc
===================================================================
--- code/branches/core6/src/libraries/core/class/IdentifierManager.cc 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/class/IdentifierManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,65 +36,116 @@
#include <ostream>
#include "util/StringUtils.h"
+#include "core/CoreIncludes.h"
#include "core/config/ConfigValueContainer.h"
#include "core/XMLPort.h"
#include "core/object/ClassFactory.h"
namespace orxonox
{
- int IdentifierManager::hierarchyCreatingCounter_s = 0;
- unsigned int IdentifierManager::classIDCounter_s = 0;
+ /* static */ IdentifierManager& IdentifierManager::getInstance()
+ {
+ static IdentifierManager instance;
+ return instance;
+ }
- /**
- @brief Returns the identifier map with the names as received by typeid(). This is only used internally.
- */
- std::map<std::string, Identifier*>& IdentifierManager::getTypeIDIdentifierMap()
+ IdentifierManager::IdentifierManager()
{
- static std::map<std::string, Identifier*> identifiers; //!< The map to store all Identifiers.
- return identifiers;
+ this->hierarchyCreatingCounter_s = 0;
+ this->classIDCounter_s = 0;
}
/**
@brief Returns an identifier by name and adds it if not available
- @param name The name of the identifier as typeid().name() suggests
@param proposal A pointer to a newly created identifier for the case of non existence in the map
@return The identifier (unique instance)
*/
- Identifier* IdentifierManager::getIdentifierSingleton(const std::string& name, Identifier* proposal)
+ Identifier* IdentifierManager::getGloballyUniqueIdentifier(Identifier* proposal)
{
- std::map<std::string, Identifier*>::const_iterator it = getTypeIDIdentifierMap().find(name);
+ const std::string& typeidName = proposal->getTypeidName();
+ std::map<std::string, Identifier*>::const_iterator it = this->identifierByTypeidName_.find(typeidName);
- if (it != getTypeIDIdentifierMap().end())
+ if (it != this->identifierByTypeidName_.end())
{
- // There is already an entry: return it and delete the proposal
- delete proposal;
+ // There is already an entry: return it
return it->second;
}
else
{
// There is no entry: put the proposal into the map and return it
- getTypeIDIdentifierMap()[name] = proposal;
+ this->identifierByTypeidName_[typeidName] = proposal;
return proposal;
}
}
/**
+ * Registers the identifier in all maps of the IdentifierManager.
+ */
+ void IdentifierManager::addIdentifierToLookupMaps(Identifier* identifier)
+ {
+ const std::string& typeidName = identifier->getTypeidName();
+ if (this->identifierByTypeidName_.find(typeidName) != this->identifierByTypeidName_.end())
+ {
+ this->identifierByString_[identifier->getName()] = identifier;
+ this->identifierByLowercaseString_[getLowercase(identifier->getName())] = identifier;
+ this->identifierByNetworkId_[identifier->getNetworkID()] = identifier;
+ }
+ else
+ orxout(internal_warning) << "Trying to add an identifier to lookup maps which is not known to IdentifierManager" << endl;
+ }
+
+ /**
@brief Creates the class-hierarchy by creating and destroying one object of each type.
*/
void IdentifierManager::createClassHierarchy()
{
orxout(internal_status) << "Create class-hierarchy" << endl;
- IdentifierManager::startCreatingHierarchy();
- for (std::map<std::string, Identifier*>::const_iterator it = IdentifierManager::getStringIdentifierMap().begin(); it != IdentifierManager::getStringIdentifierMap().end(); ++it)
+ this->startCreatingHierarchy();
+
+ std::set<Identifier*> initializedIdentifiers;
+
+ // ensure root context exists before starting to create objects. if the root context is dynamically created while creating the class hierarchy, we
+ // would mistakenly assume the class of the currently created object inherits from Context
+ Context::getRootContext();
+
+ // iterate over all identifiers, create one instance of each class and initialize the identifiers
{
- // To create the new branch of the class-hierarchy, we create a new object and delete it afterwards.
- if (it->second->hasFactory())
+ Context temporaryContext(NULL);
+ for (std::map<std::string, Identifier*>::const_iterator it = this->identifierByTypeidName_.begin(); it != this->identifierByTypeidName_.end(); ++it)
{
- OrxonoxClass* temp = it->second->fabricate(0);
- temp->destroy();
+ orxout(verbose, context::identifier) << "Initialize ClassIdentifier<" << it->second->getName() << ">-Singleton." << endl;
+ // To initialize the identifier, we create a new object and delete it afterwards.
+ if (it->second->hasFactory())
+ {
+ this->identifiersOfNewObject_.clear();
+ Identifiable* temp = it->second->fabricate(&temporaryContext);
+ if (temp->getIdentifier() != it->second)
+ orxout(internal_error) << "Newly created object of type " << it->second->getName() << " has unexpected identifier. Did you forget to use RegisterObject(classname)?" << endl;
+ delete temp;
+
+ it->second->initializeParents(this->identifiersOfNewObject_);
+ }
+ else
+ it->second->initializeDirectParentsOfAbstractClass();
+
+ initializedIdentifiers.insert(it->second);
}
+
+ size_t numberOfObjects = temporaryContext.getObjectList<Listable>()->size();
+ if (numberOfObjects > 0)
+ orxout(internal_warning) << "There are still " << numberOfObjects << " listables left after creating the class hierarchy" << endl;
}
- IdentifierManager::stopCreatingHierarchy();
+
+ // finish the initialization of all identifiers
+ for (std::map<std::string, Identifier*>::const_iterator it = this->identifierByTypeidName_.begin(); it != this->identifierByTypeidName_.end(); ++it)
+ {
+ if (initializedIdentifiers.find(it->second) != initializedIdentifiers.end())
+ it->second->finishInitialization();
+ else
+ orxout(internal_error) << "Identifier was registered late and is not initialized: " << it->second->getName() << " / " << it->second->getTypeidName() << endl;
+ }
+
+ this->stopCreatingHierarchy();
orxout(internal_status) << "Finished class-hierarchy creation" << endl;
}
@@ -103,49 +154,35 @@
*/
void IdentifierManager::destroyAllIdentifiers()
{
- for (std::map<std::string, Identifier*>::iterator it = IdentifierManager::getTypeIDIdentifierMap().begin(); it != IdentifierManager::getTypeIDIdentifierMap().end(); ++it)
+ for (std::map<std::string, Identifier*>::iterator it = this->identifierByTypeidName_.begin(); it != this->identifierByTypeidName_.end(); ++it)
delete (it->second);
- }
- /**
- @brief Returns the map that stores all Identifiers with their names.
- @return The map
- */
- std::map<std::string, Identifier*>& IdentifierManager::getStringIdentifierMapIntern()
- {
- static std::map<std::string, Identifier*> identifierMap;
- return identifierMap;
+ this->identifierByTypeidName_.clear();
+ this->identifierByString_.clear();
+ this->identifierByLowercaseString_.clear();
+ this->identifierByNetworkId_.clear();
}
/**
- @brief Returns the map that stores all Identifiers with their names in lowercase.
- @return The map
- */
- std::map<std::string, Identifier*>& IdentifierManager::getLowercaseStringIdentifierMapIntern()
+ * @brief Notifies the IdentifierManager about a newly created object while creating the class hierarchy.
+ */
+ void IdentifierManager::createdObject(Identifiable* identifiable)
{
- static std::map<std::string, Identifier*> lowercaseIdentifierMap;
- return lowercaseIdentifierMap;
+ if (this->isCreatingHierarchy())
+ this->identifiersOfNewObject_.insert(identifiable->getIdentifier());
+ else
+ orxout(internal_warning) << "createdObject() called outside of class hierarchy creation" << endl;
}
/**
- @brief Returns the map that stores all Identifiers with their network IDs.
- @return The map
- */
- std::map<uint32_t, Identifier*>& IdentifierManager::getIDIdentifierMapIntern()
- {
- static std::map<uint32_t, Identifier*> identifierMap;
- return identifierMap;
- }
-
- /**
@brief Returns the Identifier with a given name.
@param name The name of the wanted Identifier
@return The Identifier
*/
Identifier* IdentifierManager::getIdentifierByString(const std::string& name)
{
- std::map<std::string, Identifier*>::const_iterator it = IdentifierManager::getStringIdentifierMapIntern().find(name);
- if (it != IdentifierManager::getStringIdentifierMapIntern().end())
+ std::map<std::string, Identifier*>::const_iterator it = this->identifierByString_.find(name);
+ if (it != this->identifierByString_.end())
return it->second;
else
return 0;
@@ -158,8 +195,8 @@
*/
Identifier* IdentifierManager::getIdentifierByLowercaseString(const std::string& name)
{
- std::map<std::string, Identifier*>::const_iterator it = IdentifierManager::getLowercaseStringIdentifierMapIntern().find(name);
- if (it != IdentifierManager::getLowercaseStringIdentifierMapIntern().end())
+ std::map<std::string, Identifier*>::const_iterator it = this->identifierByLowercaseString_.find(name);
+ if (it != this->identifierByLowercaseString_.end())
return it->second;
else
return 0;
@@ -172,8 +209,8 @@
*/
Identifier* IdentifierManager::getIdentifierByID(const uint32_t id)
{
- std::map<uint32_t, Identifier*>::const_iterator it = IdentifierManager::getIDIdentifierMapIntern().find(id);
- if (it != IdentifierManager::getIDIdentifierMapIntern().end())
+ std::map<uint32_t, Identifier*>::const_iterator it = this->identifierByNetworkId_.find(id);
+ if (it != this->identifierByNetworkId_.end())
return it->second;
else
return 0;
@@ -184,6 +221,6 @@
*/
void IdentifierManager::clearNetworkIDs()
{
- IdentifierManager::getIDIdentifierMapIntern().clear();
+ this->identifierByNetworkId_.clear();
}
}
Modified: code/trunk/src/libraries/core/class/IdentifierManager.h
===================================================================
--- code/branches/core6/src/libraries/core/class/IdentifierManager.h 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/class/IdentifierManager.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,89 +37,76 @@
#include "core/CorePrereqs.h"
#include <map>
+#include <set>
#include <string>
namespace orxonox
{
class _CoreExport IdentifierManager
{
- friend class Identifier;
- template <class T> friend class ClassIdentifier;
-
public:
+ static IdentifierManager& getInstance();
+
+ Identifier* getGloballyUniqueIdentifier(Identifier* proposal);
+ void addIdentifierToLookupMaps(Identifier* identifier);
+
+ unsigned int getUniqueClassId()
+ { return this->classIDCounter_s++; }
+
+
/////////////////////////////
////// Class Hierarchy //////
/////////////////////////////
- static void createClassHierarchy();
+ void createClassHierarchy();
+ void destroyAllIdentifiers();
+ void createdObject(Identifiable* identifiable);
+
/// Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents.
- inline static bool isCreatingHierarchy()
+ inline bool isCreatingHierarchy()
{ return (hierarchyCreatingCounter_s > 0); }
//////////////////////////
///// Identifier Map /////
//////////////////////////
- static void destroyAllIdentifiers();
+ Identifier* getIdentifierByString(const std::string& name);
+ Identifier* getIdentifierByLowercaseString(const std::string& name);
+ Identifier* getIdentifierByID(uint32_t id);
- static Identifier* getIdentifierByString(const std::string& name);
- static Identifier* getIdentifierByLowercaseString(const std::string& name);
- static Identifier* getIdentifierByID(uint32_t id);
+ void clearNetworkIDs();
- static void clearNetworkIDs();
-
/// Returns the map that stores all Identifiers with their names.
- static inline const std::map<std::string, Identifier*>& getStringIdentifierMap()
- { return IdentifierManager::getStringIdentifierMapIntern(); }
- /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their names.
- static inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapBegin()
- { return IdentifierManager::getStringIdentifierMap().begin(); }
- /// Returns a const_iterator to the end of the map that stores all Identifiers with their names.
- static inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapEnd()
- { return IdentifierManager::getStringIdentifierMap().end(); }
-
+ inline const std::map<std::string, Identifier*>& getIdentifierByStringMap()
+ { return this->identifierByString_; }
/// Returns the map that stores all Identifiers with their names in lowercase.
- static inline const std::map<std::string, Identifier*>& getLowercaseStringIdentifierMap()
- { return IdentifierManager::getLowercaseStringIdentifierMapIntern(); }
- /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their names in lowercase.
- static inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapBegin()
- { return IdentifierManager::getLowercaseStringIdentifierMap().begin(); }
- /// Returns a const_iterator to the end of the map that stores all Identifiers with their names in lowercase.
- static inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapEnd()
- { return IdentifierManager::getLowercaseStringIdentifierMap().end(); }
-
+ inline const std::map<std::string, Identifier*>& getIdentifierByLowercaseStringMap()
+ { return this->identifierByLowercaseString_; }
/// Returns the map that stores all Identifiers with their IDs.
- static inline const std::map<uint32_t, Identifier*>& getIDIdentifierMap()
- { return IdentifierManager::getIDIdentifierMapIntern(); }
- /// Returns a const_iterator to the beginning of the map that stores all Identifiers with their IDs.
- static inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapBegin()
- { return IdentifierManager::getIDIdentifierMap().begin(); }
- /// Returns a const_iterator to the end of the map that stores all Identifiers with their IDs.
- static inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapEnd()
- { return IdentifierManager::getIDIdentifierMap().end(); }
+ inline const std::map<uint32_t, Identifier*>& getIdentifierByNetworkIdMap()
+ { return this->identifierByNetworkId_; }
- protected:
- static Identifier* getIdentifierSingleton(const std::string& name, Identifier* proposal);
-
- /// Returns the map that stores all Identifiers with their names.
- static std::map<std::string, Identifier*>& getStringIdentifierMapIntern();
- /// Returns the map that stores all Identifiers with their names in lowercase.
- static std::map<std::string, Identifier*>& getLowercaseStringIdentifierMapIntern();
- /// Returns the map that stores all Identifiers with their network IDs.
- static std::map<uint32_t, Identifier*>& getIDIdentifierMapIntern();
-
private:
+ IdentifierManager();
+ IdentifierManager(const IdentifierManager&);
+ ~IdentifierManager() {}
+
/// Increases the hierarchyCreatingCounter_s variable, causing all new objects to store their parents.
- inline static void startCreatingHierarchy()
+ inline void startCreatingHierarchy()
{ hierarchyCreatingCounter_s++; }
/// Decreases the hierarchyCreatingCounter_s variable, causing the objects to stop storing their parents.
- inline static void stopCreatingHierarchy()
+ inline void stopCreatingHierarchy()
{ hierarchyCreatingCounter_s--; }
- static std::map<std::string, Identifier*>& getTypeIDIdentifierMap();
+ std::map<std::string, Identifier*> identifierByTypeidName_; //!< Map with the names as received by typeid(). This is only used internally.
- static int hierarchyCreatingCounter_s; //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading)
- static unsigned int classIDCounter_s; //!< Static counter for the unique classIDs
+ std::map<std::string, Identifier*> identifierByString_; //!< Map that stores all Identifiers with their names.
+ std::map<std::string, Identifier*> identifierByLowercaseString_; //!< Map that stores all Identifiers with their names in lowercase.
+ std::map<uint32_t, Identifier*> identifierByNetworkId_; //!< Returns the map that stores all Identifiers with their network IDs.
+
+ int hierarchyCreatingCounter_s; //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading)
+ std::set<const Identifier*> identifiersOfNewObject_; //!< Used while creating the object hierarchy to keep track of the identifiers of a newly created object
+ unsigned int classIDCounter_s; //!< counter for the unique classIDs
};
}
Copied: code/trunk/src/libraries/core/class/OrxonoxClass.cc (from rev 9666, code/branches/core6/src/libraries/core/class/OrxonoxClass.cc)
===================================================================
--- code/trunk/src/libraries/core/class/OrxonoxClass.cc (rev 0)
+++ code/trunk/src/libraries/core/class/OrxonoxClass.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -0,0 +1,40 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxClass.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+ RegisterClassNoArgs(OrxonoxClass);
+
+ OrxonoxClass::OrxonoxClass()
+ {
+ RegisterObject(OrxonoxClass);
+ }
+}
Modified: code/trunk/src/libraries/core/class/OrxonoxClass.h
===================================================================
--- code/branches/core6/src/libraries/core/class/OrxonoxClass.h 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/class/OrxonoxClass.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -49,11 +49,11 @@
{
/**
@brief This is the class from which all objects of the game-logic (not the engine) are derived from.
-
- The BaseObject and other classes are derived with @c virtual @c public @c OrxonoxClass from OrxonoxClass.
*/
class _CoreExport OrxonoxClass : virtual public Configurable, virtual public Destroyable
{
+ public:
+ OrxonoxClass();
};
}
Copied: code/trunk/src/libraries/core/class/OrxonoxInterface.cc (from rev 9666, code/branches/core6/src/libraries/core/class/OrxonoxInterface.cc)
===================================================================
--- code/trunk/src/libraries/core/class/OrxonoxInterface.cc (rev 0)
+++ code/trunk/src/libraries/core/class/OrxonoxInterface.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -0,0 +1,40 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "OrxonoxInterface.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+ RegisterClassNoArgs(OrxonoxInterface);
+
+ OrxonoxInterface::OrxonoxInterface()
+ {
+ RegisterObject(OrxonoxInterface);
+ }
+}
Modified: code/trunk/src/libraries/core/class/OrxonoxInterface.h
===================================================================
--- code/branches/core6/src/libraries/core/class/OrxonoxInterface.h 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/class/OrxonoxInterface.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -49,6 +49,8 @@
*/
class _CoreExport OrxonoxInterface : virtual public Configurable, virtual public Destroyable
{
+ public:
+ OrxonoxInterface();
};
}
Modified: code/trunk/src/libraries/core/class/SubclassIdentifier.h
===================================================================
--- code/branches/core6/src/libraries/core/class/SubclassIdentifier.h 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/class/SubclassIdentifier.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -162,9 +162,9 @@
}
/// Creates a new object of the type of the assigned Identifier and dynamic_casts it to the minimal type given by T.
- T* fabricate(BaseObject* creator) const
+ T* fabricate(Context* context) const
{
- OrxonoxClass* newObject = this->identifier_->fabricate(creator);
+ Identifiable* newObject = this->identifier_->fabricate(context);
// Check if the creation was successful
if (newObject)
Modified: code/trunk/src/libraries/core/class/Super.h
===================================================================
--- code/branches/core6/src/libraries/core/class/Super.h 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/class/Super.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -102,7 +102,7 @@
static void apply(baseclass*) \
{ \
ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier(); \
- for (std::set<const Identifier*>::iterator it = identifier->getDirectChildrenIntern().begin(); it != identifier->getDirectChildrenIntern().end(); ++it) \
+ for (std::set<const Identifier*>::iterator it = identifier->getDirectChildren().begin(); it != identifier->getDirectChildren().end(); ++it) \
{ \
if (((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_) \
{ \
@@ -170,7 +170,7 @@
ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier();
// Iterate through all children
- for (std::set<const Identifier*>::iterator it = identifier->getDirectChildrenIntern().begin(); it != identifier->getDirectChildrenIntern().end(); ++it)
+ for (std::set<const Identifier*>::iterator it = identifier->getDirectChildren().begin(); it != identifier->getDirectChildren().end(); ++it)
{
// Check if the caller is a fallback-caller
if (((ClassIdentifier<T>*)(*it))->bSuperFunctionCaller_##functionname##_isFallback_ && ((ClassIdentifier<T>*)(*it))->superFunctionCaller_##functionname##_)
Modified: code/trunk/src/libraries/core/command/ArgumentCompletionFunctions.cc
===================================================================
--- code/trunk/src/libraries/core/command/ArgumentCompletionFunctions.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/command/ArgumentCompletionFunctions.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,9 +38,9 @@
#include "util/Convert.h"
#include "util/StringUtils.h"
-#include "core/Identifier.h"
-#include "core/ConfigFileManager.h"
-#include "core/ConfigValueContainer.h"
+#include "core/class/Identifier.h"
+#include "core/config/SettingsConfigFile.h"
+#include "core/config/ConfigValueContainer.h"
#include "CommandExecutor.h"
#include "ConsoleCommand.h"
#include "TclThreadManager.h"
Modified: code/trunk/src/libraries/core/command/Functor.h
===================================================================
--- code/trunk/src/libraries/core/command/Functor.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/command/Functor.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -119,7 +119,7 @@
#include "util/Output.h"
#include "util/MultiType.h"
-#include "core/OrxonoxClass.h"
+#include "core/object/Destroyable.h"
#include "FunctorPtr.h"
namespace orxonox
@@ -302,12 +302,12 @@
protected:
/// Casts the object and registers as destruction listener.
inline void registerObject(O* object)
- { OrxonoxClass* base = dynamic_cast<OrxonoxClass*>(object); if (base) { this->registerAsDestructionListener(base); } }
+ { Destroyable* base = dynamic_cast<Destroyable*>(object); if (base) { this->registerAsDestructionListener(base); } }
/// Casts the object and unregisters as destruction listener.
inline void unregisterObject(O* object)
- { OrxonoxClass* base = dynamic_cast<OrxonoxClass*>(object); if (base) { this->unregisterAsDestructionListener(base); } }
+ { Destroyable* base = dynamic_cast<Destroyable*>(object); if (base) { this->unregisterAsDestructionListener(base); } }
- /// Will be called by OrxonoxClass::~OrxonoxClass() if the stored object is deleted and the Functor is in safe mode.
+ /// Will be called by Destroyable::~Destroyable() if the stored object is deleted and the Functor is in safe mode.
inline void objectDeleted()
{ this->object_ = 0; }
Modified: code/trunk/src/libraries/core/command/IOConsolePOSIX.cc
===================================================================
--- code/trunk/src/libraries/core/command/IOConsolePOSIX.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/command/IOConsolePOSIX.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -98,7 +98,7 @@
this->cout_ << "\033[" << this->statusLineWidths_.size() << 'T';
resetTerminalMode();
- this->shell_->destroy();
+ delete this->shell_;
// Restore this->cout_ redirection
std::cout.rdbuf(this->cout_.rdbuf());
Modified: code/trunk/src/libraries/core/command/IOConsoleWindows.cc
===================================================================
--- code/trunk/src/libraries/core/command/IOConsoleWindows.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/command/IOConsoleWindows.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -112,7 +112,7 @@
OutputManager::getInstance().getConsoleWriter()->enable();
resetTerminalMode();
- this->shell_->destroy();
+ delete this->shell_;
}
//! Processes the pending input key strokes, refreshes the status lines and handles std::cout (redirected)
Modified: code/trunk/src/libraries/core/command/Shell.cc
===================================================================
--- code/trunk/src/libraries/core/command/Shell.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/command/Shell.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,8 +39,8 @@
#include "util/output/OutputManager.h"
#include "util/output/MemoryWriter.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigFileManager.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigFileManager.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/PathConfig.h"
#include "core/input/InputBuffer.h"
#include "CommandExecutor.h"
@@ -55,6 +55,8 @@
const OutputLevel User = level::user_info;
}
+ RegisterClassNoArgs(Shell);
+
/**
@brief Constructor: Initializes the values.
@param consoleName The name of the shell - used to define the name of the soft-debug-level config-value
@@ -65,7 +67,7 @@
, inputBuffer_(new InputBuffer())
, bScrollable_(bScrollable)
{
- RegisterRootObject(Shell);
+ RegisterObject(Shell);
OutputManager::getInstance().registerListener(this);
@@ -95,7 +97,7 @@
*/
Shell::~Shell()
{
- this->inputBuffer_->destroy();
+ delete this->inputBuffer_;
OutputManager::getInstance().unregisterListener(this);
}
Modified: code/trunk/src/libraries/core/command/Shell.h
===================================================================
--- code/trunk/src/libraries/core/command/Shell.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/command/Shell.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -49,7 +49,6 @@
#include "util/output/BaseWriter.h"
#include "core/Core.h"
-#include "core/OrxonoxClass.h"
namespace orxonox
{
@@ -109,7 +108,7 @@
Hint
};
- Shell(const std::string& consoleName, bool bScrollable);
+ Shell(const std::string& consoleName = "", bool bScrollable = true);
~Shell();
void setConfigValues();
@@ -199,7 +198,7 @@
unsigned int maxHistoryLength_; ///< The maximum number of saved commands
unsigned int historyOffset_; ///< The command history is a circular buffer, this variable defines the current write-offset
std::vector<std::string> commandHistory_; ///< The history of commands that were entered by the user
- static unsigned int cacheSize_s; ///< The maximum cache size of the CommandExecutor - this is stored here for better readability of the config file and because CommandExecutor is no OrxonoxClass
+ static unsigned int cacheSize_s; ///< The maximum cache size of the CommandExecutor - this is stored here for better readability of the config file and because CommandExecutor is not configurable
};
}
Modified: code/trunk/src/libraries/core/config/CMakeLists.txt
===================================================================
--- code/branches/core6/src/libraries/core/config/CMakeLists.txt 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/config/CMakeLists.txt 2013-08-25 19:08:42 UTC (rev 9667)
@@ -5,6 +5,7 @@
ConfigFileEntryVectorValue.cc
ConfigFileManager.cc
ConfigFileSection.cc
+ Configurable.cc
ConfigValueContainer.cc
SettingsConfigFile.cc
)
Modified: code/trunk/src/libraries/core/config/ConfigValueContainer.h
===================================================================
--- code/branches/core6/src/libraries/core/config/ConfigValueContainer.h 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/config/ConfigValueContainer.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -69,7 +69,7 @@
inline virtual ~ConfigValueCallback() {}
inline virtual void call(void* object)
{
- if (!IdentifierManager::isCreatingHierarchy())
+ if (!IdentifierManager::getInstance().isCreatingHierarchy())
(static_cast<T*>(object)->*this->function_)();
}
Copied: code/trunk/src/libraries/core/config/Configurable.cc (from rev 9666, code/branches/core6/src/libraries/core/config/Configurable.cc)
===================================================================
--- code/trunk/src/libraries/core/config/Configurable.cc (rev 0)
+++ code/trunk/src/libraries/core/config/Configurable.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -0,0 +1,40 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "Configurable.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+ RegisterClassNoArgs(Configurable);
+
+ Configurable::Configurable()
+ {
+ RegisterObject(Configurable);
+ }
+}
Modified: code/trunk/src/libraries/core/config/Configurable.h
===================================================================
--- code/branches/core6/src/libraries/core/config/Configurable.h 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/config/Configurable.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -47,6 +47,8 @@
class _CoreExport Configurable : virtual public Listable
{
public:
+ Configurable();
+
/// Function to collect the SetConfigValue-macro calls.
void setConfigValues() {};
};
Modified: code/trunk/src/libraries/core/input/Button.cc
===================================================================
--- code/trunk/src/libraries/core/input/Button.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/input/Button.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,7 +41,7 @@
#include "core/command/ConsoleCommand.h"
#include "core/command/CommandEvaluation.h"
#include "core/command/CommandExecutor.h"
-#include "core/ConfigFileManager.h"
+#include "core/config/ConfigFile.h"
namespace orxonox
{
Modified: code/trunk/src/libraries/core/input/InputBuffer.cc
===================================================================
--- code/trunk/src/libraries/core/input/InputBuffer.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/input/InputBuffer.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -30,13 +30,15 @@
#include "util/Clipboard.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
namespace orxonox
{
+ RegisterClassNoArgs(InputBuffer);
+
InputBuffer::InputBuffer()
{
- RegisterRootObject(InputBuffer);
+ RegisterObject(InputBuffer);
this->cursor_ = 0;
this->maxLength_ = 1024;
@@ -56,7 +58,7 @@
InputBuffer::InputBuffer(const std::string& allowedChars)
{
- RegisterRootObject(InputBuffer);
+ RegisterObject(InputBuffer);
this->maxLength_ = 1024;
this->allowedChars_ = allowedChars;
Modified: code/trunk/src/libraries/core/input/InputBuffer.h
===================================================================
--- code/trunk/src/libraries/core/input/InputBuffer.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/input/InputBuffer.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,7 +33,7 @@
#include <list>
#include <string>
-#include "core/OrxonoxClass.h"
+#include "core/config/Configurable.h"
#include "InputHandler.h"
namespace orxonox
@@ -73,7 +73,7 @@
void (T::*function_)();
};
- class _CoreExport InputBuffer : public InputHandler, public OrxonoxClass
+ class _CoreExport InputBuffer : public InputHandler, public Configurable
{
public:
InputBuffer();
Modified: code/trunk/src/libraries/core/input/InputManager.cc
===================================================================
--- code/trunk/src/libraries/core/input/InputManager.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/input/InputManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -45,9 +45,9 @@
#include "util/Convert.h"
#include "util/Exception.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
-#include "core/CommandLineParser.h"
#include "core/GraphicsManager.h"
+#include "core/config/ConfigValueIncludes.h"
+#include "core/config/CommandLineParser.h"
#include "core/command/ConsoleCommand.h"
#include "core/command/Functor.h"
@@ -97,7 +97,7 @@
, emptyState_(0)
, calibratorCallbackHandler_(0)
{
- RegisterRootObject(InputManager);
+ RegisterObject(InputManager);
orxout(internal_status, context::input) << "InputManager: Constructing..." << endl;
@@ -279,7 +279,7 @@
// Destroy calibrator helper handler and state
this->destroyState("calibrator");
// Destroy KeyDetector and state
- calibratorCallbackHandler_->destroy();
+ delete calibratorCallbackHandler_;
// Destroy the empty InputState
this->destroyStateInternal(this->emptyState_);
@@ -641,7 +641,7 @@
{
assert(state && this->activeStates_.find(state->getPriority()) == this->activeStates_.end());
statesByName_.erase(state->getName());
- state->destroy();
+ delete state;
}
bool InputManager::setMouseExclusive(const std::string& name, tribool value)
Modified: code/trunk/src/libraries/core/input/JoyStick.cc
===================================================================
--- code/trunk/src/libraries/core/input/JoyStick.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/input/JoyStick.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,8 +33,9 @@
#include <boost/foreach.hpp>
#include "util/StringUtils.h"
-#include "core/ConfigFileManager.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigFile.h"
+#include "core/config/ConfigFileManager.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/CoreIncludes.h"
#include "util/Convert.h"
#include "InputState.h"
@@ -49,7 +50,7 @@
JoyStick::JoyStick(unsigned int id, OIS::InputManager* oisInputManager)
: super(id, oisInputManager)
{
- RegisterRootObject(JoyStick);
+ RegisterObject(JoyStick);
this->setConfigValues();
// Initialise POV and Slider states
this->clearBuffersImpl();
Modified: code/trunk/src/libraries/core/input/JoyStick.h
===================================================================
--- code/trunk/src/libraries/core/input/JoyStick.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/input/JoyStick.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,6 +35,7 @@
#include <vector>
#include <ois/OISJoyStick.h>
#include "InputDevice.h"
+#include "core/config/Configurable.h"
namespace orxonox
{
@@ -57,7 +58,7 @@
in an ini-file.
*/
class _CoreExport JoyStick
- : public OrxonoxClass
+ : public Configurable
, public InputDeviceTemplated<JoyStickTraits>
, public OIS::JoyStickListener
{
Modified: code/trunk/src/libraries/core/input/JoyStickQuantityListener.cc
===================================================================
--- code/trunk/src/libraries/core/input/JoyStickQuantityListener.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/input/JoyStickQuantityListener.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -29,7 +29,7 @@
#include "JoyStickQuantityListener.h"
#include "core/CoreIncludes.h"
-#include "core/ObjectList.h"
+#include "core/object/ObjectList.h"
namespace orxonox
{
Modified: code/trunk/src/libraries/core/input/JoyStickQuantityListener.h
===================================================================
--- code/trunk/src/libraries/core/input/JoyStickQuantityListener.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/input/JoyStickQuantityListener.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,12 +37,12 @@
#include "InputPrereqs.h"
#include <vector>
-#include "core/OrxonoxClass.h"
+#include "core/object/Listable.h"
namespace orxonox
{
//! Derive from this class to get informed when joy sticks get added/removed
- class _CoreExport JoyStickQuantityListener : virtual public OrxonoxClass
+ class _CoreExport JoyStickQuantityListener : virtual public Listable
{
friend class InputManager;
protected:
Modified: code/trunk/src/libraries/core/input/KeyBinder.cc
===================================================================
--- code/trunk/src/libraries/core/input/KeyBinder.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/input/KeyBinder.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,9 +33,9 @@
#include "util/Convert.h"
#include "util/Output.h"
#include "util/Exception.h"
-#include "core/ConfigValueIncludes.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigFileManager.h"
+#include "core/config/ConfigValueIncludes.h"
+#include "core/config/ConfigFile.h"
#include "core/PathConfig.h"
#include "InputCommands.h"
#include "JoyStick.h"
@@ -57,7 +57,7 @@
mousePosition_[0] = 0.0;
mousePosition_[1] = 0.0;
- RegisterRootObject(KeyBinder);
+ RegisterObject(KeyBinder);
// initialise all buttons and half axes to avoid creating everything with 'new'
// keys
Modified: code/trunk/src/libraries/core/input/KeyBinderManager.cc
===================================================================
--- code/trunk/src/libraries/core/input/KeyBinderManager.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/input/KeyBinderManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -31,7 +31,7 @@
#include "util/Output.h"
#include "util/Exception.h"
#include "util/ScopedSingletonManager.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/CoreIncludes.h"
#include "core/LuaState.h"
#include "core/command/ConsoleCommand.h"
Modified: code/trunk/src/libraries/core/input/KeyBinderManager.h
===================================================================
--- code/trunk/src/libraries/core/input/KeyBinderManager.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/input/KeyBinderManager.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,7 +35,7 @@
#include <string>
#include "util/Singleton.h"
-#include "core/OrxonoxClass.h"
+#include "core/config/Configurable.h"
namespace orxonox //tolua_export
{ //tolua_export
@@ -52,7 +52,7 @@
will not work as expected!
*/
class _CoreExport KeyBinderManager //tolua_export
- : public Singleton<KeyBinderManager>, public OrxonoxClass
+ : public Singleton<KeyBinderManager>, public Configurable
{ //tolua_export
friend class Singleton<KeyBinderManager>;
public:
Modified: code/trunk/src/libraries/core/input/Mouse.cc
===================================================================
--- code/trunk/src/libraries/core/input/Mouse.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/core/input/Mouse.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -53,7 +53,7 @@
Mouse::Mouse(unsigned int id, OIS::InputManager* oisInputManager)
: super(id, oisInputManager)
{
- RegisterRootObject(Mouse);
+ RegisterObject(Mouse);
this->windowResized(this->getWindowWidth(), this->getWindowHeight());
#ifdef ORXONOX_PLATFORM_LINUX
Modified: code/trunk/src/libraries/core/object/CMakeLists.txt
===================================================================
--- code/branches/core6/src/libraries/core/object/CMakeLists.txt 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/object/CMakeLists.txt 2013-08-25 19:08:42 UTC (rev 9667)
@@ -2,6 +2,5 @@
Context.cc
Destroyable.cc
Listable.cc
- MetaObjectList.cc
ObjectListBase.cc
)
Modified: code/trunk/src/libraries/core/object/ClassFactory.h
===================================================================
--- code/branches/core6/src/libraries/core/object/ClassFactory.h 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/object/ClassFactory.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,48 +42,62 @@
#include <string>
#include "util/Output.h"
-#include "core/class/Identifier.h"
namespace orxonox
{
// ###########################
// ### Factory ###
// ###########################
- /// Base-class of ClassFactory.
+ /// Base-class of all factories.
class _CoreExport Factory
{
public:
- virtual ~Factory() {};
- virtual OrxonoxClass* fabricate(BaseObject* creator) = 0;
+ virtual ~Factory() {}
+ virtual Identifiable* fabricate(Context* context) = 0;
};
// ###############################
// ### ClassFactory ###
// ###############################
- /// The ClassFactory is able to create new objects of a specific class.
+ /// The ClassFactory is the base-class of all class-spezific factories
template <class T>
class ClassFactory : public Factory
{
+ };
+
+ // ###############################
+ // ### ClassFactoryNoArgs ###
+ // ###############################
+ /// The ClassFactoryNoArgs is able to create new objects of a specific class that require no constructor arguments.
+ template <class T>
+ class ClassFactoryNoArgs : public ClassFactory<T>
+ {
public:
/**
- @brief Constructor: Adds the ClassFactory to the Identifier of the same type.
- @param name The name of the class
- @param bLoadable True if the class can be loaded through XML
+ @brief Creates and returns a new object of class T.
+ @return The new object
*/
- ClassFactory(const std::string& name, bool bLoadable = true)
+ inline Identifiable* fabricate(Context* context)
{
- orxout(verbose, context::misc::factory) << "Create entry for " << name << " in Factory." << endl;
- ClassIdentifier<T>::getIdentifier(name)->addFactory(this);
- ClassIdentifier<T>::getIdentifier()->setLoadable(bLoadable);
+ return static_cast<Identifiable*>(new T());
}
+ };
+ // ###############################
+ // ### ClassFactoryWithContext ###
+ // ###############################
+ /// The ClassFactoryWithContext is able to create new objects of a specific class that require a context as constructor argument
+ template <class T>
+ class ClassFactoryWithContext : public ClassFactory<T>
+ {
+ public:
/**
@brief Creates and returns a new object of class T.
@return The new object
*/
- inline OrxonoxClass* fabricate(BaseObject* creator)
+ inline Identifiable* fabricate(Context* context)
{
- return static_cast<OrxonoxClass*>(new T(creator));
+ return static_cast<Identifiable*>(new T(context));
}
};
}
Modified: code/trunk/src/libraries/core/object/Context.cc
===================================================================
--- code/branches/core6/src/libraries/core/object/Context.cc 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/object/Context.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,20 +32,68 @@
*/
#include "Context.h"
+#include "core/class/Identifier.h"
+#include "core/CoreIncludes.h"
namespace orxonox
{
- Context::Context(Context* context) : parentContext_(context)
+ RegisterClass(Context);
+
+ Context* Context::rootContext_s = 0;
+
+ Context* getContextForInitializationOfOtherContexts()
{
+ static size_t count = 0;
+ // the first time this is called, ++count returns 1 and the context is created
+ // the second time this is called, ++count returns 2 and NULL is returned because we're in the constructor of the context itself
+ // for each future call the context (now completely created) is returned
+ if (++count == 2)
+ return NULL;
+ else
+ {
+ static Context context(NULL);
+ return &context;
+ }
}
+ // Initialize Listable(*) with a special context, only used to initialize other contexts. Later in the constructor we change the context
+ Context::Context(Context* context) : Listable(getContextForInitializationOfOtherContexts()), parentContext_(context)
+ {
+ RegisterObject(Context);
+
+ // the context is its own context
+ this->setContext(this);
+ }
+
Context::~Context()
{
+ // unregister context from object lists before object lists are destroyed
+ this->unregisterObject();
+ for (size_t i = 0; i < this->objectLists_.size(); ++i)
+ delete this->objectLists_[i];
}
+ /*static*/ void Context::setRootContext(Context* context)
+ {
+ if (Context::rootContext_s)
+ delete Context::rootContext_s;
+ Context::rootContext_s = context;
+ }
+
/*static*/ Context* Context::getRootContext()
{
- static Context rootContext(NULL);
- return &rootContext;
+ if (!Context::rootContext_s)
+ Context::rootContext_s = new Context(NULL);
+ return Context::rootContext_s;
}
+
+ ObjectListBase* Context::getObjectList(const Identifier* identifier)
+ {
+ unsigned int classID = identifier->getClassID();
+ if (classID >= this->objectLists_.size())
+ this->objectLists_.resize(classID + 1);
+ if (!this->objectLists_[classID])
+ this->objectLists_[classID] = new ObjectListBase();
+ return this->objectLists_[classID];
+ }
}
Modified: code/trunk/src/libraries/core/object/Context.h
===================================================================
--- code/branches/core6/src/libraries/core/object/Context.h 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/object/Context.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,21 +36,45 @@
#include "core/CorePrereqs.h"
+#include <vector>
+
+#include "Listable.h"
+
namespace orxonox
{
- class _CoreExport Context
+ class _CoreExport Context : virtual public Listable
{
public:
+ static void setRootContext(Context* context);
+ static Context* getRootContext();
+
Context(Context* context);
virtual ~Context();
inline Context* getParentContext() const
{ return this->parentContext_; }
- static Context* getRootContext();
+ ObjectListBase* getObjectList(const Identifier* identifier);
+ template <class T>
+ inline ObjectListBase* getObjectList()
+ { return this->getObjectList(ClassIdentifier<T>::getIdentifier()); }
+
+ template <class T>
+ inline void addObject(T* object)
+ {
+ ObjectListBaseElement* element = Listable::createObjectListElement(object);
+ this->getObjectList<T>()->addElement(element);
+ object->elements_.push_back(element);
+ if (this->getParentContext())
+ this->getParentContext()->addObject(object);
+ }
+
private:
Context* parentContext_;
+ std::vector<ObjectListBase*> objectLists_;
+
+ static Context* rootContext_s;
};
}
Modified: code/trunk/src/libraries/core/object/Iterator.h
===================================================================
--- code/branches/core6/src/libraries/core/object/Iterator.h 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/object/Iterator.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -55,8 +55,8 @@
#include "core/CorePrereqs.h"
-#include "core/class/Identifier.h"
#include "ObjectListBase.h"
+#include "IteratorBase.h"
namespace orxonox
{
@@ -69,181 +69,37 @@
@see See @ref IteratorExample "Iterator.h" for more information an example.
*/
template <class T>
- class Iterator
+ class Iterator : public IteratorBase<T, Iterator<T> >
{
public:
/**
@brief Constructor: Sets the element, whereon the iterator points, to zero.
*/
- inline Iterator()
- {
- this->element_ = 0;
- this->list_ = 0;
- }
+ inline Iterator() : IteratorBase<T, Iterator<T> >(NULL) {}
/**
- @brief Constructor: Sets this element to the exported element.
- @param exp The exported element
- */
- inline Iterator(const ObjectListBase::Export& exp)
- {
- this->element_ = exp.element_;
- this->list_ = exp.list_;
- this->list_->registerIterator(this);
- }
-
- /**
- @brief Constructor: Sets this element to the element of another Iterator.
- @param other The other Iterator
- */
- inline Iterator(const Iterator<T>& other)
- {
- this->element_ = other.element_;
- this->list_ = other.list_;
- this->list_->registerIterator(this);
- }
-
- /**
@brief Constructor: Sets this element to a given element
@param element The element
*/
- template <class O>
- inline Iterator(ObjectListElement<O>* element)
- {
- this->element_ = element;
- this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects();
- this->list_->registerIterator(this);
- }
+ inline Iterator(ObjectListBaseElement* element) : IteratorBase<T, Iterator<T> >(element) {}
/**
- @brief Constructor: Sets this element to the element an ObjectListIterator.
- @param other The ObjectListIterator
- */
- template <class O>
- inline Iterator(const ObjectListIterator<O>& other)
- {
- this->element_ = other.element_;
- this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects();
- this->list_->registerIterator(this);
- }
-
- /**
- @brief Unregisters the Iterator from the ObjectList.
- */
- inline ~Iterator()
- {
- this->list_->unregisterIterator(this);
- }
-
- /**
- @brief Assigns an exported element.
- @param exp The exported element
- */
- inline Iterator<T>& operator=(const ObjectListBase::Export& exp)
- {
- if (this->list_)
- this->list_->unregisterIterator(this);
-
- this->element_ = exp.element_;
- this->list_ = exp.list_;
- this->list_->registerIterator(this);
-
- return (*this);
- }
-
- /**
- @brief Assigns the element of another Iterator.
+ @brief Constructor: Sets this element to the element of another Iterator.
@param other The other Iterator
*/
- inline Iterator<T>& operator=(const Iterator<T>& other)
- {
- if (this->list_)
- this->list_->unregisterIterator(this);
+ inline Iterator(const Iterator<T>& other) : IteratorBase<T, Iterator<T> >(other) {}
- this->element_ = other.element_;
- this->list_ = other.list_;
- this->list_->registerIterator(this);
-
- return (*this);
- }
-
/**
@brief Assigns a given element.
@param element The element
*/
- template <class O>
- inline Iterator<T>& operator=(ObjectListElement<O>* element)
+ inline Iterator<T>& operator=(ObjectListBaseElement* element)
{
- if (this->list_)
- this->list_->unregisterIterator(this);
-
- this->element_ = element;
- this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects();
- this->list_->registerIterator(this);
-
+ this->setElement(element);
return (*this);
}
/**
- @brief Assigns the element of an ObjectListIterator.
- @param other The ObjectListIterator
- */
- template <class O>
- inline Iterator<T>& operator=(const ObjectListIterator<O>& other)
- {
- if (this->list_)
- this->list_->unregisterIterator(this);
-
- this->element_ = other.element_;
- this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects();
- this->list_->registerIterator(this);
-
- return (*this);
- }
-
- /**
- @brief Overloading of the ++it operator: Iterator points to the next object in the list.
- @return The Iterator itself
- */
- inline const Iterator<T>& operator++()
- {
- this->element_ = this->element_->next_;
- return *this;
- }
-
- /**
- @brief Overloading of the it++ operator: Iterator points to the next object in the list.
- @return The Iterator itself
- */
- inline Iterator<T> operator++(int)
- {
- Iterator<T> copy = *this;
- this->element_ = this->element_->next_;
- return copy;
- }
-
- /**
- @brief Overloading of the --it operator: Iterator points to the previous object in the list.
- @return The Iterator itself
- */
- inline const Iterator<T>& operator--()
- {
- this->element_ = this->element_->prev_;
- return *this;
- }
-
- /**
- @brief Overloading of the it-- operator: Iterator points to the previous object in the list.
- @return The Iterator itself
- */
- inline Iterator<T> operator--(int i)
- {
- Iterator<T> copy = *this;
- this->element_ = this->element_->prev_;
- return copy;
- }
-
- /**
@brief Overloading of the *it operator: returns the pointer to the object.
@return The object the Iterator points at
*/
@@ -260,49 +116,6 @@
{
return orxonox_cast<T*>(this->element_->objectBase_);
}
-
- /**
- @brief Overloading of the typecast-operator to bool: returns true if the iterator points to an existing object.
- @return True if the Iterator points to an existing object.
- */
- inline operator bool() const
- {
- return (this->element_ != 0);
- }
-
- /**
- @brief Overloading of the == operator to compare with another Iterator.
- @param compare The other Iterator
- @return True if the iterators point to the same element
- */
- inline bool operator==(const Iterator<T>& compare) const
- {
- return (this->element_ == compare.element_);
- }
-
- /**
- @brief Overloading of the != operator to compare with another Iterator.
- @param compare The other Iterator
- @return True if the iterators point to different elements
- */
- inline bool operator!=(const Iterator<T>& compare) const
- {
- return (this->element_ != compare.element_);
- }
-
- /**
- @brief Increments the Iterator if it points at the given object.
- @param object The object to compare with
- */
- inline void incrementIfEqual(Listable* object)
- {
- if (this->element_ && this->element_->objectBase_ == object)
- this->operator++();
- }
-
- protected:
- ObjectListBaseElement* element_; //!< The element the Iterator points at
- ObjectListBase* list_; //!< The list wherein the element is
};
}
Copied: code/trunk/src/libraries/core/object/IteratorBase.h (from rev 9666, code/branches/core6/src/libraries/core/object/IteratorBase.h)
===================================================================
--- code/trunk/src/libraries/core/object/IteratorBase.h (rev 0)
+++ code/trunk/src/libraries/core/object/IteratorBase.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -0,0 +1,216 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabian 'x3n' Landau
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file
+ @ingroup Object ObjectList
+ @brief Definition of the IteratorBase class, used to iterate through object-lists.
+*/
+
+#ifndef _IteratorBase_H__
+#define _IteratorBase_H__
+
+#include "core/CorePrereqs.h"
+
+#include "ObjectListBase.h"
+
+namespace orxonox
+{
+ /**
+ @brief The Iterator allows to iterate through object lists.
+ It serves as base class for @ref ObjectListIterator and @ref Iterator
+ */
+ template <class T, class I>
+ class IteratorBase : public ObjectListElementRemovalListener
+ {
+ public:
+ /**
+ @brief Constructor: Sets the element, whereon the iterator points, to zero.
+ */
+ inline IteratorBase(ObjectListBaseElement* element)
+ {
+ this->element_ = element;
+ this->registerIterator();
+ }
+
+ /**
+ @brief Constructor: Sets this element to the element of another Iterator.
+ @param other The other Iterator
+ */
+ inline IteratorBase(const IteratorBase& other)
+ {
+ this->element_ = other.element_;
+ this->registerIterator();
+ }
+
+ /**
+ @brief Unregisters the Iterator from the ObjectList.
+ */
+ inline ~IteratorBase()
+ {
+ this->unregisterIterator();
+ }
+
+ /**
+ @brief Assigns a given element.
+ @param element The element
+ */
+ inline IteratorBase<T, I>& operator=(ObjectListElement<T>* element)
+ {
+ this->setElement(element);
+ return (*this);
+ }
+
+ /**
+ @brief Assigns the element of another Iterator.
+ @param other The other Iterator
+ */
+ inline IteratorBase<T, I>& operator=(const IteratorBase<T, I>& other)
+ {
+ this->setElement(other.element_);
+ return (*this);
+ }
+
+ /**
+ @brief Overloading of the ++it operator: Iterator points to the next object in the list.
+ @return The Iterator itself
+ */
+ inline const IteratorBase<T, I>& operator++()
+ {
+ this->element_ = this->element_->next_;
+ return *this;
+ }
+
+ /**
+ @brief Overloading of the it++ operator: Iterator points to the next object in the list.
+ @return The Iterator itself
+ */
+ inline I operator++(int)
+ {
+ I copy = *this;
+ this->element_ = this->element_->next_;
+ return copy;
+ }
+
+ /**
+ @brief Overloading of the --it operator: Iterator points to the previous object in the list.
+ @return The Iterator itself
+ */
+ inline const IteratorBase<T, I>& operator--()
+ {
+ this->element_ = this->element_->prev_;
+ return *this;
+ }
+
+ /**
+ @brief Overloading of the it-- operator: Iterator points to the previous object in the list.
+ @return The Iterator itself
+ */
+ inline I operator--(int i)
+ {
+ I copy = *this;
+ this->element_ = this->element_->prev_;
+ return copy;
+ }
+
+ /**
+ @brief Overloading of the typecast-operator to bool: returns true if the iterator points to an existing object.
+ @return True if the Iterator points to an existing object.
+ */
+ inline operator bool() const
+ {
+ return (this->element_ != NULL);
+ }
+
+ /**
+ @brief Overloading of the == operator to compare with another Iterator.
+ @param compare The other Iterator
+ @return True if the iterators point to the same element
+ */
+ inline bool operator==(const IteratorBase<T, I>& compare) const
+ {
+ return (this->element_ == compare.element_);
+ }
+
+ /**
+ @brief Overloading of the != operator to compare with another Iterator.
+ @param compare The other Iterator
+ @return True if the iterators point to different elements
+ */
+ inline bool operator!=(const IteratorBase<T, I>& compare) const
+ {
+ return (this->element_ != compare.element_);
+ }
+
+ /**
+ @brief Increments the Iterator if it points at the given element.
+ @param object The object to compare with
+ */
+ virtual void removedElement(ObjectListBaseElement* element)
+ {
+ if (this->element_ == element)
+ this->operator++();
+ }
+
+ protected:
+ inline void setElement(ObjectListBaseElement* element)
+ {
+ this->unregisterIterator();
+ this->element_ = element;
+ this->registerIterator();
+ }
+
+ /**
+ * @brief Registers the Iterator at the list to which it belongs
+ */
+ inline void registerIterator()
+ {
+ if (this->element_)
+ {
+ this->list_ = this->element_->list_;
+ this->list_->registerRemovalListener(this);
+ }
+ else
+ this->list_ = NULL;
+ }
+
+ /**
+ * @brief Unregisters the Iterator from the list (if any)
+ */
+ inline void unregisterIterator()
+ {
+ if (this->list_)
+ this->list_->unregisterRemovalListener(this);
+ }
+
+ ObjectListBaseElement* element_; //!< The element the Iterator points at
+ ObjectListBase* list_; //!< The list in which the Iterator registered itself
+ };
+}
+
+#endif /* _IteratorBase_H__ */
Modified: code/trunk/src/libraries/core/object/Listable.cc
===================================================================
--- code/branches/core6/src/libraries/core/object/Listable.cc 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/object/Listable.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,20 +32,37 @@
*/
#include "Listable.h"
+#include "core/CoreIncludes.h"
+#include "ObjectListBase.h"
+#include "Context.h"
-#include "core/object/MetaObjectList.h"
-
namespace orxonox
{
+ RegisterClass(Listable);
+
/**
- @brief Constructor: creates the meta-object-list.
+ @brief Constructor: Allocates space in the element list.
*/
Listable::Listable()
{
- this->metaList_ = new MetaObjectList();
+ this->context_ = Context::getRootContext();
+ this->elements_.reserve(6);
+
+ RegisterObject(Listable);
}
/**
+ @brief Constructor: Allocates space in the element list and assigns the context
+ */
+ Listable::Listable(Context* context)
+ {
+ this->context_ = context;
+ this->elements_.reserve(6);
+
+ RegisterObject(Listable);
+ }
+
+ /**
@brief Destructor: Removes the object from the object-lists
*/
Listable::~Listable()
@@ -58,8 +75,39 @@
*/
void Listable::unregisterObject()
{
- if (this->metaList_)
- delete this->metaList_;
- this->metaList_ = 0;
+ for (size_t i = 0; i < this->elements_.size(); ++i)
+ Listable::deleteObjectListElement(this->elements_[i]);
+ this->elements_.clear();
}
+
+ /**
+ * @brief Changes the context.
+ * The object is removed from the current context and added to the new one. This also applies to all object lists the object is registered in.
+ */
+ void Listable::setContext(Context* context)
+ {
+ assert(context);
+ std::vector<ObjectListBaseElement*> copy = this->elements_;
+ this->elements_.clear();
+
+ for (size_t i = 0; i < copy.size(); ++i)
+ {
+ copy[i]->changeContext(this->context_, context);
+ Listable::deleteObjectListElement(copy[i]);
+ }
+
+ this->context_ = context;
+ }
+
+ /* static */ SmallObjectAllocator& Listable::getObjectListElementAllocator()
+ {
+ static SmallObjectAllocator allocator(sizeof(ObjectListElement<Listable>), 1024);
+ return allocator;
+ }
+
+ /* static */ void Listable::deleteObjectListElement(ObjectListBaseElement* element)
+ {
+ element->~ObjectListBaseElement();
+ Listable::getObjectListElementAllocator().free(element);
+ }
}
Modified: code/trunk/src/libraries/core/object/Listable.h
===================================================================
--- code/branches/core6/src/libraries/core/object/Listable.h 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/object/Listable.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,26 +36,45 @@
#define _Listable_H__
#include "core/CorePrereqs.h"
+
+#include <vector>
+
#include "core/class/Identifiable.h"
namespace orxonox
{
/**
- @brief Listable stores the MetaObjectList which is used when storing instances in object lists.
+ @brief Listable stores the entries of all object lists pointing to this instance.
*/
class _CoreExport Listable : virtual public Identifiable
{
- template <class T>
- friend class ClassIdentifier;
+ friend class Context;
public:
Listable();
+ Listable(Context* context);
virtual ~Listable();
void unregisterObject();
+ void setContext(Context* context);
+ inline Context* getContext() const
+ { return this->context_; }
+
private:
- MetaObjectList* metaList_; //!< MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in
+ static SmallObjectAllocator& getObjectListElementAllocator();
+
+ template <class T>
+ static ObjectListElement<T>* createObjectListElement(T* object)
+ {
+ void* chunk = Listable::getObjectListElementAllocator().alloc();
+ return new (chunk) ObjectListElement<T>(object);
+ }
+
+ static void deleteObjectListElement(ObjectListBaseElement* element);
+
+ Context* context_; //!< The object will register itself in the object lists of this context
+ std::vector<ObjectListBaseElement*> elements_; //!< The corresponding ObjectListElements in all object lists the object is registered in
};
}
Deleted: code/trunk/src/libraries/core/object/MetaObjectList.cc
===================================================================
--- code/branches/core6/src/libraries/core/object/MetaObjectList.cc 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/object/MetaObjectList.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,91 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @brief Implementation of the MetaObjectList class.
-*/
-
-#include "MetaObjectList.h"
-
-#include "util/Output.h"
-#include "core/class/Identifier.h"
-#include "ObjectListBase.h"
-
-namespace orxonox
-{
- // ###############################
- // ### MetaObjectListElement ###
- // ###############################
- /**
- @brief Destructor: Removes the ObjectListBaseElement from the ObjectListBase by linking next_ and prev_ of the ObjectListBaseElement.
- */
- MetaObjectListElement::~MetaObjectListElement()
- {
- this->list_->removeElement(this->element_);
- delete this->element_;
- }
-
-
- // ###############################
- // ### MetaObjectList ###
- // ###############################
- /**
- @brief Constructor: Sets first_ to zero.
- */
- MetaObjectList::MetaObjectList()
- {
- this->first_ = 0;
- }
-
- /**
- @brief Destructor: Removes all elements from the list, causing them to remove the stored ObjectListElement from the ObjectList.
- */
- MetaObjectList::~MetaObjectList()
- {
- MetaObjectListElement* temp;
- while (this->first_)
- {
- temp = this->first_->next_;
- delete this->first_;
- this->first_ = temp;
- }
- }
-
- /**
- @brief Adds an ObjectList and an element of that list to the MetaObjectList.
- @param list The ObjectList wherein the element is
- @param element The element wherein the object is
- */
- void MetaObjectList::add(ObjectListBase* list, ObjectListBaseElement* element)
- {
- MetaObjectListElement* temp = this->first_;
- this->first_ = new MetaObjectListElement(list, element);
- this->first_->next_ = temp;
- }
-}
Deleted: code/trunk/src/libraries/core/object/MetaObjectList.h
===================================================================
--- code/branches/core6/src/libraries/core/object/MetaObjectList.h 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/object/MetaObjectList.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -1,86 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @ingroup Object ObjectList
- @brief Declaration of the MetaObjectList class.
-
- The MetaObjectList is a single-linked list, containing all list-elements and their
- lists wherein the object, owning the MetaObjectList, is registered.
- This allows much faster deletion of objects because no iteration is needed.
-*/
-
-#ifndef _MetaObjectList_H__
-#define _MetaObjectList_H__
-
-#include "core/CorePrereqs.h"
-
-namespace orxonox
-{
- // ###############################
- // ### MetaObjectListElement ###
- // ###############################
- /// The list-element of the MetaObjectList
- class _CoreExport MetaObjectListElement
- {
- public:
- /**
- @brief Constructor: Creates the list-element with given list and element.
- */
- MetaObjectListElement(ObjectListBase* list, ObjectListBaseElement* element) : next_(0), element_(element), list_(list) {}
- ~MetaObjectListElement();
-
- MetaObjectListElement* next_; //!< The next Element in the list
- ObjectListBaseElement* element_; //!< The list element, containing the object
- ObjectListBase* list_; //!< The list, containing the element
- };
-
-
- // ###############################
- // ### MetaObjectList ###
- // ###############################
- /**
- @brief The MetaObjectList contains ObjectListBaseElements and their ObjectListBases.
-
- The MetaObjectList is a single-linked list, containing all list-elements and their
- lists wherein the object that owns the MetaObjectList is registered.
- This allows much faster deletion of objects because no iteration is needed.
- */
- class _CoreExport MetaObjectList
- {
- public:
- MetaObjectList();
- ~MetaObjectList();
- void add(ObjectListBase* list, ObjectListBaseElement* element);
-
- MetaObjectListElement* first_; //!< The first element in the list
- };
-}
-
-#endif /* _MetaObjectList_H__ */
Modified: code/trunk/src/libraries/core/object/ObjectList.h
===================================================================
--- code/branches/core6/src/libraries/core/object/ObjectList.h 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/object/ObjectList.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -48,6 +48,7 @@
#include "ObjectListBase.h"
#include "ObjectListIterator.h"
+#include "Context.h"
namespace orxonox
{
@@ -67,32 +68,38 @@
public:
typedef ObjectListIterator<T> iterator;
+ /// Returns the size of the list
+ inline static size_t size()
+ {
+ return Context::getRootContext()->getObjectList<T>()->size();
+ }
+
/// Returns an Iterator to the first element in the list.
inline static ObjectListElement<T>* begin()
{
- ObjectListBase* list = ClassIdentifier<T>::getIdentifier()->getObjects();
- return static_cast<ObjectListElement<T>*>(list->begin().element_);
+ ObjectListBase* list = Context::getRootContext()->getObjectList<T>();
+ return static_cast<ObjectListElement<T>*>(list->begin());
}
/// Returns an Iterator to the element after the last element in the list.
inline static ObjectListElement<T>* end()
{
- ObjectListBase* list = ClassIdentifier<T>::getIdentifier()->getObjects();
- return static_cast<ObjectListElement<T>*>(list->end().element_);
+ ObjectListBase* list = Context::getRootContext()->getObjectList<T>();
+ return static_cast<ObjectListElement<T>*>(list->end());
}
/// Returns an Iterator to the last element in the list.
inline static ObjectListElement<T>* rbegin()
{
- ObjectListBase* list = ClassIdentifier<T>::getIdentifier()->getObjects();
- return static_cast<ObjectListElement<T>*>(list->rbegin().element_);
+ ObjectListBase* list = Context::getRootContext()->getObjectList<T>();
+ return static_cast<ObjectListElement<T>*>(list->rbegin());
}
/// Returns an Iterator to the element before the first element in the list.
inline static ObjectListElement<T>* rend()
{
- ObjectListBase* list = ClassIdentifier<T>::getIdentifier()->getObjects();
- return static_cast<ObjectListElement<T>*>(list->rend().element_);
+ ObjectListBase* list = Context::getRootContext()->getObjectList<T>();
+ return static_cast<ObjectListElement<T>*>(list->rend());
}
};
}
Modified: code/trunk/src/libraries/core/object/ObjectListBase.cc
===================================================================
--- code/branches/core6/src/libraries/core/object/ObjectListBase.cc 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/object/ObjectListBase.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,6 +40,18 @@
namespace orxonox
{
+ // ###############################
+ // ### ObjectListBaseElement ###
+ // ###############################
+ void ObjectListBaseElement::removeFromList()
+ {
+ if (this->list_)
+ this->list_->removeElement(this);
+ }
+
+ // ###############################
+ // ### ObjectListBase ###
+ // ###############################
/**
@brief Constructor: Sets default values.
*/
@@ -47,6 +59,7 @@
{
this->first_ = 0;
this->last_ = 0;
+ this->size_ = 0;
}
/**
@@ -54,57 +67,79 @@
*/
ObjectListBase::~ObjectListBase()
{
- ObjectListBaseElement* temp;
- while (this->first_)
+ ObjectListBaseElement* current = this->first_;
+ while (current)
{
- temp = this->first_->next_;
- delete this->first_;
- this->first_ = temp;
+ ObjectListBaseElement* next = current->next_;
+
+ current->list_ = 0;
+ current->next_ = 0;
+ current->prev_ = 0;
+
+ current = next;
}
}
/**
- @brief Increases all Iterators that currently point on the given element (because it gets removed).
- @param object The object that gets removed
+ @brief Notifies all listeners that the given element is about to get removed.
+ @param element The element that gets removed
+ This is mainly used for iterators which point at the removed element
*/
- void ObjectListBase::notifyIterators(Listable* object) const
+ void ObjectListBase::notifyRemovalListeners(ObjectListBaseElement* element) const
{
- for (std::vector<void*>::const_iterator it = this->iterators_.begin(); it != this->iterators_.end(); ++it)
- ((Iterator<Listable>*)(*it))->incrementIfEqual(object);
- for (std::vector<void*>::const_iterator it = this->objectListIterators_.begin(); it != this->objectListIterators_.end(); ++it)
- ((ObjectListIterator<Listable>*)(*it))->incrementIfEqual(object);
+ for (std::vector<ObjectListElementRemovalListener*>::const_iterator it = this->listeners_.begin(); it != this->listeners_.end(); ++it)
+ (*it)->removedElement(element);
}
/**
@brief Adds a new object to the end of the list.
@param element The element to add
- @return The pointer to the new ObjectListBaseElement, needed by the MetaObjectList of the added object
*/
- ObjectListBaseElement* ObjectListBase::addElement(ObjectListBaseElement* element)
+ void ObjectListBase::addElement(ObjectListBaseElement* element)
{
+ if (element->list_)
+ {
+ orxout(internal_error) << "Element is already registered in another list" << endl;
+ return;
+ }
+
+ if (element->objectBase_)
+ orxout(verbose, context::object_list) << "Added object to " << element->objectBase_->getIdentifier()->getName() << "-list." << endl;
+
if (!this->last_)
{
// If the list is empty
this->last_ = element;
- this->first_ = this->last_; // There's only one object in the list now
+ this->first_ = element; // There's only one object in the list now
}
else
{
// If the list isn't empty
ObjectListBaseElement* temp = this->last_;
this->last_ = element;
- this->last_->prev_ = temp;
- temp->next_ = this->last_;
+ element->prev_ = temp;
+ temp->next_ = element;
}
- return this->last_;
+ element->list_ = this;
+ ++this->size_;
}
+ /**
+ * @brief Removes the element from the list
+ */
void ObjectListBase::removeElement(ObjectListBaseElement* element)
{
- orxout(verbose, context::object_list) << "Removing Object from " << element->objectBase_->getIdentifier()->getName() << "-list." << endl;
- this->notifyIterators(element->objectBase_);
+ if (element->list_ != this)
+ {
+ orxout(internal_error) << "Element is not registered in this list" << endl;
+ return;
+ }
+ if (element->objectBase_)
+ orxout(verbose, context::object_list) << "Removing Object from " << element->objectBase_->getIdentifier()->getName() << "-list." << endl;
+ this->notifyRemovalListeners(element);
+
if (element->next_)
element->next_->prev_ = element->prev_;
else
@@ -114,5 +149,10 @@
element->prev_->next_ = element->next_;
else
this->first_ = element->next_; // If there is no prev_, we deleted the first object and have to update the first_ pointer of the list
+
+ element->list_ = 0;
+ element->next_ = 0;
+ element->prev_ = 0;
+ --this->size_;
}
}
Modified: code/trunk/src/libraries/core/object/ObjectListBase.h
===================================================================
--- code/branches/core6/src/libraries/core/object/ObjectListBase.h 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/object/ObjectListBase.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,6 +41,7 @@
#include "core/CorePrereqs.h"
#include <vector>
+#include "Context.h"
namespace orxonox
{
@@ -55,11 +56,18 @@
@brief Constructor: Creates the list-element with an object.
@param objectBase The object to store
*/
- ObjectListBaseElement(Listable* objectBase) : next_(0), prev_(0), objectBase_(objectBase) {}
+ ObjectListBaseElement(Listable* object) : next_(0), prev_(0), objectBase_(object), list_(0) {}
+ virtual ~ObjectListBaseElement() { this->removeFromList(); }
+ virtual void changeContext(Context* oldContext, Context* newContext) = 0;
+
ObjectListBaseElement* next_; //!< The next element in the list
ObjectListBaseElement* prev_; //!< The previous element in the list
- Listable* objectBase_;
+ Listable* objectBase_; //!< The object
+ ObjectListBase* list_; //!< The list
+
+ protected:
+ void removeFromList();
};
@@ -72,10 +80,33 @@
{
public:
ObjectListElement(T* object) : ObjectListBaseElement(static_cast<Listable*>(object)), object_(object) {}
+
+ virtual void changeContext(Context* oldContext, Context* newContext)
+ {
+ // add object to new context, but only if this element belongs exactly to the old context (and not to a sub-context to avoid re-adding objects
+ // multiple times if they are in multiple contexts)
+ if (oldContext->getObjectList<T>() == this->list_)
+ newContext->addObject(this->object_);
+
+ // remove from old list
+ this->removeFromList();
+ }
+
T* object_; //!< The object
};
+ // ########################################
+ // ### ObjectListElementRemovalListener ###
+ // ########################################
+ /// Gets called by the object list if an element is removed
+ class _CoreExport ObjectListElementRemovalListener
+ {
+ public:
+ virtual ~ObjectListElementRemovalListener() {}
+ virtual void removedElement(ObjectListBaseElement* element) = 0;
+ };
+
// ###############################
// ### ObjectListBase ###
// ###############################
@@ -96,61 +127,40 @@
ObjectListBase();
~ObjectListBase();
- template <class T>
- inline ObjectListBaseElement* add(T* object)
- { return this->addElement(new ObjectListElement<T>(object)); }
-
- ObjectListBaseElement* addElement(ObjectListBaseElement* element);
+ void addElement(ObjectListBaseElement* element);
void removeElement(ObjectListBaseElement* element);
- /// Helper struct, used to export an element and the list to an instance of Iterator.
- struct Export
- {
- Export(ObjectListBase* list, ObjectListBaseElement* element) : list_(list), element_(element) {}
- ObjectListBase* list_;
- ObjectListBaseElement* element_;
- };
+ size_t size() const { return this->size_; }
/// Returns a pointer to the first element in the list. Works only with Iterator.
- inline Export begin() { return ObjectListBase::Export(this, this->first_); }
+ inline ObjectListBaseElement* begin() const { return this->first_; }
/// Returns a pointer to the element after the last element in the list. Works only with Iterator.
- inline Export end() { return ObjectListBase::Export(this, 0); }
+ inline ObjectListBaseElement* end() const { return 0; }
/// Returns a pointer to the last element in the list. Works only with Iterator.
- inline Export rbegin() { return ObjectListBase::Export(this, this->last_); }
+ inline ObjectListBaseElement* rbegin() const { return this->last_; }
/// Returns a pointer to the element in front of the first element in the list. Works only with Iterator.
- inline Export rend() { return ObjectListBase::Export(this, 0); }
+ inline ObjectListBaseElement* rend() const { return 0; }
- inline void registerIterator(void* iterator) { this->iterators_.push_back(iterator); }
- inline void unregisterIterator(void* iterator)
+ inline void registerRemovalListener(ObjectListElementRemovalListener* listener) { this->listeners_.push_back(listener); }
+ inline void unregisterRemovalListener(ObjectListElementRemovalListener* listener)
{
- for (unsigned int i = 0; i < this->iterators_.size(); ++i)
+ for (unsigned int i = 0; i < this->listeners_.size(); ++i)
{
- if (iterators_[i] == iterator)
+ if (listeners_[i] == listener)
{
- iterators_.erase(iterators_.begin() + i);
+ listeners_.erase(listeners_.begin() + i);
break;
}
}
}
- inline void registerObjectListIterator(void* iterator) { this->objectListIterators_.push_back(iterator); }
- inline void unregisterObjectListIterator(void* iterator)
- {
- for (unsigned int i = 0; i < this->objectListIterators_.size(); ++i)
- {
- if (objectListIterators_[i] == iterator)
- {
- objectListIterators_.erase(objectListIterators_.begin() + i);
- break;
- }
- }
- }
- void notifyIterators(Listable* object) const;
private:
- ObjectListBaseElement* first_; //!< The first element in the list
- ObjectListBaseElement* last_; //!< The last element in the list
- std::vector<void*> iterators_; //!< A list of Iterators pointing on an element in this list
- std::vector<void*> objectListIterators_; //!< A list of ObjectListIterators pointing on an element in this list
+ void notifyRemovalListeners(ObjectListBaseElement* element) const;
+
+ ObjectListBaseElement* first_; //!< The first element in the list
+ ObjectListBaseElement* last_; //!< The last element in the list
+ size_t size_; //!< The number of elements in the list
+ std::vector<ObjectListElementRemovalListener*> listeners_; //!< A list of Iterators pointing on an element in this list
};
}
Modified: code/trunk/src/libraries/core/object/ObjectListIterator.h
===================================================================
--- code/branches/core6/src/libraries/core/object/ObjectListIterator.h 2013-03-27 22:17:45 UTC (rev 9593)
+++ code/trunk/src/libraries/core/object/ObjectListIterator.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -57,6 +57,7 @@
#include "core/CorePrereqs.h"
#include "core/class/Identifier.h"
#include "ObjectList.h"
+#include "IteratorBase.h"
namespace orxonox
{
@@ -66,118 +67,33 @@
@see See @ref ObjectListIteratorExample "ObjectListIterator.h" for more information an example.
*/
template <class T>
- class ObjectListIterator
+ class ObjectListIterator : public IteratorBase<T, ObjectListIterator<T> >
{
- template <class I>
- friend class Iterator;
-
public:
/**
@brief Constructor: Sets the element, whereon the ObjectListIterator points, to zero.
*/
- inline ObjectListIterator()
- {
- this->element_ = 0;
- ClassIdentifier<T>::getIdentifier()->getObjects()->registerObjectListIterator(this);
- }
+ inline ObjectListIterator() : IteratorBase<T, ObjectListIterator<T> >(NULL) {}
/**
@brief Constructor: Sets this element to a given element.
@param element The element to start with
*/
- inline ObjectListIterator(ObjectListElement<T>* element)
- {
- this->element_ = element;
- ClassIdentifier<T>::getIdentifier()->getObjects()->registerObjectListIterator(this);
- }
+ inline ObjectListIterator(ObjectListElement<T>* element) : IteratorBase<T, ObjectListIterator<T> >(element) {}
/**
@brief Constructor: Sets this element to the element of another ObjectListIterator.
@param other The other ObjectListIterator
*/
- inline ObjectListIterator(const ObjectListIterator<T>& other)
- {
- this->element_ = other.element_;
- ClassIdentifier<T>::getIdentifier()->getObjects()->registerObjectListIterator(this);
- }
+ inline ObjectListIterator(const IteratorBase<T, ObjectListIterator<T> >& other) : IteratorBase<T, ObjectListIterator<T> >(other) {}
/**
- @brief Unregisters the ObjectListIterator from the ObjectList.
- */
- inline ~ObjectListIterator()
- {
- ClassIdentifier<T>::getIdentifier()->getObjects()->unregisterObjectListIterator(this);
- }
-
- /**
- @brief Assigns an ObjectListElement.
- @param element The ObjectListElement
- */
- inline ObjectListIterator<T>& operator=(ObjectListElement<T>* element)
- {
- this->element_ = element;
- return (*this);
- }
-
- /**
- @brief Assigns the element of another ObjectListIterator.
- @param other The other ObjectListIterator
- */
- inline ObjectListIterator<T>& operator=(const ObjectListIterator<T>& other)
- {
- this->element_ = other.element_;
- return (*this);
- }
-
- /**
- @brief Overloading of the ++it operator: ObjectListIterator points to the next object in the list.
- @return The ObjectListIterator itself
- */
- inline const ObjectListIterator<T>& operator++()
- {
- this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_);
- return *this;
- }
-
- /**
- @brief Overloading of the it++ operator: ObjectListIterator points to the next object in the list.
- @return The ObjectListIterator itself
- */
- inline ObjectListIterator<T> operator++(int)
- {
- ObjectListIterator<T> copy = *this;
- this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_);
- return copy;
- }
-
- /**
- @brief Overloading of the --it operator: ObjectListIterator points to the previous object in the list.
- @return The ObjectListIterator itself
- */
- inline const ObjectListIterator<T>& operator--()
- {
- this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_);
- return *this;
- }
-
- /**
- @brief Overloading of the it-- operator: ObjectListIterator points to the previous object in the list.
- @return The ObjectListIterator itself
- */
- inline ObjectListIterator<T> operator--(int i)
- {
- ObjectListIterator<T> copy = *this;
- this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_);
- return copy;
- }
-
- /**
@brief Overloading of the *it operator: returns the pointer to the object.
@return The object the ObjectListIterator points at
*/
inline T* operator*() const
{
- return this->element_->object_;
+ return static_cast<ObjectListElement<T>*>(this->element_)->object_;
}
/**
@@ -186,50 +102,8 @@
*/
inline T* operator->() const
{
- return this->element_->object_;
+ return static_cast<ObjectListElement<T>*>(this->element_)->object_;
}
-
- /**
- @brief Overloading of the typecast-operator to bool: returns true if the ObjectListIterator points to an existing object.
- @return True if the ObjectListIterator points to an existing object.
- */
- inline operator bool() const
- {
- return (this->element_ != 0);
- }
-
- /**
- @brief Overloading of the == operator to compare with another ObjectListIterator.
- @param compare The other ObjectListIterator
- @return True if the ObjectListIterator point to the same element
- */
- inline bool operator==(const ObjectListIterator<T>& compare) const
- {
- return (this->element_ == compare.element_);
- }
-
- /**
- @brief Overloading of the != operator to compare with another ObjectListIterator.
- @param compare The other ObjectListIterator
- @return True if the ObjectListIterator point to different elements
- */
- inline bool operator!=(const ObjectListIterator<T>& compare) const
- {
- return (this->element_ != compare.element_);
- }
-
- /**
- @brief Increments the ObjectListIterator if it points at the given object.
- @param object The object to compare with
- */
- inline void incrementIfEqual(Listable* object)
- {
- if (this->element_ && this->element_->objectBase_ == object)
- this->operator++();
- }
-
- private:
- ObjectListElement<T>* element_; //!< The element the iterator points at
};
}
Modified: code/trunk/src/libraries/network/Client.cc
===================================================================
--- code/trunk/src/libraries/network/Client.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/Client.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -50,8 +50,8 @@
#include "packet/Gamestate.h"
#include "FunctionCallManager.h"
#include "core/CoreIncludes.h"
-#include "core/CommandLineParser.h"
#include "core/Game.h"
+#include "core/config/CommandLineParser.h"
namespace orxonox
{
Modified: code/trunk/src/libraries/network/ClientConnectionListener.cc
===================================================================
--- code/trunk/src/libraries/network/ClientConnectionListener.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/ClientConnectionListener.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,9 +34,11 @@
namespace orxonox
{
+ RegisterAbstractClass(ClientConnectionListener).inheritsFrom(Class(Listable));
+
ClientConnectionListener::ClientConnectionListener()
{
- RegisterRootObject(ClientConnectionListener);
+ RegisterObject(ClientConnectionListener);
}
void ClientConnectionListener::broadcastClientConnected(unsigned int clientID)
Modified: code/trunk/src/libraries/network/ClientConnectionListener.h
===================================================================
--- code/trunk/src/libraries/network/ClientConnectionListener.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/ClientConnectionListener.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -30,11 +30,11 @@
#define _ClientConnectionListener_H__
#include "NetworkPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/object/Listable.h"
namespace orxonox
{
- class _NetworkExport ClientConnectionListener : virtual public OrxonoxClass
+ class _NetworkExport ClientConnectionListener : virtual public Listable
{
public:
ClientConnectionListener();
Modified: code/trunk/src/libraries/network/Host.cc
===================================================================
--- code/trunk/src/libraries/network/Host.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/Host.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,7 +32,7 @@
#include <string>
#include "core/CoreIncludes.h"
-#include "core/ObjectList.h"
+#include "core/object/ObjectList.h"
#include "core/command/ConsoleCommand.h"
#include "NetworkChatListener.h"
@@ -144,7 +144,7 @@
NetworkChatListener::NetworkChatListener()
{
- RegisterRootObject(NetworkChatListener);
+ RegisterObject(NetworkChatListener);
}
}//namespace orxonox
Modified: code/trunk/src/libraries/network/NetworkChatListener.h
===================================================================
--- code/trunk/src/libraries/network/NetworkChatListener.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/NetworkChatListener.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -31,7 +31,7 @@
#include "NetworkPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/object/Listable.h"
namespace orxonox
{
@@ -42,7 +42,7 @@
This interface exists mostly to resolve circular dependencies between the chat functions
in Host and ChatManager. ChatManager is the main derivative of this interface.
*/
- class _NetworkExport NetworkChatListener : virtual public OrxonoxClass
+ class _NetworkExport NetworkChatListener : virtual public Listable
{
friend class Host;
Modified: code/trunk/src/libraries/network/NetworkFunction.cc
===================================================================
--- code/trunk/src/libraries/network/NetworkFunction.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/NetworkFunction.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,9 +36,14 @@
std::map<NetworkFunctionPointer, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::functorMap_;
std::map<uint32_t, NetworkMemberFunctionBase*> NetworkMemberFunctionBase::idMap_;
+ // no suitable factory for NetworkFunctionBase (and children), so we declare it abstract
+ RegisterAbstractClass(NetworkFunctionBase).inheritsFrom(Class(Listable));
+ RegisterAbstractClass(NetworkFunctionStatic).inheritsFrom(Class(NetworkFunctionBase));
+ RegisterAbstractClass(NetworkMemberFunctionBase).inheritsFrom(Class(NetworkFunctionBase));
+
NetworkFunctionBase::NetworkFunctionBase(const std::string& name)
{
- RegisterRootObject(NetworkFunctionBase);
+ RegisterObject(NetworkFunctionBase);
static uint32_t networkID = 0;
this->networkID_ = networkID++;
@@ -56,7 +61,7 @@
std::map<std::string, NetworkFunctionBase*>& map = NetworkFunctionBase::getNameMap();
std::map<std::string, NetworkFunctionBase*>::iterator it;
for( it=map.begin(); it!=map.end(); ++it )
- it->second->destroy();
+ delete it->second;
}
Modified: code/trunk/src/libraries/network/NetworkFunction.h
===================================================================
--- code/trunk/src/libraries/network/NetworkFunction.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/NetworkFunction.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,7 +38,8 @@
#include <boost/preprocessor/cat.hpp>
#include <boost/static_assert.hpp>
-#include "core/Identifier.h"
+#include "core/object/Listable.h"
+#include "core/class/Identifier.h"
#include "core/command/Functor.h"
#include "FunctionCallManager.h"
#include "synchronisable/Synchronisable.h"
@@ -69,7 +70,7 @@
-class _NetworkExport NetworkFunctionBase: virtual public OrxonoxClass {
+class _NetworkExport NetworkFunctionBase: virtual public Listable {
public:
NetworkFunctionBase(const std::string& name);
~NetworkFunctionBase();
Modified: code/trunk/src/libraries/network/Server.cc
===================================================================
--- code/trunk/src/libraries/network/Server.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/Server.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -47,7 +47,6 @@
#include "util/Clock.h"
#include "util/Output.h"
-#include "core/ObjectList.h"
#include "core/command/Executor.h"
#include "packet/Chat.h"
#include "packet/ClassID.h"
Modified: code/trunk/src/libraries/network/TrafficControl.cc
===================================================================
--- code/trunk/src/libraries/network/TrafficControl.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/TrafficControl.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,7 +32,7 @@
#include <boost/bind.hpp>
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "synchronisable/Synchronisable.h"
namespace orxonox {
Modified: code/trunk/src/libraries/network/WANDiscoverable.cc
===================================================================
--- code/trunk/src/libraries/network/WANDiscoverable.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/WANDiscoverable.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,7 +32,7 @@
#include <cstring>
#include "MasterServerProtocol.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/CoreIncludes.h"
Modified: code/trunk/src/libraries/network/WANDiscoverable.h
===================================================================
--- code/trunk/src/libraries/network/WANDiscoverable.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/WANDiscoverable.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -29,14 +29,13 @@
#define _WANDiscoverable_H__
#include "NetworkPrereqs.h"
-#include "core/OrxonoxClass.h"
-#include "core/CoreIncludes.h"
+#include "core/config/Configurable.h"
#include "MasterServerComm.h"
namespace orxonox
{
- class _NetworkExport WANDiscoverable: public OrxonoxClass
+ class _NetworkExport WANDiscoverable: public Configurable
{
public:
/** constructor */
Modified: code/trunk/src/libraries/network/WANDiscovery.h
===================================================================
--- code/trunk/src/libraries/network/WANDiscovery.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/WANDiscovery.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -30,10 +30,8 @@
#include "NetworkPrereqs.h"
#include "packet/ServerInformation.h"
-#include "core/ConfigFileManager.h"
-#include "core/OrxonoxClass.h"
-#include "core/ConfigValueIncludes.h"
-#include "core/CoreIncludes.h"
+#include "core/config/Configurable.h"
+#include "core/config/ConfigValueIncludes.h"
#include "MasterServerComm.h"
#include "MasterServerProtocol.h"
@@ -47,7 +45,7 @@
class _NetworkExport WANDiscovery
// tolua_end
- : public OrxonoxClass
+ : public Configurable
{ // tolua_export
public:
/** constructor */
Modified: code/trunk/src/libraries/network/packet/ClassID.cc
===================================================================
--- code/trunk/src/libraries/network/packet/ClassID.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/packet/ClassID.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -54,8 +54,8 @@
std::queue<std::pair<uint32_t, std::string> > tempQueue;
//calculate total needed size (for all strings and integers)
- std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMapBegin();
- for(;it != Identifier::getStringIdentifierMapEnd();++it){
+ std::map<std::string, Identifier*>::const_iterator it = IdentifierManager::getInstance().getIdentifierByStringMap().begin();
+ for(;it != IdentifierManager::getInstance().getIdentifierByStringMap().end();++it){
id = it->second;
if(id == NULL || !id->hasFactory())
continue;
@@ -128,7 +128,7 @@
//clear the map of network ids
- Identifier::clearNetworkIDs();
+ IdentifierManager::getInstance().clearNetworkIDs();
orxout(verbose, context::packets) << "=== processing classids: " << endl;
std::pair<uint32_t, std::string> tempPair;
Modified: code/trunk/src/libraries/network/packet/FunctionIDs.cc
===================================================================
--- code/trunk/src/libraries/network/packet/FunctionIDs.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/packet/FunctionIDs.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,7 +34,7 @@
#include <string>
#include "util/Output.h"
-#include "core/ObjectList.h"
+#include "core/object/ObjectList.h"
#include "network/NetworkFunction.h"
namespace orxonox {
Modified: code/trunk/src/libraries/network/packet/Gamestate.cc
===================================================================
--- code/trunk/src/libraries/network/packet/Gamestate.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/packet/Gamestate.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,8 +32,9 @@
#include "util/Output.h"
#include "util/OrxAssert.h"
+#include "core/CoreIncludes.h"
#include "core/GameMode.h"
-#include "core/ObjectList.h"
+#include "core/object/ObjectList.h"
#include "network/synchronisable/Synchronisable.h"
#include "network/GamestateHandler.h"
#include "network/Host.h"
@@ -131,7 +132,7 @@
tempsize = it->getData(mem, this->sizes_, id, mode);
if ( tempsize != 0 )
- dataVector_.push_back( obj(it->getObjectID(), it->getCreatorID(), tempsize, mem-data_) );
+ dataVector_.push_back( obj(it->getObjectID(), it->getContextID(), tempsize, mem-data_) );
#ifndef NDEBUG
if(currentsize+tempsize > size)
@@ -467,7 +468,7 @@
if ( htemp.getObjectID() == objectID )
{
assert( objectHeader.getClassID() == htemp.getClassID() );
- assert( objectHeader.getCreatorID() == htemp.getCreatorID() );
+ assert( objectHeader.getContextID() == htemp.getContextID() );
return true;
}
{
Modified: code/trunk/src/libraries/network/synchronisable/Serialise.h
===================================================================
--- code/trunk/src/libraries/network/synchronisable/Serialise.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/synchronisable/Serialise.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,9 +40,6 @@
#include "util/Serialise.h"
#include "core/CorePrereqs.h"
-#include "core/CoreIncludes.h"
-#include "core/BaseObject.h" // remove this if circular dependencies in BaseObject/SmartPtr are fixed
-//#include "core/SmartPtr.h"
namespace orxonox{
Modified: code/trunk/src/libraries/network/synchronisable/Synchronisable.cc
===================================================================
--- code/trunk/src/libraries/network/synchronisable/Synchronisable.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/synchronisable/Synchronisable.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,13 +44,15 @@
uint8_t Synchronisable::state_=0x1; // detemines wheter we are server (default) or client
+ RegisterAbstractClass(Synchronisable).inheritsFrom(Class(OrxonoxInterface));
+
/**
* Constructor:
* Initializes all Variables and sets the right objectID_
*/
- Synchronisable::Synchronisable(BaseObject* creator )
+ Synchronisable::Synchronisable(Context* context)
{
- RegisterRootObject(Synchronisable);
+ RegisterObject(Synchronisable);
static uint32_t idCounter=0;
objectMode_=0x1; // by default do not send data to server
if ( GameMode::isMaster()/* || ( Host::running() && Host::isServer() )*/ )
@@ -68,11 +70,8 @@
// set standard priority
this->setPriority( Priority::Normal );
- // get creator id
- if( creator )
- this->creatorID_ = creator->getSceneID();
- else
- this->creatorID_ = OBJECTID_UNKNOWN;
+ // get context id
+ this->contextID_ = this->findContextID(context);
}
/**
@@ -82,7 +81,7 @@
Synchronisable::~Synchronisable()
{
// delete callback function objects
- if(!Identifier::isCreatingHierarchy()){
+ if(!IdentifierManager::getInstance().isCreatingHierarchy()){
// remove object from the static objectMap
if (this->objectMode_ != 0x0 && (Host::running() && Host::isServer()))
deletedObjects_.push(objectID_);
@@ -99,7 +98,22 @@
}
+ /**
+ * @brief Returns the id of the context.
+ * If the context is not Synchronisable, it moves on to its parent, recursively.
+ */
+ uint32_t Synchronisable::findContextID(Context* context)
+ {
+ if (context == NULL)
+ return OBJECTID_UNKNOWN;
+ Synchronisable* synchronisableContext = orxonox_cast<Synchronisable*>(context);
+ if (synchronisableContext != NULL)
+ return synchronisableContext->getObjectID();
+ else
+ return this->findContextID(context->getParentContext());
+ }
+
/**
* This function sets the internal mode for synchronisation
* @param b true if this object is located on a client or on a server
@@ -141,31 +155,38 @@
abort();
}
assert(id);
- BaseObject* creator = 0;
- if (header.getCreatorID() != OBJECTID_UNKNOWN)
+ Context* context = 0;
+ if (header.getContextID() != OBJECTID_UNKNOWN)
{
- Synchronisable* synchronisable_creator = Synchronisable::getSynchronisable(header.getCreatorID());
- if (!synchronisable_creator)
+ Synchronisable* synchronisable_context = Synchronisable::getSynchronisable(header.getContextID());
+ if (!synchronisable_context)
{
mem += header.getDataSize()+SynchronisableHeader::getSize(); //.TODO: this suckz.... remove size from header
assert(0); // TODO: uncomment this if we have a clean objecthierarchy (with destruction of children of objects) ^^
return 0;
}
else
- creator = orxonox_cast<BaseObject*>(synchronisable_creator);
+ context = orxonox_cast<Context*>(synchronisable_context);
}
+ else
+ context = Context::getRootContext();
+
assert(getSynchronisable(header.getObjectID())==0); //make sure no object with this id exists
- BaseObject *bo = id->fabricate(creator);
+ BaseObject *bo = orxonox_cast<BaseObject*>(id->fabricate(context));
assert(bo);
Synchronisable *no = orxonox_cast<Synchronisable*>(bo);
assert(no);
assert( Synchronisable::objectMap_.find(header.getObjectID()) == Synchronisable::objectMap_.end() );
no->setObjectID(header.getObjectID());
- //no->creatorID=header.getCreatorID(); //TODO: remove this
+ //no->contextID=header.getContextID(); //TODO: remove this
no->setClassID(header.getClassID());
- assert(no->creatorID_ == header.getCreatorID());
- if( creator )
- bo->setLevel(creator->getLevel()); // Note: this ensures that the level is known on the client for child objects of the scene (and the scene itself)
+ assert(no->contextID_ == header.getContextID());
+ if( context )
+ {
+ BaseObject* boContext = orxonox_cast<BaseObject*>(context);
+ if (boContext)
+ bo->setLevel(boContext->getLevel()); // Note: this ensures that the level is known on the client for child objects of the scene (and the scene itself)
+ }
//assert(no->classID_ == header.getClassID());
orxout(verbose, context::network) << "fabricate objectID_: " << no->objectID_ << " classID_: " << no->classID_ << endl;
// update data and create object/entity...
@@ -273,7 +294,7 @@
// orxout(verbose, context::network) << endl;
header.setObjectID( this->objectID_ );
- header.setCreatorID( this->creatorID_ );
+ header.setContextID( this->contextID_ );
header.setClassID( this->classID_ );
header.setDataSize( tempsize );
assert( tempsize == mem-oldmem-SynchronisableHeader::getSize() );
@@ -330,7 +351,7 @@
{
SynchronisableHeader syncHeader2(mem);
assert( this->getClassID() == syncHeader2.getClassID() );
- assert( this->getCreatorID() == syncHeader2.getCreatorID() );
+ assert( this->getContextID() == syncHeader2.getContextID() );
mem += SynchronisableHeader::getSize();
std::vector<SynchronisableVariableBase *>::iterator i;
for(i=syncList_.begin(); i!=syncList_.end(); ++i)
Modified: code/trunk/src/libraries/network/synchronisable/Synchronisable.h
===================================================================
--- code/trunk/src/libraries/network/synchronisable/Synchronisable.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/network/synchronisable/Synchronisable.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,8 @@
#include <set>
#include "util/mbool.h"
-#include "core/OrxonoxClass.h"
+#include "util/Output.h"
+#include "core/class/OrxonoxInterface.h"
#include "SynchronisableVariable.h"
#include "NetworkCallback.h"
@@ -105,13 +106,13 @@
/**
* @brief: stores information about a Synchronisable
*
- * This class stores the information about a Synchronisable (objectID_, classID_, creatorID_, dataSize)
+ * This class stores the information about a Synchronisable (objectID_, classID_, contextID_, dataSize)
* in an emulated bitset.
* Bit 1 to 31 store the size of the Data the synchronisable consumes in the stream
* Bit 32 is a bool and defines whether the variables are stored in diff mode
* Byte 5 to 8: objectID_
* Byte 9 to 12: classID_
- * Byte 13 to 16: creatorID_
+ * Byte 13 to 16: contextID_
*/
class _NetworkExport SynchronisableHeader: public SynchronisableHeaderLight
{
@@ -124,10 +125,10 @@
{ return *(uint32_t*)(data_+SynchronisableHeaderLight::getSize()); }
inline void setClassID(uint32_t classID_)
{ *(uint32_t*)(data_+SynchronisableHeaderLight::getSize()) = classID_; }
- inline uint32_t getCreatorID() const
+ inline uint32_t getContextID() const
{ return *(uint32_t*)(data_+SynchronisableHeaderLight::getSize()+4); }
- inline void setCreatorID(uint32_t creatorID_)
- { *(uint32_t*)(data_+SynchronisableHeaderLight::getSize()+4) = creatorID_; }
+ inline void setContextID(uint32_t contextID_)
+ { *(uint32_t*)(data_+SynchronisableHeaderLight::getSize()+4) = contextID_; }
inline void operator=(SynchronisableHeader& h)
{ memcpy(data_, h.data_, getSize()); }
};
@@ -142,7 +143,7 @@
* Every class, that inherits from this class has to link the DATA THAT NEEDS TO BE SYNCHRONISED into the linked list.
* @author Oliver Scheuss
*/
- class _NetworkExport Synchronisable : virtual public OrxonoxClass{
+ class _NetworkExport Synchronisable : virtual public OrxonoxInterface {
public:
friend class packet::Gamestate;
virtual ~Synchronisable();
@@ -156,7 +157,7 @@
static uint32_t popDeletedObject(){ uint32_t i = deletedObjects_.front(); deletedObjects_.pop(); return i; }
inline uint32_t getObjectID() const {return this->objectID_;}
- inline unsigned int getCreatorID() const {return this->creatorID_;}
+ inline unsigned int getContextID() const {return this->contextID_;}
inline uint32_t getClassID() const {return this->classID_;}
inline unsigned int getPriority() const { return this->objectFrequency_;}
inline uint8_t getSyncMode() const { return this->objectMode_; }
@@ -168,14 +169,14 @@
{ return this->syncList_[ID]->getSize(state_); }
protected:
- Synchronisable(BaseObject* creator);
+ Synchronisable(Context* context);
template <class T> void registerVariable(T& variable, uint8_t mode=0x1, NetworkCallbackBase *cb=0, bool bidirectional=false);
template <class T> void registerVariable(std::set<T>& variable, uint8_t mode=0x1, NetworkCallbackBase *cb=0, bool bidirectional=false);
template <class T> void unregisterVariable(T& var);
void setPriority(unsigned int freq){ objectFrequency_ = freq; }
+ uint32_t findContextID(Context* context);
-
private:
uint32_t getData(uint8_t*& mem, std::vector<uint32_t>& sizes, int32_t id, uint8_t mode);
uint32_t getSize(int32_t id, uint8_t mode=0x0);
@@ -187,7 +188,7 @@
inline void setClassID(uint32_t id){ this->classID_ = id; }
uint32_t objectID_;
- uint32_t creatorID_;
+ uint32_t contextID_;
uint32_t classID_;
std::vector<SynchronisableVariableBase*> syncList_;
Modified: code/trunk/src/libraries/tools/ParticleInterface.cc
===================================================================
--- code/trunk/src/libraries/tools/ParticleInterface.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/tools/ParticleInterface.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,7 +42,7 @@
#include "util/Convert.h"
#include "util/Math.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/GameMode.h"
namespace orxonox
Modified: code/trunk/src/libraries/tools/ResourceCollection.cc
===================================================================
--- code/trunk/src/libraries/tools/ResourceCollection.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/tools/ResourceCollection.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,10 +36,10 @@
namespace orxonox
{
- CreateFactory(ResourceCollection);
+ RegisterClass(ResourceCollection);
- ResourceCollection::ResourceCollection(BaseObject* creator)
- : BaseObject(creator)
+ ResourceCollection::ResourceCollection(Context* context)
+ : BaseObject(context)
{
RegisterObject(ResourceCollection);
Modified: code/trunk/src/libraries/tools/ResourceCollection.h
===================================================================
--- code/trunk/src/libraries/tools/ResourceCollection.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/tools/ResourceCollection.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _ToolsExport ResourceCollection : public BaseObject
{
public:
- ResourceCollection(BaseObject* creator);
+ ResourceCollection(Context* context);
virtual ~ResourceCollection();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/libraries/tools/ResourceLocation.cc
===================================================================
--- code/trunk/src/libraries/tools/ResourceLocation.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/tools/ResourceLocation.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,10 +40,10 @@
namespace orxonox
{
- CreateFactory(ResourceLocation);
+ RegisterClass(ResourceLocation);
- ResourceLocation::ResourceLocation(BaseObject* creator)
- : BaseObject(creator)
+ ResourceLocation::ResourceLocation(Context* context)
+ : BaseObject(context)
{
RegisterObject(ResourceLocation);
Modified: code/trunk/src/libraries/tools/ResourceLocation.h
===================================================================
--- code/trunk/src/libraries/tools/ResourceLocation.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/tools/ResourceLocation.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,7 +42,7 @@
friend class ResourceCollection;
public:
- ResourceLocation(BaseObject* creator);
+ ResourceLocation(Context* context);
virtual ~ResourceLocation();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/libraries/tools/Shader.cc
===================================================================
--- code/trunk/src/libraries/tools/Shader.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/tools/Shader.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,6 +38,8 @@
namespace orxonox
{
+ RegisterClassNoArgs(Shader);
+
/**
@brief Initializes the values and sets the scene manager.
*/
Modified: code/trunk/src/libraries/tools/Timer.cc
===================================================================
--- code/trunk/src/libraries/tools/Timer.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/tools/Timer.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -131,13 +131,15 @@
}
}
+ RegisterClassNoArgs(Timer);
+
/**
@brief Constructor: Sets the default-values.
*/
Timer::Timer()
{
this->init();
- RegisterRootObject(Timer);
+ RegisterObject(Timer);
}
/**
@@ -150,7 +152,7 @@
Timer::Timer(float interval, bool bLoop, const ExecutorPtr& executor, bool bKillAfterCall)
{
this->init();
- RegisterRootObject(Timer);
+ RegisterObject(Timer);
this->setTimer(interval, bLoop, executor, bKillAfterCall);
}
Modified: code/trunk/src/libraries/tools/Timer.h
===================================================================
--- code/trunk/src/libraries/tools/Timer.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/tools/Timer.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -78,7 +78,7 @@
#include "tools/ToolsPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxClass.h"
#include "core/command/ExecutorPtr.h"
namespace orxonox
@@ -101,7 +101,7 @@
slower/faster if the game-speed is modified. See RealTimer for a timer class which doesn't depend
on the game time.
*/
- class _ToolsExport Timer : virtual public OrxonoxClass
+ class _ToolsExport Timer : public OrxonoxClass
{
public:
Timer();
Modified: code/trunk/src/libraries/tools/interfaces/Tickable.h
===================================================================
--- code/trunk/src/libraries/tools/interfaces/Tickable.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/tools/interfaces/Tickable.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,13 +43,13 @@
#include "tools/ToolsPrereqs.h"
-#include "core/OrxonoxClass.h"
-#include "core/Super.h"
+#include "core/class/OrxonoxInterface.h"
+#include "core/class/Super.h"
namespace orxonox
{
//! The Tickable interface provides a tick(dt) function, that gets called every frame.
- class _ToolsExport Tickable : virtual public OrxonoxClass
+ class _ToolsExport Tickable : virtual public OrxonoxInterface
{
public:
/**
Modified: code/trunk/src/libraries/tools/interfaces/TimeFactorListener.h
===================================================================
--- code/trunk/src/libraries/tools/interfaces/TimeFactorListener.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/tools/interfaces/TimeFactorListener.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -30,11 +30,11 @@
#define _TimeFactorListener_H__
#include "tools/ToolsPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/object/Listable.h"
namespace orxonox
{
- class _ToolsExport TimeFactorListener : virtual public OrxonoxClass
+ class _ToolsExport TimeFactorListener : virtual public Listable
{
public:
TimeFactorListener();
Modified: code/trunk/src/libraries/tools/interfaces/ToolsInterfaceCompilation.cc
===================================================================
--- code/trunk/src/libraries/tools/interfaces/ToolsInterfaceCompilation.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/tools/interfaces/ToolsInterfaceCompilation.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -45,9 +45,11 @@
//----------------------------
float TimeFactorListener::timefactor_s = 1.0f;
+ RegisterAbstractClass(TimeFactorListener).inheritsFrom(Class(Listable));
+
TimeFactorListener::TimeFactorListener()
{
- RegisterRootObject(TimeFactorListener);
+ RegisterObject(TimeFactorListener);
}
/*static*/ void TimeFactorListener::setTimeFactor(float factor)
@@ -64,11 +66,13 @@
//----------------------------
// Tickable
//----------------------------
+ RegisterAbstractClass(Tickable).inheritsFrom(Class(OrxonoxInterface));
+
/**
@brief Constructor: Registers the object in the Tickable-list
*/
Tickable::Tickable()
{
- RegisterRootObject(Tickable);
+ RegisterObject(Tickable);
}
}
Modified: code/trunk/src/libraries/util/ScopedSingletonManager.h
===================================================================
--- code/trunk/src/libraries/util/ScopedSingletonManager.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/libraries/util/ScopedSingletonManager.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -67,7 +67,7 @@
namespace orxonox
{
- class OrxonoxClass;
+ class Destroyable;
/**
@brief Base class of ClassScopedSingletonManager, implements some static functions
@@ -165,8 +165,8 @@
singletonPtr_ = NULL;
}
- //! Destroys the singleton instance - overloaded for OrxonoxClass, calls OrxonoxClass::destroy()
- void destroy(OrxonoxClass*)
+ //! Destroys the singleton instance - overloaded for Destroyable, calls Destroyable::destroy()
+ void destroy(Destroyable*)
{
singletonPtr_->destroy();
}
@@ -245,8 +245,8 @@
}
}
- //! Destroys the singleton instance - overloaded for OrxonoxClass, calls OrxonoxClass::destroy()
- void destroy(OrxonoxClass*)
+ //! Destroys the singleton instance - overloaded for Destroyable, calls Destroyable::destroy()
+ void destroy(Destroyable*)
{
singletonPtr_->destroy();
}
Modified: code/trunk/src/modules/designtools/CreateStars.cc
===================================================================
--- code/trunk/src/modules/designtools/CreateStars.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/designtools/CreateStars.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,9 +36,9 @@
namespace orxonox
{
- CreateFactory(CreateStars);
+ RegisterClass(CreateStars);
- CreateStars::CreateStars(BaseObject* creator) : BaseObject(creator)
+ CreateStars::CreateStars(Context* context) : BaseObject(context)
{
RegisterObject(CreateStars);
this->material_ = "Examples/Flare";
@@ -68,7 +68,7 @@
for(int i=0; i < numStars_; i++)
{
- Billboard* bb = new Billboard(this);
+ Billboard* bb = new Billboard(this->getContext());
float r = rnd(-colourDiff_,colourDiff_);
float g = rnd(-colourDiff_,colourDiff_);
Modified: code/trunk/src/modules/designtools/CreateStars.h
===================================================================
--- code/trunk/src/modules/designtools/CreateStars.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/designtools/CreateStars.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,7 +37,7 @@
class CreateStars : public BaseObject
{
public:
- CreateStars(orxonox::BaseObject* creator);
+ CreateStars(Context* context);
virtual ~CreateStars();
void createBillboards();
Modified: code/trunk/src/modules/designtools/ScreenshotManager.cc
===================================================================
--- code/trunk/src/modules/designtools/ScreenshotManager.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/designtools/ScreenshotManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,7 +41,8 @@
#include <OgreRoot.h>
#include <OgreViewport.h>
-#include "core/ConfigValueIncludes.h"
+#include "core/CoreIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/GraphicsManager.h"
#include "core/PathConfig.h"
#include "core/Resource.h"
@@ -67,7 +68,7 @@
*/
ScreenshotManager::ScreenshotManager() : finalPicturePB_(NULL), data_(NULL)
{
- RegisterRootObject(ScreenshotManager);
+ RegisterObject(ScreenshotManager);
this->setConfigValues();
Modified: code/trunk/src/modules/designtools/ScreenshotManager.h
===================================================================
--- code/trunk/src/modules/designtools/ScreenshotManager.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/designtools/ScreenshotManager.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,7 +43,7 @@
#include <OgreHardwarePixelBuffer.h>
#include "util/Singleton.h"
-#include "core/OrxonoxClass.h"
+#include "core/config/Configurable.h"
namespace orxonox
{
@@ -60,7 +60,7 @@
Damian 'Mozork' Frick
@ingroup Designtools
*/
- class ScreenshotManager : public OrxonoxClass, public Singleton<ScreenshotManager>
+ class ScreenshotManager : public Configurable, public Singleton<ScreenshotManager>
{
friend class Singleton<ScreenshotManager>;
Modified: code/trunk/src/modules/designtools/SkyboxGenerator.cc
===================================================================
--- code/trunk/src/modules/designtools/SkyboxGenerator.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/designtools/SkyboxGenerator.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
#include "util/ScopedSingletonManager.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/GraphicsManager.h"
#include "core/PathConfig.h"
#include "core/Resource.h"
@@ -67,7 +67,7 @@
*/
SkyboxGenerator::SkyboxGenerator()
{
- RegisterRootObject(SkyboxGenerator);
+ RegisterObject(SkyboxGenerator);
this->setConfigValues();
Modified: code/trunk/src/modules/designtools/SkyboxGenerator.h
===================================================================
--- code/trunk/src/modules/designtools/SkyboxGenerator.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/designtools/SkyboxGenerator.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,7 +35,7 @@
#ifndef __SkyboxGenerator_h__
#define __SkyboxGenerator_h__
-#include "core/OrxonoxClass.h"
+#include "core/config/Configurable.h"
#include "util/Singleton.h"
#include "tools/interfaces/Tickable.h"
@@ -57,7 +57,7 @@
Damian 'Mozork' Frick
@ingroup Designtools
*/
- class SkyboxGenerator : public virtual OrxonoxClass, public Singleton<SkyboxGenerator>, public Tickable
+ class SkyboxGenerator : public virtual Configurable, public Singleton<SkyboxGenerator>, public Tickable
{
friend class Singleton<SkyboxGenerator>;
@@ -118,4 +118,4 @@
};
}
-#endif // __SkyboxGenerator_h__
\ No newline at end of file
+#endif // __SkyboxGenerator_h__
Modified: code/trunk/src/modules/docking/Dock.cc
===================================================================
--- code/trunk/src/modules/docking/Dock.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/docking/Dock.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -45,14 +45,14 @@
namespace orxonox
{
- CreateFactory(Dock);
+ RegisterClass(Dock);
SetConsoleCommand("Dock", "dock", &Dock::cmdDock).addShortcut().setAsInputCommand();
SetConsoleCommand("Dock", "undock", &Dock::cmdUndock).addShortcut().setAsInputCommand();
registerStaticNetworkFunction(Dock::showDockingDialog);
- Dock::Dock(BaseObject* creator) : StaticEntity(creator)
+ Dock::Dock(Context* context) : StaticEntity(context)
{
RegisterObject(Dock);
}
Modified: code/trunk/src/modules/docking/Dock.h
===================================================================
--- code/trunk/src/modules/docking/Dock.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/docking/Dock.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,6 @@
#include <set>
-#include "core/CoreIncludes.h"
#include "core/EventIncludes.h"
#include "core/XMLPort.h"
@@ -57,7 +56,7 @@
: public StaticEntity
{ // tolua_export
public:
- Dock(BaseObject* creator);
+ Dock(Context* context);
virtual ~Dock();
// Trigger interface
Modified: code/trunk/src/modules/docking/DockToShip.cc
===================================================================
--- code/trunk/src/modules/docking/DockToShip.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/docking/DockToShip.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,9 +37,9 @@
namespace orxonox
{
- CreateFactory(DockToShip);
+ RegisterClass(DockToShip);
- DockToShip::DockToShip(BaseObject* creator) : DockingEffect(creator)
+ DockToShip::DockToShip(Context* context) : DockingEffect(context)
{
RegisterObject(DockToShip);
orxout(verbose, context::docking) << "DockToShip instance created.." << endl;
Modified: code/trunk/src/modules/docking/DockToShip.h
===================================================================
--- code/trunk/src/modules/docking/DockToShip.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/docking/DockToShip.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -56,7 +56,7 @@
class _DockingExport DockToShip : public DockingEffect
{
public:
- DockToShip(BaseObject* creator);
+ DockToShip(Context* context);
virtual ~DockToShip();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/docking/DockingAnimation.cc
===================================================================
--- code/trunk/src/modules/docking/DockingAnimation.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/docking/DockingAnimation.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,10 +34,13 @@
#include "DockingAnimation.h"
#include "DockingEffect.h" // For DockingEffect::findTarget
+#include "core/CoreIncludes.h"
namespace orxonox
{
- DockingAnimation::DockingAnimation(BaseObject* creator) : BaseObject(creator)
+ RegisterAbstractClass(DockingAnimation).inheritsFrom(Class(BaseObject));
+
+ DockingAnimation::DockingAnimation(Context* context) : BaseObject(context)
{
RegisterObject(DockingAnimation);
Modified: code/trunk/src/modules/docking/DockingAnimation.h
===================================================================
--- code/trunk/src/modules/docking/DockingAnimation.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/docking/DockingAnimation.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,7 +35,6 @@
#ifndef _DockingAnimation_H__
#define _DockingAnimation_H__
-#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
#include "infos/PlayerInfo.h"
@@ -63,7 +62,7 @@
class _DockingExport DockingAnimation : public BaseObject
{
public:
- DockingAnimation(BaseObject* creator);
+ DockingAnimation(Context* context);
virtual ~DockingAnimation();
virtual bool docking(PlayerInfo* player) = 0; //!< Called when a player starts docking
Modified: code/trunk/src/modules/docking/DockingController.cc
===================================================================
--- code/trunk/src/modules/docking/DockingController.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/docking/DockingController.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,12 +33,13 @@
#include "infos/PlayerInfo.h"
#include "worldentities/ControllableEntity.h"
#include "Dock.h"
+#include "core/CoreIncludes.h"
namespace orxonox
{
- CreateFactory(DockingController);
+ RegisterClass(DockingController);
- DockingController::DockingController(BaseObject* creator) : ArtificialController(creator)
+ DockingController::DockingController(Context* context) : ArtificialController(context)
{
RegisterObject(DockingController);
Modified: code/trunk/src/modules/docking/DockingController.h
===================================================================
--- code/trunk/src/modules/docking/DockingController.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/docking/DockingController.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,7 +41,7 @@
class _DockingExport DockingController : public ArtificialController, public Tickable
{
public:
- DockingController(BaseObject* creator);
+ DockingController(Context* context);
virtual ~DockingController();
virtual void tick(float dt);
Modified: code/trunk/src/modules/docking/DockingEffect.cc
===================================================================
--- code/trunk/src/modules/docking/DockingEffect.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/docking/DockingEffect.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,10 +32,13 @@
*/
#include "DockingEffect.h"
+#include "core/CoreIncludes.h"
namespace orxonox
{
- DockingEffect::DockingEffect(BaseObject* creator) : BaseObject(creator)
+ RegisterAbstractClass(DockingEffect).inheritsFrom(Class(BaseObject));
+
+ DockingEffect::DockingEffect(Context* context) : BaseObject(context)
{
RegisterObject(DockingEffect);
}
Modified: code/trunk/src/modules/docking/DockingEffect.h
===================================================================
--- code/trunk/src/modules/docking/DockingEffect.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/docking/DockingEffect.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,7 +35,6 @@
#ifndef _DockingEffect_H__
#define _DockingEffect_H__
-#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
#include "infos/PlayerInfo.h"
@@ -61,7 +60,7 @@
class _DockingExport DockingEffect : public BaseObject
{
public:
- DockingEffect(BaseObject* creator);
+ DockingEffect(Context* context);
virtual ~DockingEffect();
virtual bool docking(PlayerInfo* player) = 0; //!< Called when player docked
Modified: code/trunk/src/modules/docking/DockingPrecompiledHeaders.h
===================================================================
--- code/trunk/src/modules/docking/DockingPrecompiledHeaders.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/docking/DockingPrecompiledHeaders.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,7 +44,6 @@
///////////////////////////////////////////
#include "core/BaseObject.h"
-#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
Modified: code/trunk/src/modules/docking/DockingTarget.cc
===================================================================
--- code/trunk/src/modules/docking/DockingTarget.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/docking/DockingTarget.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,14 +32,15 @@
*/
#include "DockingTarget.h"
+#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
namespace orxonox
{
- CreateFactory(DockingTarget);
+ RegisterClass(DockingTarget);
- DockingTarget::DockingTarget(BaseObject* creator) : StaticEntity(creator)
+ DockingTarget::DockingTarget(Context* context) : StaticEntity(context)
{
RegisterObject(DockingTarget);
}
Modified: code/trunk/src/modules/docking/DockingTarget.h
===================================================================
--- code/trunk/src/modules/docking/DockingTarget.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/docking/DockingTarget.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -54,7 +54,7 @@
class _DockingExport DockingTarget : public StaticEntity
{
public:
- DockingTarget(BaseObject* creator);
+ DockingTarget(Context* context);
virtual ~DockingTarget();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/docking/MoveToDockingTarget.cc
===================================================================
--- code/trunk/src/modules/docking/MoveToDockingTarget.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/docking/MoveToDockingTarget.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,12 +35,13 @@
#include "MoveToDockingTarget.h"
#include "core/XMLPort.h"
+#include "core/CoreIncludes.h"
namespace orxonox
{
- CreateFactory(MoveToDockingTarget);
+ RegisterClass(MoveToDockingTarget);
- MoveToDockingTarget::MoveToDockingTarget(BaseObject *creator) : DockingAnimation(creator)
+ MoveToDockingTarget::MoveToDockingTarget(Context* context) : DockingAnimation(context)
{
RegisterObject(MoveToDockingTarget);
}
@@ -53,7 +54,7 @@
{
assert(this->parent_);
- DockingController *dockingController = new DockingController(this);
+ DockingController *dockingController = new DockingController(this->getContext());
dockingController->setDock(this->parent_);
dockingController->setPlayer(player);
dockingController->takeControl(true);
Modified: code/trunk/src/modules/docking/MoveToDockingTarget.h
===================================================================
--- code/trunk/src/modules/docking/MoveToDockingTarget.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/docking/MoveToDockingTarget.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -55,7 +55,7 @@
class _DockingExport MoveToDockingTarget : public DockingAnimation
{
public:
- MoveToDockingTarget(BaseObject* creator);
+ MoveToDockingTarget(Context* context);
virtual ~MoveToDockingTarget();
virtual bool docking(PlayerInfo* player); //!< Called when a player starts docking
Modified: code/trunk/src/modules/gametypes/OldRaceCheckPoint.cc
===================================================================
--- code/trunk/src/modules/gametypes/OldRaceCheckPoint.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/gametypes/OldRaceCheckPoint.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,9 +37,9 @@
namespace orxonox
{
- CreateFactory(OldRaceCheckPoint);
+ RegisterClass(OldRaceCheckPoint);
- OldRaceCheckPoint::OldRaceCheckPoint(BaseObject* creator): DistanceTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
+ OldRaceCheckPoint::OldRaceCheckPoint(Context* context): DistanceTrigger(context), RadarViewable(this, static_cast<WorldEntity*>(this))
{
RegisterObject(OldRaceCheckPoint);
Modified: code/trunk/src/modules/gametypes/OldRaceCheckPoint.h
===================================================================
--- code/trunk/src/modules/gametypes/OldRaceCheckPoint.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/gametypes/OldRaceCheckPoint.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,7 +44,7 @@
class _GametypesExport OldRaceCheckPoint : public DistanceTrigger, public RadarViewable
{
public:
- OldRaceCheckPoint(BaseObject* creator);
+ OldRaceCheckPoint(Context* context);
virtual ~OldRaceCheckPoint();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/gametypes/OldSpaceRace.cc
===================================================================
--- code/trunk/src/modules/gametypes/OldSpaceRace.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/gametypes/OldSpaceRace.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,9 +35,9 @@
namespace orxonox
{
- CreateUnloadableFactory(OldSpaceRace);
+ RegisterUnloadableClass(OldSpaceRace);
- OldSpaceRace::OldSpaceRace(BaseObject* creator) : Gametype(creator)
+ OldSpaceRace::OldSpaceRace(Context* context) : Gametype(context)
{
RegisterObject(OldSpaceRace);
this->checkpointsReached_ = 0;
Modified: code/trunk/src/modules/gametypes/OldSpaceRace.h
===================================================================
--- code/trunk/src/modules/gametypes/OldSpaceRace.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/gametypes/OldSpaceRace.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -51,7 +51,7 @@
friend class OldRaceCheckPoint;
public:
- OldSpaceRace(BaseObject* creator);
+ OldSpaceRace(Context* context);
virtual ~OldSpaceRace() {}
virtual void start();
Modified: code/trunk/src/modules/gametypes/RaceCheckPoint.cc
===================================================================
--- code/trunk/src/modules/gametypes/RaceCheckPoint.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/gametypes/RaceCheckPoint.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,10 +40,10 @@
namespace orxonox
{
- CreateFactory(RaceCheckPoint);
+ RegisterClass(RaceCheckPoint);
- RaceCheckPoint::RaceCheckPoint(BaseObject* creator) : DistanceMultiTrigger(creator),
- RadarViewable(creator, static_cast<WorldEntity*> (this))
+ RaceCheckPoint::RaceCheckPoint(Context* context) : DistanceMultiTrigger(context),
+ RadarViewable(this, static_cast<WorldEntity*> (this))
{
RegisterObject(RaceCheckPoint);
this->setDistance(100);
@@ -156,7 +156,7 @@
{
if (players_.size() > 0)
{
- for (int i = 0; i < players_.size(); i++)
+ for (size_t i = 0; i < players_.size(); i++)
{
if (this->players_[i]->getClientID() == clientID)
{
@@ -171,7 +171,7 @@
{
if (players_.size() > 0)
{
- for (int i = 0; i < players_.size(); i++)
+ for (size_t i = 0; i < players_.size(); i++)
{
if (this->players_[i] == player)
{
Modified: code/trunk/src/modules/gametypes/RaceCheckPoint.h
===================================================================
--- code/trunk/src/modules/gametypes/RaceCheckPoint.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/gametypes/RaceCheckPoint.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,7 +44,7 @@
public RadarViewable
{
public:
- RaceCheckPoint(BaseObject* creator);
+ RaceCheckPoint(Context* context);
virtual ~RaceCheckPoint();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
@@ -69,7 +69,7 @@
return this->nextCheckpointsVirtual_;
}
- const std::set<int>& getNextCheckpoints()
+ std::set<int> getNextCheckpoints()
{
return nextCheckpoints_;
std::set<int> temp;
Modified: code/trunk/src/modules/gametypes/SpaceRace.cc
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRace.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/gametypes/SpaceRace.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,9 +39,9 @@
namespace orxonox
{
- CreateUnloadableFactory(SpaceRace);
+ RegisterUnloadableClass(SpaceRace);
- SpaceRace::SpaceRace(BaseObject* creator) : Gametype(creator)
+ SpaceRace::SpaceRace(Context* context) : Gametype(context)
{
RegisterObject(SpaceRace);
Modified: code/trunk/src/modules/gametypes/SpaceRace.h
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRace.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/gametypes/SpaceRace.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -53,7 +53,7 @@
public:
- SpaceRace(BaseObject* creator);
+ SpaceRace(Context* context);
virtual ~SpaceRace() {}
void tick(float dt);
Modified: code/trunk/src/modules/gametypes/SpaceRaceBot.cc
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRaceBot.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/gametypes/SpaceRaceBot.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -28,9 +28,9 @@
namespace orxonox
{
- CreateFactory(SpaceRaceBot);
+ RegisterClass(SpaceRaceBot);
- SpaceRaceBot::SpaceRaceBot(BaseObject* creator) : Bot(creator){
+ SpaceRaceBot::SpaceRaceBot(Context* context) : Bot(context){
RegisterObject(SpaceRaceBot);
this->defaultController_ = Class(SpaceRaceController);// ClassByString("")
this->createController();
Modified: code/trunk/src/modules/gametypes/SpaceRaceBot.h
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRaceBot.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/gametypes/SpaceRaceBot.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _GametypesExport SpaceRaceBot: public Bot
{
public:
- SpaceRaceBot(BaseObject* creator);
+ SpaceRaceBot(Context* context);
virtual ~SpaceRaceBot() {}
};
}
Modified: code/trunk/src/modules/gametypes/SpaceRaceController.cc
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRaceController.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/gametypes/SpaceRaceController.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,15 +44,15 @@
namespace orxonox
{
- CreateFactory(SpaceRaceController);
+ RegisterClass(SpaceRaceController);
const int ADJUSTDISTANCE = 500;
const int MINDISTANCE = 5;
/*
* Idea: Find static Point (checkpoints the spaceship has to reach)
*/
- SpaceRaceController::SpaceRaceController(BaseObject* creator) :
- ArtificialController(creator)
+ SpaceRaceController::SpaceRaceController(Context* context) :
+ ArtificialController(context)
{
RegisterObject(SpaceRaceController)
; std::vector<RaceCheckPoint*> checkpoints;
@@ -85,7 +85,7 @@
orxout()<<endl<<endl;
}//ausgabe*/
-
+ /*
for (std::vector<RaceCheckPoint*>::iterator it = checkpoints.begin(); it != checkpoints.end(); ++it)
{
std::set<int> nextCheckPoints = ((*it)->getNextCheckpoints());
@@ -99,7 +99,9 @@
//placeVirtualCheckpoints((*it), point2);
}
}
- }/*
+ }
+ */
+ /*
for(std::vector<RaceCheckPoint*>::iterator it=checkpoints_.begin(); it!=checkpoints_.end(); it++)
{
orxout()<<"Checkpoint "<<(*it)->getCheckpointIndex()<<"; NExtReal: ";
@@ -300,8 +302,8 @@
RaceCheckPoint* SpaceRaceController::findCheckpoint(int index) const
{
for (size_t i = 0; i < this->checkpoints_.size(); ++i)
- if (this->checkpoints_[i]->getCheckpointIndex() == index)
- return this->checkpoints_[i];
+ if (this->checkpoints_[i]->getCheckpointIndex() == index)
+ return this->checkpoints_[i];
return NULL;
}
@@ -339,10 +341,10 @@
//orxout()<<"temp bei 1: ="<< temp.x<< temp.y<< temp.z<<endl;
//orxout()<<"temp nach ausgabe: "<<previousCheckpoint->getVirtualNextCheckpointsAsVector3().x<<previousCheckpoint->getVirtualNextCheckpointsAsVector3().y<<previousCheckpoint->getVirtualNextCheckpointsAsVector3().z<<endl;
//OrxAssert(virtualCheckPointIndex < -1, "TO much virtual cp");
- /*orxout()<<"id: "<< previousCheckpoint->getCheckpointIndex() <<", following:"<<indexFollowingCheckPoint<<" : "<<temp.x<<", "<<temp.y<<", "<<temp.z<<"; ";
+ orxout()<<"id: "<< previousCheckpoint->getCheckpointIndex() <<", following:"<<indexFollowingCheckPoint<<" : "<<temp.x<<", "<<temp.y<<", "<<temp.z<<"; ";
temp=previousCheckpoint->getNextCheckpointsAsVector3();
orxout()<<"id: "<< previousCheckpoint->getCheckpointIndex() <<": "<<temp.x<<", "<<temp.y<<", "<<temp.z<<"; ";
- orxout()<<endl;*//*
+ orxout()<<endl;
return newTempRaceCheckPoint;
}*/
Modified: code/trunk/src/modules/gametypes/SpaceRaceController.h
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRaceController.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/gametypes/SpaceRaceController.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -64,7 +64,7 @@
//void computeVirtualCheckpoint(RaceCheckPoint*, RaceCheckPoint*, std::vector<StaticEntity*>);
public:
- SpaceRaceController(BaseObject* creator);
+ SpaceRaceController(Context* context);
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
virtual ~SpaceRaceController();
virtual void tick(float dt);
Modified: code/trunk/src/modules/gametypes/SpaceRaceManager.cc
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRaceManager.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/gametypes/SpaceRaceManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,10 +39,10 @@
namespace orxonox
{
- CreateFactory(SpaceRaceManager);
+ RegisterClass(SpaceRaceManager);
- SpaceRaceManager::SpaceRaceManager(BaseObject* creator) :
- BaseObject(creator)
+ SpaceRaceManager::SpaceRaceManager(Context* context) :
+ BaseObject(context)
{
RegisterObject(SpaceRaceManager);
this->race_ = orxonox_cast<SpaceRace*>(this->getGametype().get());
Modified: code/trunk/src/modules/gametypes/SpaceRaceManager.h
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRaceManager.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/gametypes/SpaceRaceManager.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -54,7 +54,7 @@
friend class RaceCheckPoint;
public:
- SpaceRaceManager(BaseObject* creator);
+ SpaceRaceManager(Context* context);
virtual ~SpaceRaceManager() ;
void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/notifications/NotificationDispatcher.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationDispatcher.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/notifications/NotificationDispatcher.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -47,7 +47,7 @@
namespace orxonox
{
- CreateUnloadableFactory(NotificationDispatcher);
+ RegisterUnloadableClass(NotificationDispatcher);
registerMemberNetworkFunction(NotificationDispatcher, broadcastHelper);
registerMemberNetworkFunction(NotificationDispatcher, dispatch);
@@ -56,7 +56,7 @@
@brief
Default constructor. Initializes the object.
*/
- NotificationDispatcher::NotificationDispatcher(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
+ NotificationDispatcher::NotificationDispatcher(Context* context) : BaseObject(context), Synchronisable(context)
{
RegisterObject(NotificationDispatcher);
Modified: code/trunk/src/modules/notifications/NotificationDispatcher.h
===================================================================
--- code/trunk/src/modules/notifications/NotificationDispatcher.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/notifications/NotificationDispatcher.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -75,7 +75,7 @@
class _NotificationsExport NotificationDispatcher : public BaseObject, public Synchronisable
{
public:
- NotificationDispatcher(BaseObject* creator); //!< Default constructor. Initializes the object.
+ NotificationDispatcher(Context* context); //!< Default constructor. Initializes the object.
virtual ~NotificationDispatcher(); //!< Destructor.
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a NotificationDispatcher object through XML.
Modified: code/trunk/src/modules/notifications/NotificationManager.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationManager.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/notifications/NotificationManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -54,7 +54,7 @@
*/
NotificationManager::NotificationManager()
{
- RegisterRootObject(NotificationManager);
+ RegisterObject(NotificationManager);
orxout(internal_info, context::notifications) << "NotificatioManager created." << endl;
}
Modified: code/trunk/src/modules/notifications/NotificationManager.h
===================================================================
--- code/trunk/src/modules/notifications/NotificationManager.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/notifications/NotificationManager.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,7 +41,6 @@
#include <map>
#include <string>
-#include "core/OrxonoxClass.h"
#include "util/Singleton.h"
#include "interfaces/NotificationListener.h"
Modified: code/trunk/src/modules/notifications/NotificationQueue.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationQueue.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/notifications/NotificationQueue.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,7 +43,7 @@
namespace orxonox
{
- CreateFactory(NotificationQueue);
+ RegisterClass(NotificationQueue);
/**
@brief
@@ -51,7 +51,7 @@
@param creator
The creator of the NotificationQueue.
*/
- NotificationQueue::NotificationQueue(BaseObject* creator) : BaseObject(creator), Synchronisable(creator), registered_(false)
+ NotificationQueue::NotificationQueue(Context* context) : BaseObject(context), Synchronisable(context), registered_(false)
{
RegisterObject(NotificationQueue);
Modified: code/trunk/src/modules/notifications/NotificationQueue.h
===================================================================
--- code/trunk/src/modules/notifications/NotificationQueue.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/notifications/NotificationQueue.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -93,7 +93,7 @@
{
public:
- NotificationQueue(BaseObject* creator);
+ NotificationQueue(Context* context);
virtual ~NotificationQueue();
virtual void tick(float dt); // To update from time to time.
Modified: code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -45,11 +45,11 @@
namespace orxonox
{
- CreateFactory(NotificationQueueCEGUI);
+ RegisterClass(NotificationQueueCEGUI);
/*static*/ const std::string NotificationQueueCEGUI::NOTIFICATION_LAYER("NotificationLayer");
- NotificationQueueCEGUI::NotificationQueueCEGUI(BaseObject* creator) : NotificationQueue(creator)
+ NotificationQueueCEGUI::NotificationQueueCEGUI(Context* context) : NotificationQueue(context)
{
RegisterObject(NotificationQueueCEGUI);
Modified: code/trunk/src/modules/notifications/NotificationQueueCEGUI.h
===================================================================
--- code/trunk/src/modules/notifications/NotificationQueueCEGUI.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/notifications/NotificationQueueCEGUI.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -69,7 +69,7 @@
{ // tolua_export
public:
- NotificationQueueCEGUI(BaseObject* creator);
+ NotificationQueueCEGUI(Context* context);
virtual ~NotificationQueueCEGUI();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/notifications/dispatchers/CommandNotification.cc
===================================================================
--- code/trunk/src/modules/notifications/dispatchers/CommandNotification.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/notifications/dispatchers/CommandNotification.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,13 +43,13 @@
namespace orxonox {
- CreateFactory(CommandNotification);
+ RegisterClass(CommandNotification);
/**
@brief
Default Constructor. Registers the object and initializes variables.
*/
- CommandNotification::CommandNotification(BaseObject* creator) : NotificationDispatcher(creator)
+ CommandNotification::CommandNotification(Context* context) : NotificationDispatcher(context)
{
RegisterObject(CommandNotification);
Modified: code/trunk/src/modules/notifications/dispatchers/CommandNotification.h
===================================================================
--- code/trunk/src/modules/notifications/dispatchers/CommandNotification.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/notifications/dispatchers/CommandNotification.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -69,7 +69,7 @@
{
public:
- CommandNotification(BaseObject* creator); //!< Default Constructor.
+ CommandNotification(Context* context); //!< Default Constructor.
virtual ~CommandNotification(); //!< Destructor.
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CommandNotification object through XML.
Modified: code/trunk/src/modules/notifications/dispatchers/SimpleNotification.cc
===================================================================
--- code/trunk/src/modules/notifications/dispatchers/SimpleNotification.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/notifications/dispatchers/SimpleNotification.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,13 +38,13 @@
namespace orxonox {
- CreateFactory(SimpleNotification);
+ RegisterClass(SimpleNotification);
/**
@brief
Default Constructor. Registers the object and initializes variables.
*/
- SimpleNotification::SimpleNotification(BaseObject* creator) : NotificationDispatcher(creator)
+ SimpleNotification::SimpleNotification(Context* context) : NotificationDispatcher(context)
{
RegisterObject(SimpleNotification);
Modified: code/trunk/src/modules/notifications/dispatchers/SimpleNotification.h
===================================================================
--- code/trunk/src/modules/notifications/dispatchers/SimpleNotification.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/notifications/dispatchers/SimpleNotification.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -66,7 +66,7 @@
class _NotificationsExport SimpleNotification : public NotificationDispatcher
{
public:
- SimpleNotification(BaseObject* creator); //!< Default Constructor.
+ SimpleNotification(Context* context); //!< Default Constructor.
virtual ~SimpleNotification(); //!< Destructor.
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a SimpleNotification object through XML.
Modified: code/trunk/src/modules/objects/Attacher.cc
===================================================================
--- code/trunk/src/modules/objects/Attacher.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/Attacher.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,9 +33,9 @@
namespace orxonox
{
- CreateFactory(Attacher);
+ RegisterClass(Attacher);
- Attacher::Attacher(BaseObject* creator) : StaticEntity(creator)
+ Attacher::Attacher(Context* context) : StaticEntity(context)
{
RegisterObject(Attacher);
Modified: code/trunk/src/modules/objects/Attacher.h
===================================================================
--- code/trunk/src/modules/objects/Attacher.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/Attacher.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -47,7 +47,7 @@
class _ObjectsExport Attacher : public StaticEntity, public XMLNameListener
{
public:
- Attacher(BaseObject* creator);
+ Attacher(Context* context);
virtual ~Attacher() {}
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/objects/ForceField.cc
===================================================================
--- code/trunk/src/modules/objects/ForceField.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/ForceField.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
namespace orxonox
{
- CreateFactory(ForceField);
+ RegisterClass(ForceField);
/*static*/ const std::string ForceField::modeTube_s = "tube";
/*static*/ const std::string ForceField::modeSphere_s = "sphere";
@@ -52,7 +52,7 @@
@brief
Constructor. Registers the object and initializes some values.
*/
- ForceField::ForceField(BaseObject* creator) : StaticEntity(creator)
+ ForceField::ForceField(Context* context) : StaticEntity(context)
{
RegisterObject(ForceField);
Modified: code/trunk/src/modules/objects/ForceField.h
===================================================================
--- code/trunk/src/modules/objects/ForceField.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/ForceField.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -85,7 +85,7 @@
class _ObjectsExport ForceField : public StaticEntity, public Tickable
{
public:
- ForceField(BaseObject* creator);
+ ForceField(Context* context);
virtual ~ForceField();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Creates a ForceField object through XML.
Modified: code/trunk/src/modules/objects/Planet.cc
===================================================================
--- code/trunk/src/modules/objects/Planet.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/Planet.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,12 +41,12 @@
namespace orxonox
{
- CreateFactory(Planet);
+ RegisterClass(Planet);
/**
* @brief Constructor
*/
- Planet::Planet(BaseObject* creator) : MovableEntity(creator)
+ Planet::Planet(Context* context) : MovableEntity(context)
{
RegisterObject(Planet);
this->registerVariables();
Modified: code/trunk/src/modules/objects/Planet.h
===================================================================
--- code/trunk/src/modules/objects/Planet.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/Planet.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -47,7 +47,7 @@
class _ObjectsExport Planet : public MovableEntity
{
public:
- Planet(BaseObject* creator);
+ Planet(Context* context);
virtual ~Planet();
Modified: code/trunk/src/modules/objects/Script.cc
===================================================================
--- code/trunk/src/modules/objects/Script.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/Script.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -45,7 +45,7 @@
namespace orxonox
{
- CreateFactory(Script);
+ RegisterClass(Script);
registerStaticNetworkFunction(Script::executeHelper);
@@ -60,7 +60,7 @@
@param creator
The creator of this object.
*/
- Script::Script(BaseObject* creator) : BaseObject(creator)
+ Script::Script(Context* context) : BaseObject(context)
{
RegisterObject(Script);
Modified: code/trunk/src/modules/objects/Script.h
===================================================================
--- code/trunk/src/modules/objects/Script.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/Script.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -94,7 +94,7 @@
class _ObjectsExport Script : public BaseObject, public ClientConnectionListener
{
public:
- Script(BaseObject* creator);
+ Script(Context* context);
virtual ~Script();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Script object through XML.
Modified: code/trunk/src/modules/objects/SpaceBoundaries.cc
===================================================================
--- code/trunk/src/modules/objects/SpaceBoundaries.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/SpaceBoundaries.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -31,7 +31,7 @@
#include <OgreBillboardSet.h>
#include "core/CoreIncludes.h"
-#include "core/ObjectListIterator.h"
+#include "core/object/ObjectListIterator.h"
#include "core/XMLPort.h"
#include "graphics/Billboard.h"
@@ -41,9 +41,9 @@
namespace orxonox
{
- CreateFactory(SpaceBoundaries);
+ RegisterClass(SpaceBoundaries);
- SpaceBoundaries::SpaceBoundaries(BaseObject* creator) : StaticEntity(creator)
+ SpaceBoundaries::SpaceBoundaries(Context* context) : StaticEntity(context)
{
RegisterObject(SpaceBoundaries);
@@ -72,7 +72,7 @@
void SpaceBoundaries::checkWhoIsIn()
{
pawnsIn_.clear();
- for(ObjectListIterator<Pawn> current = ObjectList<Pawn>::begin(); current != ObjectList<Pawn>::end(); ++current)
+ for(ObjectList<Pawn>::iterator current = ObjectList<Pawn>::begin(); current != ObjectList<Pawn>::end(); ++current)
{
Pawn* currentPawn = *current;
if( this->reaction_ == 0 )
@@ -103,7 +103,7 @@
if (current == this->billboards_.size())
{
- Billboard* billboard = new Billboard(this);
+ Billboard* billboard = new Billboard(this->getContext());
billboard->setPosition(position);
billboard->setSyncMode(ObjectDirection::None);
this->setBillboardOptions(billboard);
Modified: code/trunk/src/modules/objects/SpaceBoundaries.h
===================================================================
--- code/trunk/src/modules/objects/SpaceBoundaries.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/SpaceBoundaries.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,8 +35,7 @@
#include <list>
#include <vector>
-#include "core/CoreIncludes.h"
-#include "core/WeakPtr.h"
+#include "core/object/WeakPtr.h"
#include "tools/interfaces/Tickable.h"
#include "worldentities/StaticEntity.h"
@@ -75,7 +74,7 @@
class _ObjectsExport SpaceBoundaries : public StaticEntity, public Tickable
{
public:
- SpaceBoundaries(BaseObject* creator);
+ SpaceBoundaries(Context* context);
~SpaceBoundaries();
void setMaxDistance(float r);
Modified: code/trunk/src/modules/objects/Turret.cc
===================================================================
--- code/trunk/src/modules/objects/Turret.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/Turret.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,15 +34,15 @@
namespace orxonox
{
- CreateFactory(Turret);
+ RegisterClass(Turret);
/**
* @brief Constructor
*/
- Turret::Turret(BaseObject* creator) : SpaceShip(creator)
+ Turret::Turret(Context* context) : SpaceShip(context)
{
RegisterObject(Turret);
- this->controller_ = new WaypointPatrolController(this);
+ this->controller_ = new WaypointPatrolController(this->getContext());
}
/**
Modified: code/trunk/src/modules/objects/Turret.h
===================================================================
--- code/trunk/src/modules/objects/Turret.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/Turret.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,7 +44,7 @@
class _ObjectsExport Turret : public SpaceShip
{
public:
- Turret(BaseObject* creator);
+ Turret(Context* context);
virtual ~Turret();
//virtual void tick(float dt);
Modified: code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.cc
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,13 +41,13 @@
namespace orxonox
{
- CreateFactory(BoxCollisionShape);
+ RegisterClass(BoxCollisionShape);
/**
@brief
Constructor. Registers and initializes the object.
*/
- BoxCollisionShape::BoxCollisionShape(BaseObject* creator) : CollisionShape(creator)
+ BoxCollisionShape::BoxCollisionShape(Context* context) : CollisionShape(context)
{
RegisterObject(BoxCollisionShape);
Modified: code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.h
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -56,7 +56,7 @@
class _ObjectsExport BoxCollisionShape : public CollisionShape
{
public:
- BoxCollisionShape(BaseObject* creator);
+ BoxCollisionShape(Context* context);
virtual ~BoxCollisionShape();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.cc
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,13 +41,13 @@
namespace orxonox
{
- CreateFactory(ConeCollisionShape);
+ RegisterClass(ConeCollisionShape);
/**
@brief
Constructor. Registers and initializes the object.
*/
- ConeCollisionShape::ConeCollisionShape(BaseObject* creator) : CollisionShape(creator)
+ ConeCollisionShape::ConeCollisionShape(Context* context) : CollisionShape(context)
{
RegisterObject(ConeCollisionShape);
Modified: code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.h
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -54,7 +54,7 @@
class _ObjectsExport ConeCollisionShape : public CollisionShape
{
public:
- ConeCollisionShape(BaseObject* creator);
+ ConeCollisionShape(Context* context);
virtual ~ConeCollisionShape();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.cc
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,13 +41,13 @@
namespace orxonox
{
- CreateFactory(PlaneCollisionShape);
+ RegisterClass(PlaneCollisionShape);
/**
@brief
Constructor. Registers and initializes the object.
*/
- PlaneCollisionShape::PlaneCollisionShape(BaseObject* creator) : CollisionShape(creator)
+ PlaneCollisionShape::PlaneCollisionShape(Context* context) : CollisionShape(context)
{
RegisterObject(PlaneCollisionShape);
Modified: code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.h
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -56,7 +56,7 @@
class _ObjectsExport PlaneCollisionShape : public CollisionShape
{
public:
- PlaneCollisionShape(BaseObject* creator);
+ PlaneCollisionShape(Context* context);
virtual ~PlaneCollisionShape();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.cc
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,13 +41,13 @@
namespace orxonox
{
- CreateFactory(SphereCollisionShape);
+ RegisterClass(SphereCollisionShape);
/**
@brief
Constructor. registers and initializes the object.
*/
- SphereCollisionShape::SphereCollisionShape(BaseObject* creator) : CollisionShape(creator)
+ SphereCollisionShape::SphereCollisionShape(Context* context) : CollisionShape(context)
{
RegisterObject(SphereCollisionShape);
Modified: code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.h
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -54,7 +54,7 @@
class _ObjectsExport SphereCollisionShape : public CollisionShape
{
public:
- SphereCollisionShape(BaseObject* creator);
+ SphereCollisionShape(Context* context);
virtual ~SphereCollisionShape();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/objects/eventsystem/EventDispatcher.cc
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventDispatcher.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/eventsystem/EventDispatcher.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,9 +34,9 @@
namespace orxonox
{
- CreateFactory(EventDispatcher);
+ RegisterClass(EventDispatcher);
- EventDispatcher::EventDispatcher(BaseObject* creator) : BaseObject(creator)
+ EventDispatcher::EventDispatcher(Context* context) : BaseObject(context)
{
RegisterObject(EventDispatcher);
}
Modified: code/trunk/src/modules/objects/eventsystem/EventDispatcher.h
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventDispatcher.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/eventsystem/EventDispatcher.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -45,7 +45,7 @@
class _ObjectsExport EventDispatcher : public BaseObject
{
public:
- EventDispatcher(BaseObject* creator);
+ EventDispatcher(Context* context);
virtual ~EventDispatcher();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/objects/eventsystem/EventFilter.cc
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventFilter.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/eventsystem/EventFilter.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,9 +35,9 @@
namespace orxonox
{
- CreateFactory(EventFilter);
+ RegisterClass(EventFilter);
- EventFilter::EventFilter(BaseObject* creator) : BaseObject(creator)
+ EventFilter::EventFilter(Context* context) : BaseObject(context)
{
RegisterObject(EventFilter);
Modified: code/trunk/src/modules/objects/eventsystem/EventFilter.h
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventFilter.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/eventsystem/EventFilter.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -45,7 +45,7 @@
class _ObjectsExport EventFilter : public BaseObject
{
public:
- EventFilter(BaseObject* creator);
+ EventFilter(Context* context);
virtual ~EventFilter();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/objects/eventsystem/EventListener.cc
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventListener.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/eventsystem/EventListener.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,9 +34,9 @@
namespace orxonox
{
- CreateFactory(EventListener);
+ RegisterClass(EventListener);
- EventListener::EventListener(BaseObject* creator) : BaseObject(creator)
+ EventListener::EventListener(Context* context) : BaseObject(context)
{
RegisterObject(EventListener);
Modified: code/trunk/src/modules/objects/eventsystem/EventListener.h
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventListener.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/eventsystem/EventListener.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -46,7 +46,7 @@
class _ObjectsExport EventListener : public BaseObject, public XMLNameListener
{
public:
- EventListener(BaseObject* creator);
+ EventListener(Context* context);
virtual ~EventListener();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/objects/eventsystem/EventName.cc
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventName.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/eventsystem/EventName.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -31,9 +31,9 @@
namespace orxonox
{
- CreateFactory(EventName);
+ RegisterClass(EventName);
- EventName::EventName(BaseObject* creator) : BaseObject(creator)
+ EventName::EventName(Context* context) : BaseObject(context)
{
RegisterObject(EventName);
}
Modified: code/trunk/src/modules/objects/eventsystem/EventName.h
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventName.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/eventsystem/EventName.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,7 +44,7 @@
class _ObjectsExport EventName : public BaseObject
{
public:
- EventName(BaseObject* creator);
+ EventName(Context* context);
virtual ~EventName() {}
};
}
Modified: code/trunk/src/modules/objects/eventsystem/EventTarget.cc
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventTarget.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/eventsystem/EventTarget.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,9 +32,9 @@
namespace orxonox
{
- CreateFactory(EventTarget);
+ RegisterClass(EventTarget);
- EventTarget::EventTarget(BaseObject* creator) : BaseObject(creator)
+ EventTarget::EventTarget(Context* context) : BaseObject(context)
{
RegisterObject(EventTarget);
Modified: code/trunk/src/modules/objects/eventsystem/EventTarget.h
===================================================================
--- code/trunk/src/modules/objects/eventsystem/EventTarget.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/eventsystem/EventTarget.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -45,7 +45,7 @@
class _ObjectsExport EventTarget : public BaseObject, public XMLNameListener
{
public:
- EventTarget(BaseObject* creator);
+ EventTarget(Context* context);
virtual ~EventTarget();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/objects/triggers/CheckPoint.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/CheckPoint.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/CheckPoint.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,11 +41,11 @@
namespace orxonox
{
- CreateFactory(CheckPoint);
+ RegisterClass(CheckPoint);
- CheckPoint::CheckPoint(BaseObject* creator)
- : DistanceTrigger(creator)
- , RadarViewable(creator, static_cast<WorldEntity*>(this))
+ CheckPoint::CheckPoint(Context* context)
+ : DistanceTrigger(context)
+ , RadarViewable(this, static_cast<WorldEntity*>(this))
{
RegisterObject(CheckPoint);
Modified: code/trunk/src/modules/objects/triggers/CheckPoint.h
===================================================================
--- code/trunk/src/modules/objects/triggers/CheckPoint.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/CheckPoint.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -54,7 +54,7 @@
class _ObjectsExport CheckPoint : public DistanceTrigger, public RadarViewable
{
public:
- CheckPoint(BaseObject* creator);
+ CheckPoint(Context* context);
virtual ~CheckPoint();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CheckPoint object through XML.
Modified: code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -46,13 +46,13 @@
/*static*/ const std::string DistanceMultiTrigger::beaconModeIdentify_s = "identify";
/*static*/ const std::string DistanceMultiTrigger::beaconModeExlcude_s = "exclude";
- CreateFactory(DistanceMultiTrigger);
+ RegisterClass(DistanceMultiTrigger);
/**
@brief
Default Constructor. Registers the object and initializes default values.
*/
- DistanceMultiTrigger::DistanceMultiTrigger(BaseObject* creator) : MultiTrigger(creator)
+ DistanceMultiTrigger::DistanceMultiTrigger(Context* context) : MultiTrigger(context)
{
RegisterObject(DistanceMultiTrigger);
Modified: code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
#include <map>
-#include "core/WeakPtr.h"
+#include "core/object/WeakPtr.h"
#include "worldentities/WorldEntity.h"
@@ -94,7 +94,7 @@
{
public:
- DistanceMultiTrigger(BaseObject* creator); // Default Constructor. Registers the object and initializes default values.
+ DistanceMultiTrigger(Context* context); // Default Constructor. Registers the object and initializes default values.
virtual ~DistanceMultiTrigger(); // Destructor.
void XMLPort(Element& xmlelement, XMLPort::Mode mode); // Method for creating a DistanceMultiTrigger object through XML.
Modified: code/trunk/src/modules/objects/triggers/DistanceTrigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceTrigger.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/DistanceTrigger.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -48,7 +48,7 @@
/*static*/ const std::string DistanceTrigger::beaconModeIdentify_s = "identify";
/*static*/ const std::string DistanceTrigger::beaconModeExlcude_s = "exclude";
- CreateFactory(DistanceTrigger);
+ RegisterClass(DistanceTrigger);
/**
@brief
@@ -56,7 +56,7 @@
@param creator
The creator of this trigger.
*/
- DistanceTrigger::DistanceTrigger(BaseObject* creator) : Trigger(creator)
+ DistanceTrigger::DistanceTrigger(Context* context) : Trigger(context)
{
RegisterObject(DistanceTrigger);
Modified: code/trunk/src/modules/objects/triggers/DistanceTrigger.h
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceTrigger.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/DistanceTrigger.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -96,7 +96,7 @@
class _ObjectsExport DistanceTrigger : public Trigger, public PlayerTrigger
{
public:
- DistanceTrigger(BaseObject* creator); // Constructor. Registers and initializes the object.
+ DistanceTrigger(Context* context); // Constructor. Registers and initializes the object.
virtual ~DistanceTrigger();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); // Method for creating a DistanceTrigger object through XML.
Modified: code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
namespace orxonox
{
- CreateFactory(DistanceTriggerBeacon);
+ RegisterClass(DistanceTriggerBeacon);
/**
@brief
@@ -47,7 +47,7 @@
@param creator
The creator of this object.
*/
- DistanceTriggerBeacon::DistanceTriggerBeacon(BaseObject* creator) : StaticEntity(creator)
+ DistanceTriggerBeacon::DistanceTriggerBeacon(Context* context) : StaticEntity(context)
{
RegisterObject(DistanceTriggerBeacon);
}
Modified: code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.h
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/DistanceTriggerBeacon.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -56,7 +56,7 @@
{
public:
- DistanceTriggerBeacon(BaseObject* creator); //!< Constructor.
+ DistanceTriggerBeacon(Context* context); //!< Constructor.
virtual ~DistanceTriggerBeacon() {} //!< Destructor.
};
Modified: code/trunk/src/modules/objects/triggers/EventMultiTrigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/EventMultiTrigger.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/EventMultiTrigger.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,13 +42,13 @@
namespace orxonox
{
- CreateFactory(EventMultiTrigger);
+ RegisterClass(EventMultiTrigger);
/**
@brief
Constructor. Registers the object.
*/
- EventMultiTrigger::EventMultiTrigger(BaseObject* creator) : MultiTrigger(creator)
+ EventMultiTrigger::EventMultiTrigger(Context* context) : MultiTrigger(context)
{
RegisterObject(EventMultiTrigger);
}
Modified: code/trunk/src/modules/objects/triggers/EventMultiTrigger.h
===================================================================
--- code/trunk/src/modules/objects/triggers/EventMultiTrigger.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/EventMultiTrigger.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -72,7 +72,7 @@
{
public:
- EventMultiTrigger(BaseObject* creator); //!< Constructor. Registers the object.
+ EventMultiTrigger(Context* context); //!< Constructor. Registers the object.
virtual ~EventMultiTrigger(); //!< Destructor.
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an EventMultiTrigger object through XML.
Modified: code/trunk/src/modules/objects/triggers/EventTrigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/EventTrigger.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/EventTrigger.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
namespace orxonox
{
- CreateFactory(EventTrigger);
+ RegisterClass(EventTrigger);
/**
@brief
@@ -47,7 +47,7 @@
@param creator
The creator of the EventTrigger.
*/
- EventTrigger::EventTrigger(BaseObject* creator) : Trigger(creator)
+ EventTrigger::EventTrigger(Context* context) : Trigger(context)
{
RegisterObject(EventTrigger);
Modified: code/trunk/src/modules/objects/triggers/EventTrigger.h
===================================================================
--- code/trunk/src/modules/objects/triggers/EventTrigger.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/EventTrigger.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -69,7 +69,7 @@
class _ObjectsExport EventTrigger : public Trigger
{
public:
- EventTrigger(BaseObject* creator); // Constructor. Registers and initializes the object.
+ EventTrigger(Context* context); // Constructor. Registers and initializes the object.
virtual ~EventTrigger();
virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode); // Creates an event port.
Modified: code/trunk/src/modules/objects/triggers/MultiTrigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/MultiTrigger.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/MultiTrigger.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,7 +42,7 @@
namespace orxonox
{
- CreateFactory(MultiTrigger);
+ RegisterClass(MultiTrigger);
/**
@brief
@@ -50,7 +50,7 @@
@param creator
The creator.
*/
- MultiTrigger::MultiTrigger(BaseObject* creator) : TriggerBase(creator)
+ MultiTrigger::MultiTrigger(Context* context) : TriggerBase(context)
{
RegisterObject(MultiTrigger);
@@ -450,7 +450,7 @@
return;
}
- MultiTriggerContainer* container = new MultiTriggerContainer(this, this, originator);
+ MultiTriggerContainer* container = new MultiTriggerContainer(this->getContext(), this, originator);
this->fireEvent(status, container);
orxout(verbose, context::triggers) << "MultiTrigger '" << this->getName() << "' (&" << this << "): Fired event. originator: " << originator->getIdentifier()->getName() << " (&" << originator << "), status: " << status << "." << endl;
delete container;
Modified: code/trunk/src/modules/objects/triggers/MultiTrigger.h
===================================================================
--- code/trunk/src/modules/objects/triggers/MultiTrigger.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/MultiTrigger.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -98,7 +98,7 @@
class _ObjectsExport MultiTrigger : public TriggerBase
{
public:
- MultiTrigger(BaseObject* creator); //!< Constructor. Registers the objects and initializes default values.
+ MultiTrigger(Context* context); //!< Constructor. Registers the objects and initializes default values.
virtual ~MultiTrigger(); //!< Destructor.
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a MultiTrigger object through XML.
Modified: code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,7 +41,7 @@
namespace orxonox
{
- CreateUnloadableFactory(MultiTriggerContainer);
+ RegisterUnloadableClass(MultiTriggerContainer);
/**
@brief
@@ -49,7 +49,7 @@
@param creator
The creator.
*/
- MultiTriggerContainer::MultiTriggerContainer(BaseObject* creator) : BaseObject(creator), originator_(NULL), data_(NULL)
+ MultiTriggerContainer::MultiTriggerContainer(Context* context) : BaseObject(context), originator_(NULL), data_(NULL)
{
RegisterObject(MultiTriggerContainer);
}
@@ -64,7 +64,7 @@
@param data
A pointer to the data that should be sent with the container.
*/
- MultiTriggerContainer::MultiTriggerContainer(BaseObject* creator, MultiTrigger* originator, BaseObject* data) : BaseObject(creator), originator_(originator), data_(data)
+ MultiTriggerContainer::MultiTriggerContainer(Context* context, MultiTrigger* originator, BaseObject* data) : BaseObject(context), originator_(originator), data_(data)
{
RegisterObject(MultiTriggerContainer);
Modified: code/trunk/src/modules/objects/triggers/MultiTriggerContainer.h
===================================================================
--- code/trunk/src/modules/objects/triggers/MultiTriggerContainer.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/MultiTriggerContainer.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -57,8 +57,8 @@
{
public:
- MultiTriggerContainer(BaseObject* creator); //!< Default constructor. Registers the object and creates an empty container.
- MultiTriggerContainer(BaseObject* creator, MultiTrigger* originator, BaseObject* data); //!< Constructor. Registers the object and sets the input values.
+ MultiTriggerContainer(Context* context); //!< Default constructor. Registers the object and creates an empty container.
+ MultiTriggerContainer(Context* context, MultiTrigger* originator, BaseObject* data); //!< Constructor. Registers the object and sets the input values.
virtual ~MultiTriggerContainer(); //!< Destructor.
/**
Modified: code/trunk/src/modules/objects/triggers/Trigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/Trigger.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/Trigger.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -46,7 +46,7 @@
SetConsoleCommand("Trigger", "debugFlares", &Trigger::debugFlares).defaultValues(false);
- CreateFactory(Trigger);
+ RegisterClass(Trigger);
/**
@brief
@@ -54,7 +54,7 @@
@param creator
The creator of the Trigger.
*/
- Trigger::Trigger(BaseObject* creator) : TriggerBase(creator)
+ Trigger::Trigger(Context* context) : TriggerBase(context)
{
RegisterObject(Trigger);
Modified: code/trunk/src/modules/objects/triggers/Trigger.h
===================================================================
--- code/trunk/src/modules/objects/triggers/Trigger.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/Trigger.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -79,7 +79,7 @@
class _ObjectsExport Trigger : public TriggerBase
{
public:
- Trigger(BaseObject* creator); // Constructor. Registers and initializes the object.
+ Trigger(Context* context); // Constructor. Registers and initializes the object.
virtual ~Trigger();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); // Method for creating a Trigger object through XML.
Modified: code/trunk/src/modules/objects/triggers/TriggerBase.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/TriggerBase.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/TriggerBase.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -45,13 +45,13 @@
/*static*/ const std::string TriggerBase::or_s = "or";
/*static*/ const std::string TriggerBase::xor_s = "xor";
- CreateFactory(TriggerBase);
+ RegisterClass(TriggerBase);
/**
@brief
Constructor. Registers the object and initializes some values.
*/
- TriggerBase::TriggerBase(BaseObject* creator) : StaticEntity(creator)
+ TriggerBase::TriggerBase(Context* context) : StaticEntity(context)
{
RegisterObject(TriggerBase);
Modified: code/trunk/src/modules/objects/triggers/TriggerBase.h
===================================================================
--- code/trunk/src/modules/objects/triggers/TriggerBase.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/objects/triggers/TriggerBase.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -73,7 +73,7 @@
class _ObjectsExport TriggerBase : public StaticEntity, public Tickable
{
public:
- TriggerBase(BaseObject* creator);
+ TriggerBase(Context* context);
virtual ~TriggerBase();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a TriggerBase object through XML.
Modified: code/trunk/src/modules/overlays/FadeoutText.cc
===================================================================
--- code/trunk/src/modules/overlays/FadeoutText.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/FadeoutText.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,9 +35,9 @@
namespace orxonox
{
- CreateFactory(FadeoutText);
+ RegisterClass(FadeoutText);
- FadeoutText::FadeoutText(BaseObject* creator) : OverlayText(creator)
+ FadeoutText::FadeoutText(Context* context) : OverlayText(context)
{
RegisterObject(FadeoutText);
Modified: code/trunk/src/modules/overlays/FadeoutText.h
===================================================================
--- code/trunk/src/modules/overlays/FadeoutText.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/FadeoutText.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OverlaysExport FadeoutText : public OverlayText, public Tickable
{
public:
- FadeoutText(BaseObject* creator);
+ FadeoutText(Context* context);
virtual ~FadeoutText() {}
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/overlays/GUIOverlay.cc
===================================================================
--- code/trunk/src/modules/overlays/GUIOverlay.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/GUIOverlay.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,9 +40,9 @@
namespace orxonox
{
- CreateFactory(GUIOverlay);
+ RegisterClass(GUIOverlay);
- GUIOverlay::GUIOverlay(BaseObject* creator) : OrxonoxOverlay(creator)
+ GUIOverlay::GUIOverlay(Context* context) : OrxonoxOverlay(context)
{
RegisterObject(GUIOverlay);
}
Modified: code/trunk/src/modules/overlays/GUIOverlay.h
===================================================================
--- code/trunk/src/modules/overlays/GUIOverlay.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/GUIOverlay.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
{
public:
- GUIOverlay(BaseObject* creator);
+ GUIOverlay(Context* context);
virtual ~GUIOverlay();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/overlays/OverlayText.cc
===================================================================
--- code/trunk/src/modules/overlays/OverlayText.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/OverlayText.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,14 +40,14 @@
namespace orxonox
{
- CreateFactory(OverlayText);
+ RegisterClass(OverlayText);
BOOST_STATIC_ASSERT((int)Ogre::TextAreaOverlayElement::Left == (int)OverlayText::Left);
BOOST_STATIC_ASSERT((int)Ogre::TextAreaOverlayElement::Center == (int)OverlayText::Center);
BOOST_STATIC_ASSERT((int)Ogre::TextAreaOverlayElement::Right == (int)OverlayText::Right);
- OverlayText::OverlayText(BaseObject* creator)
- : OrxonoxOverlay(creator)
+ OverlayText::OverlayText(Context* context)
+ : OrxonoxOverlay(context)
{
RegisterObject(OverlayText);
Modified: code/trunk/src/modules/overlays/OverlayText.h
===================================================================
--- code/trunk/src/modules/overlays/OverlayText.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/OverlayText.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -48,7 +48,7 @@
Center
};
- OverlayText(BaseObject* creator);
+ OverlayText(Context* context);
virtual ~OverlayText();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/overlays/debugging/DebugFPSText.cc
===================================================================
--- code/trunk/src/modules/overlays/debugging/DebugFPSText.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/debugging/DebugFPSText.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,9 +34,9 @@
namespace orxonox
{
- CreateFactory(DebugFPSText);
+ RegisterClass(DebugFPSText);
- DebugFPSText::DebugFPSText(BaseObject* creator) : OverlayText(creator)
+ DebugFPSText::DebugFPSText(Context* context) : OverlayText(context)
{
RegisterObject(DebugFPSText);
}
Modified: code/trunk/src/modules/overlays/debugging/DebugFPSText.h
===================================================================
--- code/trunk/src/modules/overlays/debugging/DebugFPSText.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/debugging/DebugFPSText.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OverlaysExport DebugFPSText : public OverlayText, public Tickable
{
public:
- DebugFPSText(BaseObject* creator);
+ DebugFPSText(Context* context);
virtual ~DebugFPSText();
virtual void tick(float dt);
Modified: code/trunk/src/modules/overlays/debugging/DebugRTRText.cc
===================================================================
--- code/trunk/src/modules/overlays/debugging/DebugRTRText.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/debugging/DebugRTRText.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,9 +34,9 @@
namespace orxonox
{
- CreateFactory(DebugRTRText);
+ RegisterClass(DebugRTRText);
- DebugRTRText::DebugRTRText(BaseObject* creator) : OverlayText(creator)
+ DebugRTRText::DebugRTRText(Context* context) : OverlayText(context)
{
RegisterObject(DebugRTRText);
}
Modified: code/trunk/src/modules/overlays/debugging/DebugRTRText.h
===================================================================
--- code/trunk/src/modules/overlays/debugging/DebugRTRText.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/debugging/DebugRTRText.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OverlaysExport DebugRTRText : public OverlayText, public Tickable
{
public:
- DebugRTRText(BaseObject* creator);
+ DebugRTRText(Context* context);
virtual ~DebugRTRText();
virtual void tick(float dt);
Modified: code/trunk/src/modules/overlays/hud/AnnounceMessage.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/AnnounceMessage.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/AnnounceMessage.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,9 +33,9 @@
namespace orxonox
{
- CreateFactory(AnnounceMessage);
+ RegisterClass(AnnounceMessage);
- AnnounceMessage::AnnounceMessage(BaseObject* creator) : FadeoutText(creator)
+ AnnounceMessage::AnnounceMessage(Context* context) : FadeoutText(context)
{
RegisterObject(AnnounceMessage);
Modified: code/trunk/src/modules/overlays/hud/AnnounceMessage.h
===================================================================
--- code/trunk/src/modules/overlays/hud/AnnounceMessage.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/AnnounceMessage.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OverlaysExport AnnounceMessage : public FadeoutText, public GametypeMessageListener
{
public:
- AnnounceMessage(BaseObject* creator);
+ AnnounceMessage(Context* context);
virtual ~AnnounceMessage() {}
virtual void changedOwner();
Modified: code/trunk/src/modules/overlays/hud/ChatOverlay.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/ChatOverlay.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/ChatOverlay.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,7 +34,7 @@
#include "util/Convert.h"
#include "util/DisplayStringConversions.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/command/Executor.h"
#include "tools/Timer.h"
@@ -43,10 +43,10 @@
namespace orxonox
{
- CreateFactory(ChatOverlay);
+ RegisterClass(ChatOverlay);
- ChatOverlay::ChatOverlay(BaseObject* creator)
- : OverlayText(creator)
+ ChatOverlay::ChatOverlay(Context* context)
+ : OverlayText(context)
{
RegisterObject(ChatOverlay);
Modified: code/trunk/src/modules/overlays/hud/ChatOverlay.h
===================================================================
--- code/trunk/src/modules/overlays/hud/ChatOverlay.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/ChatOverlay.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,7 +42,7 @@
class _OverlaysExport ChatOverlay : public OverlayText, public ChatListener
{
public:
- ChatOverlay(BaseObject* creator);
+ ChatOverlay(Context* context);
virtual ~ChatOverlay();
void setConfigValues();
Modified: code/trunk/src/modules/overlays/hud/DeathMessage.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/DeathMessage.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/DeathMessage.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,9 +33,9 @@
namespace orxonox
{
- CreateFactory(DeathMessage);
+ RegisterClass(DeathMessage);
- DeathMessage::DeathMessage(BaseObject* creator) : FadeoutText(creator)
+ DeathMessage::DeathMessage(Context* context) : FadeoutText(context)
{
RegisterObject(DeathMessage);
Modified: code/trunk/src/modules/overlays/hud/DeathMessage.h
===================================================================
--- code/trunk/src/modules/overlays/hud/DeathMessage.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/DeathMessage.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OverlaysExport DeathMessage : public FadeoutText, public GametypeMessageListener
{
public:
- DeathMessage(BaseObject* creator);
+ DeathMessage(Context* context);
virtual ~DeathMessage() {}
virtual void changedOwner();
Modified: code/trunk/src/modules/overlays/hud/GametypeFadingMessage.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/GametypeFadingMessage.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/GametypeFadingMessage.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,9 +33,9 @@
namespace orxonox
{
- CreateFactory(GametypeFadingMessage);
+ RegisterClass(GametypeFadingMessage);
- GametypeFadingMessage::GametypeFadingMessage(BaseObject* creator) : FadeoutText(creator)
+ GametypeFadingMessage::GametypeFadingMessage(Context* context) : FadeoutText(context)
{
RegisterObject(GametypeFadingMessage);
Modified: code/trunk/src/modules/overlays/hud/GametypeFadingMessage.h
===================================================================
--- code/trunk/src/modules/overlays/hud/GametypeFadingMessage.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/GametypeFadingMessage.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OverlaysExport GametypeFadingMessage : public FadeoutText, GametypeMessageListener
{
public:
- GametypeFadingMessage(BaseObject* creator);
+ GametypeFadingMessage(Context* context);
virtual ~GametypeFadingMessage();
virtual void changedOwner();
Modified: code/trunk/src/modules/overlays/hud/GametypeStaticMessage.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/GametypeStaticMessage.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/GametypeStaticMessage.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,10 +35,10 @@
namespace orxonox
{
- CreateFactory(GametypeStaticMessage);
+ RegisterClass(GametypeStaticMessage);
- GametypeStaticMessage::GametypeStaticMessage(BaseObject* creator) : OverlayText(creator)
+ GametypeStaticMessage::GametypeStaticMessage(Context* context) : OverlayText(context)
{
RegisterObject(GametypeStaticMessage);
this->owner_ = 0;
Modified: code/trunk/src/modules/overlays/hud/GametypeStaticMessage.h
===================================================================
--- code/trunk/src/modules/overlays/hud/GametypeStaticMessage.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/GametypeStaticMessage.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,7 +42,7 @@
class _OverlaysExport GametypeStaticMessage : public OverlayText, GametypeMessageListener
{
public:
- GametypeStaticMessage(BaseObject* creator);
+ GametypeStaticMessage(Context* context);
virtual ~GametypeStaticMessage();
virtual void changedOwner();
Modified: code/trunk/src/modules/overlays/hud/HUDBar.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDBar.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/HUDBar.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,10 +44,10 @@
namespace orxonox
{
- CreateFactory(BarColour);
+ RegisterClass(BarColour);
- BarColour::BarColour(BaseObject* creator)
- : BaseObject(creator)
+ BarColour::BarColour(Context* context)
+ : BaseObject(context)
{
RegisterObject(BarColour);
@@ -66,8 +66,10 @@
unsigned int HUDBar::materialcount_s = 0;
- HUDBar::HUDBar(BaseObject* creator)
- : OrxonoxOverlay(creator), right2Left_(false), autoColour_(false)
+ RegisterClass(HUDBar);
+
+ HUDBar::HUDBar(Context* context)
+ : OrxonoxOverlay(context), right2Left_(false), autoColour_(false)
{
RegisterObject(HUDBar);
Modified: code/trunk/src/modules/overlays/hud/HUDBar.h
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDBar.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/HUDBar.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -47,7 +47,7 @@
class _OverlaysExport BarColour : public BaseObject
{
public:
- BarColour(BaseObject* creator);
+ BarColour(Context* context);
virtual ~BarColour() { }
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
@@ -67,7 +67,7 @@
class _OverlaysExport HUDBar : public OrxonoxOverlay
{
public:
- HUDBar(BaseObject* creator);
+ HUDBar(Context* context);
virtual ~HUDBar();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/overlays/hud/HUDBoostBar.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDBoostBar.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/HUDBoostBar.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,10 +34,10 @@
namespace orxonox
{
- CreateFactory(HUDBoostBar);
+ RegisterClass(HUDBoostBar);
- HUDBoostBar::HUDBoostBar(BaseObject* creator)
- : HUDBar(creator)
+ HUDBoostBar::HUDBoostBar(Context* context)
+ : HUDBar(context)
{
RegisterObject(HUDBoostBar);
Modified: code/trunk/src/modules/overlays/hud/HUDBoostBar.h
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDBoostBar.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/HUDBoostBar.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OverlaysExport HUDBoostBar : public HUDBar, public Tickable
{
public:
- HUDBoostBar(BaseObject* creator);
+ HUDBoostBar(Context* context);
virtual ~HUDBoostBar();
virtual void tick(float dt);
Modified: code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -28,14 +28,14 @@
#include "HUDEnemyHealthBar.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "worldentities/pawns/Pawn.h"
namespace orxonox
{
- CreateFactory(HUDEnemyHealthBar);
+ RegisterClass(HUDEnemyHealthBar);
- HUDEnemyHealthBar::HUDEnemyHealthBar(BaseObject* creator) : HUDHealthBar(creator)
+ HUDEnemyHealthBar::HUDEnemyHealthBar(Context* context) : HUDHealthBar(context)
{
RegisterObject(HUDEnemyHealthBar);
Modified: code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.h
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,7 +36,7 @@
class _OverlaysExport HUDEnemyHealthBar : public HUDHealthBar
{
public:
- HUDEnemyHealthBar(BaseObject* creator);
+ HUDEnemyHealthBar(Context* context);
virtual ~HUDEnemyHealthBar();
void setConfigValues();
Modified: code/trunk/src/modules/overlays/hud/HUDHealthBar.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDHealthBar.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/HUDHealthBar.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,16 +36,16 @@
namespace orxonox
{
- CreateFactory(HUDHealthBar);
+ RegisterClass(HUDHealthBar);
- HUDHealthBar::HUDHealthBar(BaseObject* creator) : HUDBar(creator)
+ HUDHealthBar::HUDHealthBar(Context* context) : HUDBar(context)
{
RegisterObject(HUDHealthBar);
this->owner_ = 0;
this->bUseBarColour_ = false;
- this->textoverlay_ = new OverlayText(this);
+ this->textoverlay_ = new OverlayText(this->getContext());
assert(this->textoverlay_.get());
Modified: code/trunk/src/modules/overlays/hud/HUDHealthBar.h
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDHealthBar.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/HUDHealthBar.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,7 +41,7 @@
class _OverlaysExport HUDHealthBar : public HUDBar, public Tickable
{
public:
- HUDHealthBar(BaseObject* creator);
+ HUDHealthBar(Context* context);
virtual ~HUDHealthBar();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDNavigation.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/HUDNavigation.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -50,7 +50,7 @@
#include "controllers/HumanController.h"
#include "worldentities/pawns/Pawn.h"
#include "worldentities/WorldEntity.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "tools/TextureGenerator.h"
// #include <boost/bind/bind_template.hpp>
@@ -66,12 +66,12 @@
{
return a.second < b.second;
}
- CreateFactory ( HUDNavigation );
+ RegisterClass ( HUDNavigation );
HUDNavigation* HUDNavigation::localHUD_s = 0;
- HUDNavigation::HUDNavigation(BaseObject* creator) :
- OrxonoxOverlay(creator)
+ HUDNavigation::HUDNavigation(Context* context) :
+ OrxonoxOverlay(context)
{
RegisterObject(HUDNavigation)
; this->setConfigValues();
Modified: code/trunk/src/modules/overlays/hud/HUDNavigation.h
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDNavigation.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/HUDNavigation.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -45,7 +45,7 @@
class _OverlaysExport HUDNavigation : public OrxonoxOverlay, public Tickable, public RadarListener
{
public:
- HUDNavigation(BaseObject* creator);
+ HUDNavigation(Context* context);
virtual ~HUDNavigation();
void setConfigValues();
Modified: code/trunk/src/modules/overlays/hud/HUDRadar.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDRadar.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/HUDRadar.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,10 +43,10 @@
namespace orxonox
{
- CreateFactory(HUDRadar);
+ RegisterClass(HUDRadar);
- HUDRadar::HUDRadar(BaseObject* creator)
- : OrxonoxOverlay(creator)
+ HUDRadar::HUDRadar(Context* context)
+ : OrxonoxOverlay(context)
{
RegisterObject(HUDRadar);
Modified: code/trunk/src/modules/overlays/hud/HUDRadar.h
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDRadar.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/HUDRadar.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -45,7 +45,7 @@
class _OverlaysExport HUDRadar : public OrxonoxOverlay, public RadarListener
{
public:
- HUDRadar(BaseObject* creator);
+ HUDRadar(Context* context);
virtual ~HUDRadar();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/overlays/hud/HUDSpeedBar.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDSpeedBar.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/HUDSpeedBar.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,10 +35,10 @@
namespace orxonox
{
- CreateFactory(HUDSpeedBar);
+ RegisterClass(HUDSpeedBar);
- HUDSpeedBar::HUDSpeedBar(BaseObject* creator)
- : HUDBar(creator)
+ HUDSpeedBar::HUDSpeedBar(Context* context)
+ : HUDBar(context)
{
RegisterObject(HUDSpeedBar);
Modified: code/trunk/src/modules/overlays/hud/HUDSpeedBar.h
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDSpeedBar.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/HUDSpeedBar.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OverlaysExport HUDSpeedBar : public HUDBar, public Tickable
{
public:
- HUDSpeedBar(BaseObject* creator);
+ HUDSpeedBar(Context* context);
virtual ~HUDSpeedBar();
virtual void tick(float dt);
Modified: code/trunk/src/modules/overlays/hud/HUDTimer.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDTimer.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/HUDTimer.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,9 +35,9 @@
namespace orxonox
{
- CreateFactory(HUDTimer);
+ RegisterClass(HUDTimer);
- HUDTimer::HUDTimer(BaseObject* creator) : OverlayText(creator)
+ HUDTimer::HUDTimer(Context* context) : OverlayText(context)
{
RegisterObject(HUDTimer);
Modified: code/trunk/src/modules/overlays/hud/HUDTimer.h
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDTimer.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/HUDTimer.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OverlaysExport HUDTimer : public OverlayText, public Tickable
{
public:
- HUDTimer(BaseObject* creator);
+ HUDTimer(Context* context);
virtual ~HUDTimer();
virtual void tick(float dt);
Modified: code/trunk/src/modules/overlays/hud/KillMessage.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/KillMessage.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/KillMessage.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,9 +33,9 @@
namespace orxonox
{
- CreateFactory(KillMessage);
+ RegisterClass(KillMessage);
- KillMessage::KillMessage(BaseObject* creator) : FadeoutText(creator)
+ KillMessage::KillMessage(Context* context) : FadeoutText(context)
{
RegisterObject(KillMessage);
Modified: code/trunk/src/modules/overlays/hud/KillMessage.h
===================================================================
--- code/trunk/src/modules/overlays/hud/KillMessage.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/KillMessage.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OverlaysExport KillMessage : public FadeoutText, public GametypeMessageListener
{
public:
- KillMessage(BaseObject* creator);
+ KillMessage(Context* context);
virtual ~KillMessage() {}
virtual void changedOwner();
Modified: code/trunk/src/modules/overlays/hud/LastManStandingInfos.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/LastManStandingInfos.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/LastManStandingInfos.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,9 +36,9 @@
namespace orxonox
{
- CreateFactory(LastManStandingInfos);
+ RegisterClass(LastManStandingInfos);
- LastManStandingInfos::LastManStandingInfos(BaseObject* creator) : OverlayText(creator)
+ LastManStandingInfos::LastManStandingInfos(Context* context) : OverlayText(context)
{
RegisterObject(LastManStandingInfos);
Modified: code/trunk/src/modules/overlays/hud/LastManStandingInfos.h
===================================================================
--- code/trunk/src/modules/overlays/hud/LastManStandingInfos.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/LastManStandingInfos.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OverlaysExport LastManStandingInfos : public OverlayText, public Tickable
{
public:
- LastManStandingInfos(BaseObject* creator);
+ LastManStandingInfos(Context* context);
virtual ~LastManStandingInfos();
virtual void tick(float dt);
Modified: code/trunk/src/modules/overlays/hud/LastTeamStandingInfos.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/LastTeamStandingInfos.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/LastTeamStandingInfos.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,9 +36,9 @@
namespace orxonox
{
- CreateFactory(LastTeamStandingInfos);
+ RegisterClass(LastTeamStandingInfos);
- LastTeamStandingInfos::LastTeamStandingInfos(BaseObject* creator) : OverlayText(creator)
+ LastTeamStandingInfos::LastTeamStandingInfos(Context* context) : OverlayText(context)
{
RegisterObject(LastTeamStandingInfos);
Modified: code/trunk/src/modules/overlays/hud/LastTeamStandingInfos.h
===================================================================
--- code/trunk/src/modules/overlays/hud/LastTeamStandingInfos.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/LastTeamStandingInfos.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OverlaysExport LastTeamStandingInfos : public OverlayText, public Tickable
{
public:
- LastTeamStandingInfos(BaseObject* creator);
+ LastTeamStandingInfos(Context* context);
virtual ~LastTeamStandingInfos();
virtual void tick(float dt);
Modified: code/trunk/src/modules/overlays/hud/PauseNotice.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/PauseNotice.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/PauseNotice.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,9 +33,9 @@
namespace orxonox
{
- CreateFactory(PauseNotice);
+ RegisterClass(PauseNotice);
- PauseNotice::PauseNotice(BaseObject* creator) : OverlayText(creator)
+ PauseNotice::PauseNotice(Context* context) : OverlayText(context)
{
RegisterObject(PauseNotice);
Modified: code/trunk/src/modules/overlays/hud/PauseNotice.h
===================================================================
--- code/trunk/src/modules/overlays/hud/PauseNotice.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/PauseNotice.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OverlaysExport PauseNotice : public OverlayText, public TimeFactorListener
{
public:
- PauseNotice(BaseObject* creator);
+ PauseNotice(Context* context);
virtual void changedOwner();
Modified: code/trunk/src/modules/overlays/hud/TeamBaseMatchScore.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/TeamBaseMatchScore.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/TeamBaseMatchScore.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,9 +36,9 @@
namespace orxonox
{
- CreateFactory(TeamBaseMatchScore);
+ RegisterClass(TeamBaseMatchScore);
- TeamBaseMatchScore::TeamBaseMatchScore(BaseObject* creator) : OverlayText(creator)
+ TeamBaseMatchScore::TeamBaseMatchScore(Context* context) : OverlayText(context)
{
RegisterObject(TeamBaseMatchScore);
Modified: code/trunk/src/modules/overlays/hud/TeamBaseMatchScore.h
===================================================================
--- code/trunk/src/modules/overlays/hud/TeamBaseMatchScore.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/hud/TeamBaseMatchScore.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OverlaysExport TeamBaseMatchScore : public OverlayText, public Tickable
{
public:
- TeamBaseMatchScore(BaseObject* creator);
+ TeamBaseMatchScore(Context* context);
virtual ~TeamBaseMatchScore();
virtual void tick(float dt);
Modified: code/trunk/src/modules/overlays/stats/Scoreboard.cc
===================================================================
--- code/trunk/src/modules/overlays/stats/Scoreboard.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/stats/Scoreboard.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,13 +34,13 @@
namespace orxonox
{
- CreateFactory(Scoreboard);
+ RegisterClass(Scoreboard);
/**
@brief Constructor: Creates the scoreboard.
*/
- Scoreboard::Scoreboard(BaseObject* creator)
- : OrxonoxOverlay(creator)
+ Scoreboard::Scoreboard(Context* context)
+ : OrxonoxOverlay(context)
{
RegisterObject(Scoreboard);
}
Modified: code/trunk/src/modules/overlays/stats/Scoreboard.h
===================================================================
--- code/trunk/src/modules/overlays/stats/Scoreboard.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/stats/Scoreboard.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OverlaysExport Scoreboard : public OrxonoxOverlay, public Tickable
{
public: // functions
- Scoreboard(BaseObject* creator);
+ Scoreboard(Context* context);
virtual ~Scoreboard();
virtual void tick(float dt);
Modified: code/trunk/src/modules/overlays/stats/Stats.cc
===================================================================
--- code/trunk/src/modules/overlays/stats/Stats.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/stats/Stats.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,17 +34,17 @@
#include "util/StringUtils.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
namespace orxonox
{
- CreateFactory(Stats);
+ RegisterClass(Stats);
/**
@brief Constructor: Creates and initializes the Stats panel.
*/
- Stats::Stats(BaseObject* creator)
- : OrxonoxOverlay(creator)
+ Stats::Stats(Context* context)
+ : OrxonoxOverlay(context)
, statsOverlayNoise_(0)
, statsOverlayBorder_(0)
{
Modified: code/trunk/src/modules/overlays/stats/Stats.h
===================================================================
--- code/trunk/src/modules/overlays/stats/Stats.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/overlays/stats/Stats.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OverlaysExport Stats : public OrxonoxOverlay, public Tickable
{
public: // functions
- Stats(BaseObject* creator);
+ Stats(Context* context);
virtual ~Stats();
void setConfigValues();
Modified: code/trunk/src/modules/pickup/CollectiblePickup.cc
===================================================================
--- code/trunk/src/modules/pickup/CollectiblePickup.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/CollectiblePickup.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,7 +37,9 @@
#include "PickupCollection.h"
-namespace orxonox {
+namespace orxonox
+{
+ RegisterAbstractClass(CollectiblePickup).inheritsFrom(Class(Pickupable));
/**
@brief
Modified: code/trunk/src/modules/pickup/Pickup.cc
===================================================================
--- code/trunk/src/modules/pickup/Pickup.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/Pickup.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -47,7 +47,7 @@
/*static*/ const std::string Pickup::durationTypeOnce_s = "once";
/*static*/ const std::string Pickup::durationTypeContinuous_s = "continuous";
- CreateUnloadableFactory(Pickup);
+ RegisterUnloadableClass(Pickup);
/**
@brief
@@ -55,7 +55,7 @@
@param creator
The objects creator.
*/
- Pickup::Pickup(BaseObject* creator) : BaseObject(creator)
+ Pickup::Pickup(Context* context) : BaseObject(context)
{
RegisterObject(Pickup);
@@ -186,7 +186,7 @@
*/
bool Pickup::createSpawner(void)
{
- PickupSpawner::createDroppedPickup(this, this, this->getCarrier());
+ PickupSpawner::createDroppedPickup(this->getContext(), this, this->getCarrier());
return true;
}
Modified: code/trunk/src/modules/pickup/Pickup.h
===================================================================
--- code/trunk/src/modules/pickup/Pickup.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/Pickup.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -99,7 +99,7 @@
{
public:
- Pickup(BaseObject* creator); //!< Constructor.
+ Pickup(Context* context); //!< Constructor.
virtual ~Pickup(); //!< Destructor.
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/pickup/PickupCollection.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupCollection.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/PickupCollection.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,7 +44,7 @@
namespace orxonox
{
- CreateFactory(PickupCollection);
+ RegisterClass(PickupCollection);
/**
@brief
@@ -52,7 +52,7 @@
@param creator
The creator of the object.
*/
- PickupCollection::PickupCollection(BaseObject* creator) : BaseObject(creator)
+ PickupCollection::PickupCollection(Context* context) : BaseObject(context)
{
RegisterObject(PickupCollection);
@@ -327,7 +327,7 @@
*/
bool PickupCollection::createSpawner(void)
{
- PickupSpawner::createDroppedPickup(this, this, this->getCarrier());
+ PickupSpawner::createDroppedPickup(this->getContext(), this, this->getCarrier());
return true;
}
Modified: code/trunk/src/modules/pickup/PickupCollection.h
===================================================================
--- code/trunk/src/modules/pickup/PickupCollection.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/PickupCollection.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -69,7 +69,7 @@
{
public:
- PickupCollection(BaseObject* creator); //!< Default Constructor.
+ PickupCollection(Context* context); //!< Default Constructor.
virtual ~PickupCollection(); //!< Destructor.
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Creates an instance of this Class through XML.
Modified: code/trunk/src/modules/pickup/PickupManager.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupManager.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/PickupManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,7 +36,7 @@
#include "core/CoreIncludes.h"
#include "core/LuaState.h"
#include "core/GUIManager.h"
-#include "core/Identifier.h"
+#include "core/class/Identifier.h"
#include "network/Host.h"
#include "network/NetworkFunction.h"
#include "util/ScopedSingletonManager.h"
Modified: code/trunk/src/modules/pickup/PickupManager.h
===================================================================
--- code/trunk/src/modules/pickup/PickupManager.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/PickupManager.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,7 +38,7 @@
#include "PickupPrereqs.h"
#include <map>
-#include "core/WeakPtr.h"
+#include "core/object/WeakPtr.h"
#include "PickupRepresentation.h"
Modified: code/trunk/src/modules/pickup/PickupRepresentation.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupRepresentation.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/PickupRepresentation.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,7 +44,7 @@
namespace orxonox
{
- CreateFactory(PickupRepresentation);
+ RegisterClass(PickupRepresentation);
/**
@brief
@@ -63,7 +63,7 @@
@brief
Default Constructor. Registers the object and initializes its member variables.
*/
- PickupRepresentation::PickupRepresentation(BaseObject* creator) : BaseObject(creator), Synchronisable(creator), spawnerRepresentation_(NULL)
+ PickupRepresentation::PickupRepresentation(Context* context) : BaseObject(context), Synchronisable(context), spawnerRepresentation_(NULL)
{
RegisterObject(PickupRepresentation);
@@ -179,12 +179,12 @@
//TODO: Possibility to define default representation through XML?
StaticEntity* PickupRepresentation::getDefaultSpawnerRepresentation(PickupSpawner* spawner)
{
- StaticEntity* representation = new StaticEntity(spawner);
- Billboard* sphere = new Billboard(spawner);
+ StaticEntity* representation = new StaticEntity(spawner->getContext());
+ Billboard* sphere = new Billboard(spawner->getContext());
sphere->setColour(ColourValue(0.95f, 0.85f, 0.27f));
sphere->setMaterial("Sphere2");
sphere->setScale(0.1f);
- Billboard* icon = new Billboard(spawner);
+ Billboard* icon = new Billboard(spawner->getContext());
icon->setColour(ColourValue(0.89f, 0.79f, 0.08f));
icon->setMaterial("asterisk");
icon->setScale(0.5);
Modified: code/trunk/src/modules/pickup/PickupRepresentation.h
===================================================================
--- code/trunk/src/modules/pickup/PickupRepresentation.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/PickupRepresentation.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -94,7 +94,7 @@
public:
PickupRepresentation(); //!< Constructor
- PickupRepresentation(BaseObject* creator); //!< Default constructor.
+ PickupRepresentation(Context* context); //!< Default constructor.
virtual ~PickupRepresentation(); //!< Destructor.
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a PickupRepresentation object through XML.
Modified: code/trunk/src/modules/pickup/PickupSpawner.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupSpawner.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/PickupSpawner.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -46,7 +46,7 @@
namespace orxonox
{
- CreateFactory(PickupSpawner);
+ RegisterClass(PickupSpawner);
/**
@brief
@@ -54,7 +54,7 @@
@param creator
Pointer to the object which created this item.
*/
- PickupSpawner::PickupSpawner(BaseObject* creator) : StaticEntity(creator), pickup_(NULL), representation_(NULL), pickupTemplate_(NULL)
+ PickupSpawner::PickupSpawner(Context* context) : StaticEntity(context), pickup_(NULL), representation_(NULL), pickupTemplate_(NULL)
{
RegisterObject(PickupSpawner);
@@ -98,9 +98,9 @@
@param triggerDistance
The distance at which the PickupSpawner will trigger.
*/
- /*static*/ PickupSpawner* PickupSpawner::createDroppedPickup(BaseObject* creator, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance)
+ /*static*/ PickupSpawner* PickupSpawner::createDroppedPickup(Context* context, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance)
{
- PickupSpawner* spawner = new PickupSpawner(creator);
+ PickupSpawner* spawner = new PickupSpawner(context);
spawner->setPickupable(pickup);
spawner->setTriggerDistance(triggerDistance);
@@ -288,7 +288,7 @@
Identifier* identifier = this->pickupTemplate_->getBaseclassIdentifier();
if (identifier != NULL)
{
- Pickupable* pickup = orxonox_cast<Pickupable*>(identifier->fabricate(this));
+ Pickupable* pickup = orxonox_cast<Pickupable*>(identifier->fabricate(this->getContext()));
orxonox_cast<BaseObject*>(pickup)->addTemplate(this->pickupTemplate_);
return pickup;
}
Modified: code/trunk/src/modules/pickup/PickupSpawner.h
===================================================================
--- code/trunk/src/modules/pickup/PickupSpawner.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/PickupSpawner.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -76,10 +76,10 @@
class _PickupExport PickupSpawner : public StaticEntity, public Tickable
{
public:
- PickupSpawner(BaseObject* creator); //!< Default Constructor.
+ PickupSpawner(Context* context); //!< Default Constructor.
virtual ~PickupSpawner(); //!< Destructor.
- static PickupSpawner* createDroppedPickup(BaseObject* creator, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance = 10.0);
+ static PickupSpawner* createDroppedPickup(Context* context, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance = 10.0);
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a PickupSpawner through XML.
virtual void tick(float dt); //!< Tick, checks if any Pawn is close enough to trigger.
Modified: code/trunk/src/modules/pickup/items/DamageBoostPickup.cc
===================================================================
--- code/trunk/src/modules/pickup/items/DamageBoostPickup.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/items/DamageBoostPickup.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,13 +41,13 @@
namespace orxonox
{
- CreateFactory(DamageBoostPickup);
+ RegisterClass(DamageBoostPickup);
/**
@brief
Constructor. Registers the object and initializes the member variables.
*/
- DamageBoostPickup::DamageBoostPickup(BaseObject* creator) : Pickup(creator)
+ DamageBoostPickup::DamageBoostPickup(Context* context) : Pickup(context)
{
RegisterObject(DamageBoostPickup);
Modified: code/trunk/src/modules/pickup/items/DamageBoostPickup.h
===================================================================
--- code/trunk/src/modules/pickup/items/DamageBoostPickup.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/items/DamageBoostPickup.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -48,7 +48,7 @@
{
public:
- DamageBoostPickup(BaseObject* creator); //!< Constructor.
+ DamageBoostPickup(Context* context); //!< Constructor.
virtual ~DamageBoostPickup(); //!< Destructor.
virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a DamageBoostPickup object through XML.
Modified: code/trunk/src/modules/pickup/items/DronePickup.cc
===================================================================
--- code/trunk/src/modules/pickup/items/DronePickup.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/items/DronePickup.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,13 +44,13 @@
namespace orxonox
{
- CreateFactory(DronePickup);
+ RegisterClass(DronePickup);
/**
@brief
Constructor. Registers the object and initializes the member variables.
*/
- DronePickup::DronePickup(BaseObject* creator) : Pickup(creator)
+ DronePickup::DronePickup(Context* context) : Pickup(context)
{
RegisterObject(DronePickup);
@@ -125,7 +125,7 @@
this->Pickupable::destroy();
//Attach to pawn
- Drone* drone = new Drone(pawn->getCreator()); // this is neccessary because the projectiles fired need a valid creator for the particlespawner (when colliding against something)
+ Drone* drone = new Drone(pawn->getContext()); // this is neccessary because the projectiles fired need a valid creator for the particlespawner (when colliding against something)
drone->addTemplate(this->getDroneTemplate());
Controller* controller = drone->getController();
Modified: code/trunk/src/modules/pickup/items/DronePickup.h
===================================================================
--- code/trunk/src/modules/pickup/items/DronePickup.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/items/DronePickup.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -63,7 +63,7 @@
{
public:
- DronePickup(BaseObject* creator); //!< Constructor.
+ DronePickup(Context* context); //!< Constructor.
virtual ~DronePickup(); //!< Destructor.
virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a DronePickup object through XML.
Modified: code/trunk/src/modules/pickup/items/HealthPickup.cc
===================================================================
--- code/trunk/src/modules/pickup/items/HealthPickup.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/items/HealthPickup.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -46,13 +46,13 @@
/*static*/ const std::string HealthPickup::healthTypeTemporary_s = "temporary";
/*static*/ const std::string HealthPickup::healthTypePermanent_s = "permanent";
- CreateFactory(HealthPickup);
+ RegisterClass(HealthPickup);
/**
@brief
Constructor. Registers the object and initializes the member variables.
*/
- HealthPickup::HealthPickup(BaseObject* creator) : Pickup(creator)
+ HealthPickup::HealthPickup(Context* context) : Pickup(context)
{
RegisterObject(HealthPickup);
Modified: code/trunk/src/modules/pickup/items/HealthPickup.h
===================================================================
--- code/trunk/src/modules/pickup/items/HealthPickup.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/items/HealthPickup.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -89,7 +89,7 @@
{
public:
- HealthPickup(BaseObject* creator); //!< Constructor.
+ HealthPickup(Context* context); //!< Constructor.
virtual ~HealthPickup(); //!< Destructor.
virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a HealthPickup object through XML.
Modified: code/trunk/src/modules/pickup/items/InvisiblePickup.cc
===================================================================
--- code/trunk/src/modules/pickup/items/InvisiblePickup.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/items/InvisiblePickup.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,13 +44,13 @@
namespace orxonox
{
- CreateFactory(InvisiblePickup);
+ RegisterClass(InvisiblePickup);
/**
@brief
Constructor. Registers the object and initializes the member variables.
*/
- InvisiblePickup::InvisiblePickup(BaseObject* creator) : Pickup(creator)
+ InvisiblePickup::InvisiblePickup(Context* context) : Pickup(context)
{
RegisterObject(InvisiblePickup);
this->initialize();
Modified: code/trunk/src/modules/pickup/items/InvisiblePickup.h
===================================================================
--- code/trunk/src/modules/pickup/items/InvisiblePickup.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/items/InvisiblePickup.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -69,7 +69,7 @@
{
public:
- InvisiblePickup(BaseObject* creator); //!< Constructor.
+ InvisiblePickup(Context* context); //!< Constructor.
virtual ~InvisiblePickup(); //!< Destructor.
virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a HealthPickup object through XML.
Modified: code/trunk/src/modules/pickup/items/MetaPickup.cc
===================================================================
--- code/trunk/src/modules/pickup/items/MetaPickup.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/items/MetaPickup.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,7 +41,7 @@
namespace orxonox {
- CreateFactory(MetaPickup);
+ RegisterClass(MetaPickup);
//! Setting the static variables to their values.
/*static*/ const std::string MetaPickup::metaTypeNone_s = "none";
@@ -54,7 +54,7 @@
@brief
Constructor. Registers and initializes the object.
*/
- MetaPickup::MetaPickup(BaseObject* creator) : Pickup(creator)
+ MetaPickup::MetaPickup(Context* context) : Pickup(context)
{
RegisterObject(MetaPickup);
Modified: code/trunk/src/modules/pickup/items/MetaPickup.h
===================================================================
--- code/trunk/src/modules/pickup/items/MetaPickup.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/items/MetaPickup.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -88,7 +88,7 @@
{
public:
- MetaPickup(BaseObject* creator); //!< Constructor. Registers and initializes the object.
+ MetaPickup(Context* context); //!< Constructor. Registers and initializes the object.
virtual ~MetaPickup(); //!< Destructor.
virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a MetaPickup object through XML.
Modified: code/trunk/src/modules/pickup/items/ShieldPickup.cc
===================================================================
--- code/trunk/src/modules/pickup/items/ShieldPickup.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/items/ShieldPickup.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,13 +41,13 @@
namespace orxonox
{
- CreateFactory(ShieldPickup);
+ RegisterClass(ShieldPickup);
/**
@brief
Constructor. Registers the object and initializes the member variables.
*/
- ShieldPickup::ShieldPickup(BaseObject* creator) : Pickup(creator)
+ ShieldPickup::ShieldPickup(Context* context) : Pickup(context)
{
RegisterObject(ShieldPickup);
Modified: code/trunk/src/modules/pickup/items/ShieldPickup.h
===================================================================
--- code/trunk/src/modules/pickup/items/ShieldPickup.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/items/ShieldPickup.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -75,7 +75,7 @@
{
public:
- ShieldPickup(BaseObject* creator); //!< Constructor.
+ ShieldPickup(Context* context); //!< Constructor.
virtual ~ShieldPickup(); //!< Destructor.
virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a HealthPickup object through XML.
Modified: code/trunk/src/modules/pickup/items/ShrinkPickup.cc
===================================================================
--- code/trunk/src/modules/pickup/items/ShrinkPickup.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/items/ShrinkPickup.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -45,13 +45,13 @@
namespace orxonox
{
- CreateFactory(ShrinkPickup);
+ RegisterClass(ShrinkPickup);
/**
@brief
Constructor: Initializes the Pickup.
*/
- ShrinkPickup::ShrinkPickup(BaseObject* creator) : Pickup(creator)
+ ShrinkPickup::ShrinkPickup(Context* context) : Pickup(context)
{
RegisterObject(ShrinkPickup);
Modified: code/trunk/src/modules/pickup/items/ShrinkPickup.h
===================================================================
--- code/trunk/src/modules/pickup/items/ShrinkPickup.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/items/ShrinkPickup.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -71,7 +71,7 @@
class _PickupExport ShrinkPickup : public Pickup, public Tickable
{
public:
- ShrinkPickup(BaseObject* creator); // Constructor.
+ ShrinkPickup(Context* context); // Constructor.
virtual ~ShrinkPickup(); // Destructor.
virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode);
Modified: code/trunk/src/modules/pickup/items/SpeedPickup.cc
===================================================================
--- code/trunk/src/modules/pickup/items/SpeedPickup.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/items/SpeedPickup.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,13 +41,13 @@
namespace orxonox
{
- CreateFactory(SpeedPickup);
+ RegisterClass(SpeedPickup);
/**
@brief
Constructor. Registers the object and initializes the member variables.
*/
- SpeedPickup::SpeedPickup(BaseObject* creator) : Pickup(creator)
+ SpeedPickup::SpeedPickup(Context* context) : Pickup(context)
{
RegisterObject(SpeedPickup);
Modified: code/trunk/src/modules/pickup/items/SpeedPickup.h
===================================================================
--- code/trunk/src/modules/pickup/items/SpeedPickup.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pickup/items/SpeedPickup.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -74,7 +74,7 @@
{
public:
- SpeedPickup(BaseObject* creator); //!< Constructor.
+ SpeedPickup(Context* context); //!< Constructor.
virtual ~SpeedPickup(); //!< Destructor.
virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a HealthPickup object through XML.
Modified: code/trunk/src/modules/pong/Pong.cc
===================================================================
--- code/trunk/src/modules/pong/Pong.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pong/Pong.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,7 +36,7 @@
#include "core/CoreIncludes.h"
#include "core/EventIncludes.h"
#include "core/command/Executor.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "gamestates/GSLevel.h"
#include "chat/ChatManager.h"
@@ -52,13 +52,13 @@
CreateEventName(PongCenterpoint, right);
CreateEventName(PongCenterpoint, left);
- CreateUnloadableFactory(Pong);
+ RegisterUnloadableClass(Pong);
/**
@brief
Constructor. Registers and initializes the object.
*/
- Pong::Pong(BaseObject* creator) : Deathmatch(creator)
+ Pong::Pong(Context* context) : Deathmatch(context)
{
RegisterObject(Pong);
@@ -128,7 +128,7 @@
{
if (this->ball_ == NULL) // If there is no ball, create a new ball.
{
- this->ball_ = new PongBall(this->center_);
+ this->ball_ = new PongBall(this->center_->getContext());
// Apply the template for the ball specified by the centerpoint.
this->ball_->addTemplate(this->center_->getBalltemplate());
}
@@ -146,7 +146,7 @@
{
if (this->bat_[i] == NULL)
{
- this->bat_[i] = new PongBat(this->center_);
+ this->bat_[i] = new PongBat(this->center_->getContext());
this->bat_[i]->addTemplate(this->center_->getBattemplate());
}
}
Modified: code/trunk/src/modules/pong/Pong.h
===================================================================
--- code/trunk/src/modules/pong/Pong.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pong/Pong.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -64,7 +64,7 @@
class _PongExport Pong : public Deathmatch
{
public:
- Pong(BaseObject* creator); //!< Constructor. Registers and initializes the object.
+ Pong(Context* context); //!< Constructor. Registers and initializes the object.
virtual ~Pong(); //!< Destructor. Cleans up, if initialized.
virtual void start(); //!< Starts the Pong minigame.
Modified: code/trunk/src/modules/pong/PongAI.cc
===================================================================
--- code/trunk/src/modules/pong/PongAI.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pong/PongAI.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,7 +34,7 @@
#include "PongAI.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/command/Executor.h"
#include "tools/Timer.h"
@@ -44,7 +44,7 @@
namespace orxonox
{
- CreateUnloadableFactory(PongAI);
+ RegisterUnloadableClass(PongAI);
const static float MAX_REACTION_TIME = 0.4f;
@@ -52,7 +52,7 @@
@brief
Constructor. Registers and initializes the object.
*/
- PongAI::PongAI(BaseObject* creator) : Controller(creator)
+ PongAI::PongAI(Context* context) : Controller(context)
{
RegisterObject(PongAI);
Modified: code/trunk/src/modules/pong/PongAI.h
===================================================================
--- code/trunk/src/modules/pong/PongAI.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pong/PongAI.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,6 +43,7 @@
#include "tools/interfaces/Tickable.h"
#include "controllers/Controller.h"
+#include "PongBall.h"
namespace orxonox
{
@@ -59,7 +60,7 @@
class _PongExport PongAI : public Controller, public Tickable
{
public:
- PongAI(BaseObject* creator); //!< Constructor. Registers and initializes the object.
+ PongAI(Context* context); //!< Constructor. Registers and initializes the object.
virtual ~PongAI();
void setConfigValues();
Modified: code/trunk/src/modules/pong/PongBall.cc
===================================================================
--- code/trunk/src/modules/pong/PongBall.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pong/PongBall.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,7 +42,7 @@
namespace orxonox
{
- CreateFactory(PongBall);
+ RegisterClass(PongBall);
const float PongBall::MAX_REL_Z_VELOCITY = 1.5;
@@ -50,8 +50,8 @@
@brief
Constructor. Registers and initializes the object.
*/
- PongBall::PongBall(BaseObject* creator)
- : MovableEntity(creator)
+ PongBall::PongBall(Context* context)
+ : MovableEntity(context)
{
RegisterObject(PongBall);
Modified: code/trunk/src/modules/pong/PongBall.h
===================================================================
--- code/trunk/src/modules/pong/PongBall.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pong/PongBall.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -58,7 +58,7 @@
class _PongExport PongBall : public MovableEntity
{
public:
- PongBall(BaseObject* creator);
+ PongBall(Context* context);
virtual ~PongBall();
virtual void tick(float dt);
Modified: code/trunk/src/modules/pong/PongBat.cc
===================================================================
--- code/trunk/src/modules/pong/PongBat.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pong/PongBat.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,13 +38,13 @@
namespace orxonox
{
- CreateFactory(PongBat);
+ RegisterClass(PongBat);
/**
@brief
Constructor. Registers and initializes the object.
*/
- PongBat::PongBat(BaseObject* creator) : ControllableEntity(creator)
+ PongBat::PongBat(Context* context) : ControllableEntity(context)
{
RegisterObject(PongBat);
Modified: code/trunk/src/modules/pong/PongBat.h
===================================================================
--- code/trunk/src/modules/pong/PongBat.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pong/PongBat.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -56,7 +56,7 @@
class _PongExport PongBat : public ControllableEntity
{
public:
- PongBat(BaseObject* creator); //!< Constructor. Registers and initializes the object.
+ PongBat(Context* context); //!< Constructor. Registers and initializes the object.
virtual ~PongBat() {}
virtual void tick(float dt);
Modified: code/trunk/src/modules/pong/PongBot.cc
===================================================================
--- code/trunk/src/modules/pong/PongBot.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pong/PongBot.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,13 +38,13 @@
namespace orxonox
{
- CreateFactory(PongBot);
+ RegisterClass(PongBot);
/**
@brief
Constructor. Registers the object and creates a PongAI controller.
*/
- PongBot::PongBot(BaseObject* creator) : Bot(creator)
+ PongBot::PongBot(Context* context) : Bot(context)
{
RegisterObject(PongBot);
Modified: code/trunk/src/modules/pong/PongBot.h
===================================================================
--- code/trunk/src/modules/pong/PongBot.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pong/PongBot.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -55,7 +55,7 @@
class _PongExport PongBot : public Bot
{
public:
- PongBot(BaseObject* creator);
+ PongBot(Context* context);
virtual ~PongBot() {}
};
}
Modified: code/trunk/src/modules/pong/PongCenterpoint.cc
===================================================================
--- code/trunk/src/modules/pong/PongCenterpoint.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pong/PongCenterpoint.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,13 +40,13 @@
namespace orxonox
{
- CreateFactory(PongCenterpoint);
+ RegisterClass(PongCenterpoint);
/**
@brief
Constructor. Registers and initializes the object and checks whether the gametype is actually Pong.
*/
- PongCenterpoint::PongCenterpoint(BaseObject* creator) : StaticEntity(creator)
+ PongCenterpoint::PongCenterpoint(Context* context) : StaticEntity(context)
{
RegisterObject(PongCenterpoint);
Modified: code/trunk/src/modules/pong/PongCenterpoint.h
===================================================================
--- code/trunk/src/modules/pong/PongCenterpoint.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pong/PongCenterpoint.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -120,7 +120,7 @@
class _PongExport PongCenterpoint : public StaticEntity
{
public:
- PongCenterpoint(BaseObject* creator); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually Pong.
+ PongCenterpoint(Context* context); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually Pong.
virtual ~PongCenterpoint() {}
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method to create a PongCenterpoint through XML.
Modified: code/trunk/src/modules/pong/PongScore.cc
===================================================================
--- code/trunk/src/modules/pong/PongScore.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pong/PongScore.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,13 +43,13 @@
namespace orxonox
{
- CreateFactory(PongScore);
+ RegisterClass(PongScore);
/**
@brief
Constructor. Registers and initializes the object.
*/
- PongScore::PongScore(BaseObject* creator) : OverlayText(creator)
+ PongScore::PongScore(Context* context) : OverlayText(context)
{
RegisterObject(PongScore);
Modified: code/trunk/src/modules/pong/PongScore.h
===================================================================
--- code/trunk/src/modules/pong/PongScore.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/pong/PongScore.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -56,7 +56,7 @@
class _PongExport PongScore : public OverlayText, public Tickable
{
public:
- PongScore(BaseObject* creator);
+ PongScore(Context* context);
virtual ~PongScore();
virtual void tick(float dt); //!< Creates and sets the caption to be displayed by the PongScore.
Modified: code/trunk/src/modules/portals/PortalEndPoint.cc
===================================================================
--- code/trunk/src/modules/portals/PortalEndPoint.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/portals/PortalEndPoint.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,17 +41,17 @@
namespace orxonox
{
- CreateFactory(PortalEndPoint);
+ RegisterClass(PortalEndPoint);
/*static*/ const std::string PortalEndPoint::EVENTFUNCTIONNAME = "execute";
std::map<unsigned int, PortalEndPoint *> PortalEndPoint::idMap_s;
- PortalEndPoint::PortalEndPoint(BaseObject* creator) : StaticEntity(creator), RadarViewable(creator, static_cast<WorldEntity*>(this)), id_(0), trigger_(NULL), reenterDelay_(0)
+ PortalEndPoint::PortalEndPoint(Context* context) : StaticEntity(context), RadarViewable(this, static_cast<WorldEntity*>(this)), id_(0), trigger_(NULL), reenterDelay_(0)
{
RegisterObject(PortalEndPoint);
- this->trigger_ = new DistanceMultiTrigger(this);
+ this->trigger_ = new DistanceMultiTrigger(this->getContext());
this->trigger_->setName("portal");
this->attach(this->trigger_);
@@ -60,7 +60,7 @@
this->setRadarVisibility(true);
if( GameMode::isMaster() )
{
- this->portalSound_ = new WorldSound(this);
+ this->portalSound_ = new WorldSound(this->getContext());
this->portalSound_->setLooping(false);
this->attach(this->portalSound_);
this->portalSound_->setSource("sounds/Weapon_HsW01.ogg"); //TODO: change sound file
Modified: code/trunk/src/modules/portals/PortalEndPoint.h
===================================================================
--- code/trunk/src/modules/portals/PortalEndPoint.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/portals/PortalEndPoint.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -59,7 +59,7 @@
class _PortalsExport PortalEndPoint : public StaticEntity, public RadarViewable
{
public:
- PortalEndPoint(BaseObject* creator);
+ PortalEndPoint(Context* context);
virtual ~PortalEndPoint();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/portals/PortalLink.cc
===================================================================
--- code/trunk/src/modules/portals/PortalLink.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/portals/PortalLink.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,11 +35,11 @@
namespace orxonox
{
- CreateFactory(PortalLink);
+ RegisterClass(PortalLink);
std::map<PortalEndPoint *, PortalEndPoint *> PortalLink::links_s;
- PortalLink::PortalLink(BaseObject* creator) : BaseObject(creator), fromID_(0), toID_(0), from_(0), to_(0)
+ PortalLink::PortalLink(Context* context) : BaseObject(context), fromID_(0), toID_(0), from_(0), to_(0)
{
RegisterObject(PortalLink);
}
Modified: code/trunk/src/modules/portals/PortalLink.h
===================================================================
--- code/trunk/src/modules/portals/PortalLink.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/portals/PortalLink.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -53,7 +53,7 @@
class _PortalsExport PortalLink : public BaseObject
{
public:
- PortalLink(BaseObject* creator);
+ PortalLink(Context* context);
virtual ~PortalLink();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/questsystem/GlobalQuest.cc
===================================================================
--- code/trunk/src/modules/questsystem/GlobalQuest.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/GlobalQuest.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,13 +40,13 @@
namespace orxonox
{
- CreateFactory(GlobalQuest);
+ RegisterClass(GlobalQuest);
/**
@brief
Constructor. Registers the object.
*/
- GlobalQuest::GlobalQuest(BaseObject* creator) : Quest(creator)
+ GlobalQuest::GlobalQuest(Context* context) : Quest(context)
{
RegisterObject(GlobalQuest);
}
Modified: code/trunk/src/modules/questsystem/GlobalQuest.h
===================================================================
--- code/trunk/src/modules/questsystem/GlobalQuest.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/GlobalQuest.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -89,7 +89,7 @@
class _QuestsystemExport GlobalQuest : public Quest
{
public:
- GlobalQuest(BaseObject* creator);
+ GlobalQuest(Context* context);
virtual ~GlobalQuest();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a GlobalQuest object through XML.
Modified: code/trunk/src/modules/questsystem/LocalQuest.cc
===================================================================
--- code/trunk/src/modules/questsystem/LocalQuest.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/LocalQuest.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,13 +40,13 @@
namespace orxonox
{
- CreateFactory(LocalQuest);
+ RegisterClass(LocalQuest);
/**
@brief
Constructor. Registers and initializes the object.
*/
- LocalQuest::LocalQuest(BaseObject* creator) : Quest(creator)
+ LocalQuest::LocalQuest(Context* context) : Quest(context)
{
RegisterObject(LocalQuest);
}
Modified: code/trunk/src/modules/questsystem/LocalQuest.h
===================================================================
--- code/trunk/src/modules/questsystem/LocalQuest.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/LocalQuest.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -83,7 +83,7 @@
class _QuestsystemExport LocalQuest : public Quest
{
public:
- LocalQuest(BaseObject* creator);
+ LocalQuest(Context* context);
virtual ~LocalQuest();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a LocalQuest object through XML.
Modified: code/trunk/src/modules/questsystem/Quest.cc
===================================================================
--- code/trunk/src/modules/questsystem/Quest.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/Quest.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,11 +44,13 @@
namespace orxonox
{
+ RegisterAbstractClass(Quest).inheritsFrom(Class(QuestItem));
+
/**
@brief
Constructor. Registers and initializes object.
*/
- Quest::Quest(BaseObject* creator) : QuestItem(creator)
+ Quest::Quest(Context* context) : QuestItem(context)
{
RegisterObject(Quest);
Modified: code/trunk/src/modules/questsystem/Quest.h
===================================================================
--- code/trunk/src/modules/questsystem/Quest.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/Quest.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -81,7 +81,7 @@
: public QuestItem
{ // tolua_export
public:
- Quest(BaseObject* creator);
+ Quest(Context* context);
virtual ~Quest();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Quest object through XML.
Modified: code/trunk/src/modules/questsystem/QuestDescription.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestDescription.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/QuestDescription.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,7 +43,7 @@
namespace orxonox
{
- CreateFactory(QuestDescription);
+ RegisterClass(QuestDescription);
/*static*/ const std::string QuestDescription::SENDER = "questsystem";
@@ -51,7 +51,7 @@
@brief
Constructor. Registers and initializes the object.
*/
- QuestDescription::QuestDescription(BaseObject* creator) : BaseObject(creator)
+ QuestDescription::QuestDescription(Context* context) : BaseObject(context)
{
RegisterObject(QuestDescription);
}
Modified: code/trunk/src/modules/questsystem/QuestDescription.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestDescription.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/QuestDescription.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -63,7 +63,7 @@
{
// tolua_end
public:
- QuestDescription(BaseObject* creator);
+ QuestDescription(Context* context);
virtual ~QuestDescription();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestDescription object through XML.
Modified: code/trunk/src/modules/questsystem/QuestEffect.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestEffect.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/QuestEffect.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,12 +36,14 @@
namespace orxonox
{
+ RegisterAbstractClass(QuestEffect).inheritsFrom(Class(BaseObject));
+
/**
@brief
Constructor. Creates a new QuestEffect.
Is not meant to be invoked directly, since this is only an interface.
*/
- QuestEffect::QuestEffect(BaseObject* creator) : BaseObject(creator)
+ QuestEffect::QuestEffect(Context* context) : BaseObject(context)
{
RegisterObject(QuestEffect);
}
Modified: code/trunk/src/modules/questsystem/QuestEffect.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestEffect.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/QuestEffect.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -56,7 +56,7 @@
class _QuestsystemExport QuestEffect : public BaseObject
{
public:
- QuestEffect(BaseObject* creator);
+ QuestEffect(Context* context);
virtual ~QuestEffect();
virtual bool invoke(PlayerInfo* player) = 0; //!< Invokes the QuestEffect.
Modified: code/trunk/src/modules/questsystem/QuestEffectBeacon.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestEffectBeacon.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/QuestEffectBeacon.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,13 +44,13 @@
namespace orxonox
{
- CreateFactory(QuestEffectBeacon);
+ RegisterClass(QuestEffectBeacon);
/**
@brief
Constructor. Registers the object and initializes defaults.
*/
- QuestEffectBeacon::QuestEffectBeacon(BaseObject* creator) : StaticEntity(creator)
+ QuestEffectBeacon::QuestEffectBeacon(Context* context) : StaticEntity(context)
{
RegisterObject(QuestEffectBeacon);
Modified: code/trunk/src/modules/questsystem/QuestEffectBeacon.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestEffectBeacon.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/QuestEffectBeacon.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -92,7 +92,7 @@
class _QuestsystemExport QuestEffectBeacon : public StaticEntity
{
public:
- QuestEffectBeacon(BaseObject* creator);
+ QuestEffectBeacon(Context* context);
virtual ~QuestEffectBeacon();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestEffectBeacon object through XML.
Modified: code/trunk/src/modules/questsystem/QuestHint.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestHint.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/QuestHint.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,13 +42,13 @@
namespace orxonox
{
- CreateFactory(QuestHint);
+ RegisterClass(QuestHint);
/**
@brief
Constructor. Registers the object.
*/
- QuestHint::QuestHint(BaseObject* creator) : QuestItem(creator)
+ QuestHint::QuestHint(Context* context) : QuestItem(context)
{
RegisterObject(QuestHint);
}
Modified: code/trunk/src/modules/questsystem/QuestHint.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestHint.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/QuestHint.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -81,7 +81,7 @@
{ // tolua_export
public:
- QuestHint(BaseObject* creator);
+ QuestHint(Context* context);
virtual ~QuestHint();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestHint object through XML.
Modified: code/trunk/src/modules/questsystem/QuestItem.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestItem.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/QuestItem.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,13 +41,13 @@
namespace orxonox
{
- CreateUnloadableFactory(QuestItem);
+ RegisterUnloadableClass(QuestItem);
/**
@brief
Constructor. Registers and initializes the object.
*/
- QuestItem::QuestItem(BaseObject* creator) : BaseObject(creator)
+ QuestItem::QuestItem(Context* context) : BaseObject(context)
{
this->registered_ = false;
Modified: code/trunk/src/modules/questsystem/QuestItem.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestItem.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/QuestItem.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -59,7 +59,7 @@
{
public:
- QuestItem(BaseObject* creator);
+ QuestItem(Context* context);
virtual ~QuestItem();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestItem object through XML.
Modified: code/trunk/src/modules/questsystem/QuestListener.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestListener.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/QuestListener.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,7 +41,7 @@
namespace orxonox
{
- CreateFactory(QuestListener);
+ RegisterClass(QuestListener);
// Initialization of the static variables for the modes as strings.
/*static*/ const std::string QuestListener::ALL = "all";
@@ -53,7 +53,7 @@
@brief
Constructor. Registers the object and initializes variables.
*/
- QuestListener::QuestListener(BaseObject* creator) : BaseObject(creator)
+ QuestListener::QuestListener(Context* context) : BaseObject(context)
{
RegisterObject(QuestListener);
Modified: code/trunk/src/modules/questsystem/QuestListener.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestListener.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/QuestListener.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -86,7 +86,7 @@
{
public:
- QuestListener(BaseObject* creator);
+ QuestListener(Context* context);
virtual ~QuestListener();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestListener object through XML.
Modified: code/trunk/src/modules/questsystem/QuestManager.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestManager.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/QuestManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,7 +37,6 @@
#include "util/OrxAssert.h"
#include "util/ScopedSingletonManager.h"
#include "core/command/ConsoleCommand.h"
-#include "core/CoreIncludes.h"
#include "core/GUIManager.h"
#include "core/LuaState.h"
@@ -59,7 +58,6 @@
*/
QuestManager::QuestManager()
{
- RegisterRootObject(QuestManager);
orxout(internal_info, context::quests) << "QuestManager created." << endl;
}
Modified: code/trunk/src/modules/questsystem/QuestManager.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestManager.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/QuestManager.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,7 +42,6 @@
#include <string>
#include "util/Singleton.h"
-#include "core/OrxonoxClass.h"
namespace orxonox // tolua_export
{ // tolua_export
@@ -58,7 +57,7 @@
@ingroup Questsystem
*/
class _QuestsystemExport QuestManager // tolua_export
- : public Singleton<QuestManager>, public orxonox::OrxonoxClass
+ : public Singleton<QuestManager>
{ // tolua_export
friend class Singleton<QuestManager>;
Modified: code/trunk/src/modules/questsystem/effects/AddQuest.cc
===================================================================
--- code/trunk/src/modules/questsystem/effects/AddQuest.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/effects/AddQuest.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,13 +42,13 @@
namespace orxonox
{
- CreateFactory(AddQuest);
+ RegisterClass(AddQuest);
/**
@brief
Constructor. Registers the object.
*/
- AddQuest::AddQuest(BaseObject* creator) : ChangeQuestStatus(creator)
+ AddQuest::AddQuest(Context* context) : ChangeQuestStatus(context)
{
RegisterObject(AddQuest);
}
Modified: code/trunk/src/modules/questsystem/effects/AddQuest.h
===================================================================
--- code/trunk/src/modules/questsystem/effects/AddQuest.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/effects/AddQuest.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -58,7 +58,7 @@
class _QuestsystemExport AddQuest : public ChangeQuestStatus
{
public:
- AddQuest(BaseObject* creator);
+ AddQuest(Context* context);
virtual ~AddQuest();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddQuest object through XML.
Modified: code/trunk/src/modules/questsystem/effects/AddQuestHint.cc
===================================================================
--- code/trunk/src/modules/questsystem/effects/AddQuestHint.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/effects/AddQuestHint.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,13 +43,13 @@
namespace orxonox
{
- CreateFactory(AddQuestHint);
+ RegisterClass(AddQuestHint);
/**
@brief
Constructor. Registers the object.
*/
- AddQuestHint::AddQuestHint(BaseObject* creator) : QuestEffect(creator)
+ AddQuestHint::AddQuestHint(Context* context) : QuestEffect(context)
{
RegisterObject(AddQuestHint);
}
Modified: code/trunk/src/modules/questsystem/effects/AddQuestHint.h
===================================================================
--- code/trunk/src/modules/questsystem/effects/AddQuestHint.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/effects/AddQuestHint.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -60,7 +60,7 @@
class _QuestsystemExport AddQuestHint : public QuestEffect
{
public:
- AddQuestHint(BaseObject* creator);
+ AddQuestHint(Context* context);
virtual ~AddQuestHint();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddQuestHint object through XML.
Modified: code/trunk/src/modules/questsystem/effects/AddReward.cc
===================================================================
--- code/trunk/src/modules/questsystem/effects/AddReward.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/effects/AddReward.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,13 +40,13 @@
namespace orxonox
{
- CreateFactory(AddReward);
+ RegisterClass(AddReward);
/**
@brief
Constructor. Registers the object.
*/
- AddReward::AddReward(BaseObject* creator) : QuestEffect(creator)
+ AddReward::AddReward(Context* context) : QuestEffect(context)
{
RegisterObject(AddReward);
}
Modified: code/trunk/src/modules/questsystem/effects/AddReward.h
===================================================================
--- code/trunk/src/modules/questsystem/effects/AddReward.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/effects/AddReward.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -64,7 +64,7 @@
class _QuestsystemExport AddReward : public QuestEffect
{
public:
- AddReward(BaseObject* creator);
+ AddReward(Context* context);
virtual ~AddReward();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a AddReward object through XML.
Modified: code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.cc
===================================================================
--- code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,11 +41,13 @@
namespace orxonox
{
+ RegisterAbstractClass(ChangeQuestStatus).inheritsFrom(Class(QuestEffect));
+
/**
@brief
Constructor. Registers the object.
*/
- ChangeQuestStatus::ChangeQuestStatus(BaseObject* creator) : QuestEffect(creator)
+ ChangeQuestStatus::ChangeQuestStatus(Context* context) : QuestEffect(context)
{
RegisterObject(ChangeQuestStatus);
}
Modified: code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.h
===================================================================
--- code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -55,7 +55,7 @@
class _QuestsystemExport ChangeQuestStatus : public QuestEffect
{
public:
- ChangeQuestStatus(BaseObject* creator);
+ ChangeQuestStatus(Context* context);
virtual ~ChangeQuestStatus();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a ChangeQuestStatus object through XML.
Modified: code/trunk/src/modules/questsystem/effects/CompleteQuest.cc
===================================================================
--- code/trunk/src/modules/questsystem/effects/CompleteQuest.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/effects/CompleteQuest.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,13 +41,13 @@
namespace orxonox
{
- CreateFactory(CompleteQuest);
+ RegisterClass(CompleteQuest);
/**
@brief
Constructor. Registers the object.
*/
- CompleteQuest::CompleteQuest(BaseObject* creator) : ChangeQuestStatus(creator)
+ CompleteQuest::CompleteQuest(Context* context) : ChangeQuestStatus(context)
{
RegisterObject(CompleteQuest);
}
Modified: code/trunk/src/modules/questsystem/effects/CompleteQuest.h
===================================================================
--- code/trunk/src/modules/questsystem/effects/CompleteQuest.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/effects/CompleteQuest.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -58,7 +58,7 @@
class _QuestsystemExport CompleteQuest : public ChangeQuestStatus
{
public:
- CompleteQuest(BaseObject* creator);
+ CompleteQuest(Context* context);
virtual ~CompleteQuest();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a CompleteQuest object through XML.
Modified: code/trunk/src/modules/questsystem/effects/FailQuest.cc
===================================================================
--- code/trunk/src/modules/questsystem/effects/FailQuest.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/effects/FailQuest.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,13 +41,13 @@
namespace orxonox
{
- CreateFactory(FailQuest);
+ RegisterClass(FailQuest);
/**
@brief
Constructor. Registers the object.
*/
- FailQuest::FailQuest(BaseObject* creator) : ChangeQuestStatus(creator)
+ FailQuest::FailQuest(Context* context) : ChangeQuestStatus(context)
{
RegisterObject(FailQuest);
}
Modified: code/trunk/src/modules/questsystem/effects/FailQuest.h
===================================================================
--- code/trunk/src/modules/questsystem/effects/FailQuest.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/questsystem/effects/FailQuest.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -58,7 +58,7 @@
class _QuestsystemExport FailQuest : public ChangeQuestStatus
{
public:
- FailQuest(BaseObject* creator);
+ FailQuest(Context* context);
virtual ~FailQuest();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a FailQuest object through XML.
Modified: code/trunk/src/modules/tetris/Tetris.cc
===================================================================
--- code/trunk/src/modules/tetris/Tetris.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/tetris/Tetris.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -53,14 +53,14 @@
namespace orxonox
{
- CreateUnloadableFactory(Tetris);
+ RegisterUnloadableClass(Tetris);
/**
@brief
Constructor. Registers and initializes the object.
@ingroup Tetris
*/
- Tetris::Tetris(BaseObject* creator) : Deathmatch(creator)
+ Tetris::Tetris(Context* context) : Deathmatch(context)
{
RegisterObject(Tetris);
@@ -378,7 +378,7 @@
void Tetris::createBrick(void) //TODO: random rotation offset between 0 and 3 (times 90°)
{
// create new futureBrick_
- this->futureBrick_ = new TetrisBrick(this->center_);
+ this->futureBrick_ = new TetrisBrick(this->center_->getContext());
// Apply the stone template to the stone.
Modified: code/trunk/src/modules/tetris/Tetris.h
===================================================================
--- code/trunk/src/modules/tetris/Tetris.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/tetris/Tetris.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -54,7 +54,7 @@
class _TetrisExport Tetris : public Deathmatch
{
public:
- Tetris(BaseObject* creator); //!< Constructor. Registers and initializes the object.
+ Tetris(Context* context); //!< Constructor. Registers and initializes the object.
virtual ~Tetris(); //!< Destructor. Cleans up, if initialized.
virtual void start(void); //!< Starts the Tetris minigame.
Modified: code/trunk/src/modules/tetris/TetrisBrick.cc
===================================================================
--- code/trunk/src/modules/tetris/TetrisBrick.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/tetris/TetrisBrick.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,14 +43,14 @@
namespace orxonox
{
- CreateFactory(TetrisBrick);
+ RegisterClass(TetrisBrick);
/**
@brief
Constructor. Registers and initializes the object.
@ingroup Tetris
*/
- TetrisBrick::TetrisBrick(BaseObject* creator): ControllableEntity(creator)
+ TetrisBrick::TetrisBrick(Context* context): ControllableEntity(context)
{
RegisterObject(TetrisBrick);
this->shapeIndex_ = static_cast<unsigned int>(rnd(7.0f)); //<! random number between 0 and 7
@@ -76,7 +76,7 @@
for (unsigned int i = 0; i < this->stonesPerBrick_; i++)
{
// Create a new stone and add it to the brick.
- TetrisStone* stone = new TetrisStone(this);
+ TetrisStone* stone = new TetrisStone(this->getContext());
this->brickStones_.push_back(stone);
this->attach(stone);
this->formBrick(stone, i);
Modified: code/trunk/src/modules/tetris/TetrisBrick.h
===================================================================
--- code/trunk/src/modules/tetris/TetrisBrick.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/tetris/TetrisBrick.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -53,7 +53,7 @@
class _TetrisExport TetrisBrick : public ControllableEntity
{
public:
- TetrisBrick(BaseObject* creator); //!< Constructor. Registers and initializes the object.
+ TetrisBrick(Context* context); //!< Constructor. Registers and initializes the object.
virtual ~TetrisBrick() {}
virtual void moveFrontBack(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
Modified: code/trunk/src/modules/tetris/TetrisCenterpoint.cc
===================================================================
--- code/trunk/src/modules/tetris/TetrisCenterpoint.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/tetris/TetrisCenterpoint.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,13 +41,13 @@
namespace orxonox
{
- CreateFactory(TetrisCenterpoint);
+ RegisterClass(TetrisCenterpoint);
/**
@brief
Constructor. Registers and initializes the object and checks whether the gametype is actually Tetris.
*/
- TetrisCenterpoint::TetrisCenterpoint(BaseObject* creator) : StaticEntity(creator)
+ TetrisCenterpoint::TetrisCenterpoint(Context* context) : StaticEntity(context)
{
RegisterObject(TetrisCenterpoint);
Modified: code/trunk/src/modules/tetris/TetrisCenterpoint.h
===================================================================
--- code/trunk/src/modules/tetris/TetrisCenterpoint.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/tetris/TetrisCenterpoint.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -58,7 +58,7 @@
class _TetrisExport TetrisCenterpoint : public StaticEntity
{
public:
- TetrisCenterpoint(BaseObject* creator); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually Tetris.
+ TetrisCenterpoint(Context* context); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually Tetris.
virtual ~TetrisCenterpoint() {}
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method to create a TetrisCenterpoint through XML.
Modified: code/trunk/src/modules/tetris/TetrisScore.cc
===================================================================
--- code/trunk/src/modules/tetris/TetrisScore.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/tetris/TetrisScore.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,14 +44,14 @@
namespace orxonox
{
- CreateFactory(TetrisScore);
+ RegisterClass(TetrisScore);
/**
@brief
Constructor. Registers and initializes the object.
@ingroup Tetris
*/
- TetrisScore::TetrisScore(BaseObject* creator) : OverlayText(creator)
+ TetrisScore::TetrisScore(Context* context) : OverlayText(context)
{
RegisterObject(TetrisScore);
Modified: code/trunk/src/modules/tetris/TetrisScore.h
===================================================================
--- code/trunk/src/modules/tetris/TetrisScore.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/tetris/TetrisScore.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -56,7 +56,7 @@
class _TetrisExport TetrisScore : public OverlayText, public Tickable
{
public:
- TetrisScore(BaseObject* creator);
+ TetrisScore(Context* context);
virtual ~TetrisScore();
virtual void tick(float dt); //!< Creates and sets the caption to be displayed by the TetrisScore.
Modified: code/trunk/src/modules/tetris/TetrisStone.cc
===================================================================
--- code/trunk/src/modules/tetris/TetrisStone.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/tetris/TetrisStone.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,13 +41,13 @@
namespace orxonox
{
- CreateFactory(TetrisStone);
+ RegisterClass(TetrisStone);
/**
@brief
Constructor. Registers and initializes the object.
*/
- TetrisStone::TetrisStone(BaseObject* creator) : MovableEntity(creator)
+ TetrisStone::TetrisStone(Context* context) : MovableEntity(context)
{
RegisterObject(TetrisStone);
Modified: code/trunk/src/modules/tetris/TetrisStone.h
===================================================================
--- code/trunk/src/modules/tetris/TetrisStone.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/tetris/TetrisStone.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -53,7 +53,7 @@
class _TetrisExport TetrisStone : public MovableEntity
{
public:
- TetrisStone(BaseObject* creator); //!< Constructor. Registers and initializes the object.
+ TetrisStone(Context* context); //!< Constructor. Registers and initializes the object.
virtual ~TetrisStone() {}
virtual void moveFrontBack(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
Modified: code/trunk/src/modules/towerdefense/Tower.cc
===================================================================
--- code/trunk/src/modules/towerdefense/Tower.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/towerdefense/Tower.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -15,13 +15,13 @@
namespace orxonox
{
- CreateFactory(Tower);
+ RegisterClass(Tower);
/**
@brief
Constructor. Registers and initializes the object.
*/
- Tower::Tower(BaseObject* creator) : Pawn(creator)
+ Tower::Tower(Context* context) : Pawn(context)
{
RegisterObject(Tower);
Modified: code/trunk/src/modules/towerdefense/Tower.h
===================================================================
--- code/trunk/src/modules/towerdefense/Tower.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/towerdefense/Tower.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -26,7 +26,7 @@
class _TowerDefenseExport Tower : public Pawn
{
public:
- Tower(BaseObject* creator);
+ Tower(Context* context);
virtual ~Tower() {};
// Maybe later override these to move towers with cursor keys
Modified: code/trunk/src/modules/towerdefense/TowerDefense.cc
===================================================================
--- code/trunk/src/modules/towerdefense/TowerDefense.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/towerdefense/TowerDefense.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -86,15 +86,16 @@
#include "infos/PlayerInfo.h"
#include "chat/ChatManager.h"
+#include "core/CoreIncludes.h"
/* Part of a temporary hack to allow the player to add towers */
#include "core/command/ConsoleCommand.h"
namespace orxonox
{
- CreateUnloadableFactory(TowerDefense);
+ RegisterUnloadableClass(TowerDefense);
- TowerDefense::TowerDefense(BaseObject* creator) : Deathmatch(creator)
+ TowerDefense::TowerDefense(Context* context) : Deathmatch(context)
{
RegisterObject(TowerDefense);
@@ -188,7 +189,7 @@
this->stats_->buyTower(towerCost);
// Create tower
- Tower* newTower = new Tower(this->center_);
+ Tower* newTower = new Tower(this->center_->getContext());
newTower->addTemplate(this->center_->getTowerTemplate());
newTower->setPosition(static_cast<float>((x-8) * tileScale), static_cast<float>((y-8) * tileScale), 75);
Modified: code/trunk/src/modules/towerdefense/TowerDefense.h
===================================================================
--- code/trunk/src/modules/towerdefense/TowerDefense.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/towerdefense/TowerDefense.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -47,7 +47,7 @@
class _TowerDefenseExport TowerDefense : public Deathmatch
{
public:
- TowerDefense(BaseObject* creator);
+ TowerDefense(Context* context);
virtual ~TowerDefense();
virtual void start(); //<! The function is called when the gametype starts
Modified: code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.cc
===================================================================
--- code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,13 +40,13 @@
namespace orxonox
{
- CreateFactory(TowerDefenseCenterpoint);
+ RegisterClass(TowerDefenseCenterpoint);
/**
@brief
Constructor. Registers and initializes the object and checks whether the gametype is actually TowerDefense.
*/
- TowerDefenseCenterpoint::TowerDefenseCenterpoint(BaseObject* creator) : MobileEntity(creator)
+ TowerDefenseCenterpoint::TowerDefenseCenterpoint(Context* context) : MobileEntity(context)
{
RegisterObject(TowerDefenseCenterpoint);
Modified: code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.h
===================================================================
--- code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -48,7 +48,7 @@
class _TowerDefenseExport TowerDefenseCenterpoint : public MobileEntity
{
public:
- TowerDefenseCenterpoint(BaseObject* creator);
+ TowerDefenseCenterpoint(Context* context);
virtual ~TowerDefenseCenterpoint() {}
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/towerdefense/TowerDefenseController.cc
===================================================================
--- code/trunk/src/modules/towerdefense/TowerDefenseController.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/towerdefense/TowerDefenseController.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,9 +35,9 @@
namespace orxonox
{
- CreateFactory(TowerDefenseController);
+ RegisterClass(TowerDefenseController);
- TowerDefenseController::TowerDefenseController(BaseObject* creator) : WaypointController(creator)
+ TowerDefenseController::TowerDefenseController(Context* context) : WaypointController(context)
{
RegisterObject(TowerDefenseController);
Modified: code/trunk/src/modules/towerdefense/TowerDefenseController.h
===================================================================
--- code/trunk/src/modules/towerdefense/TowerDefenseController.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/towerdefense/TowerDefenseController.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _TowerDefenseExport TowerDefenseController : public WaypointController
{
public:
- TowerDefenseController(BaseObject* creator);
+ TowerDefenseController(Context* context);
virtual ~TowerDefenseController() {}
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/modules/towerdefense/TowerDefenseHUDController.cc
===================================================================
--- code/trunk/src/modules/towerdefense/TowerDefenseHUDController.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/towerdefense/TowerDefenseHUDController.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,9 +34,9 @@
namespace orxonox
{
- CreateFactory(TowerDefenseHUDController);
+ RegisterClass(TowerDefenseHUDController);
- TowerDefenseHUDController::TowerDefenseHUDController(BaseObject* creator) : OverlayText(creator)
+ TowerDefenseHUDController::TowerDefenseHUDController(Context* context) : OverlayText(context)
{
RegisterObject(TowerDefenseHUDController);
}
Modified: code/trunk/src/modules/towerdefense/TowerDefenseHUDController.h
===================================================================
--- code/trunk/src/modules/towerdefense/TowerDefenseHUDController.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/towerdefense/TowerDefenseHUDController.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -48,7 +48,7 @@
class _TowerDefenseExport TowerDefenseHUDController : public OverlayText, public Tickable
{
public:
- TowerDefenseHUDController(BaseObject* creator);
+ TowerDefenseHUDController(Context* context);
virtual ~TowerDefenseHUDController();
virtual void tick(float dt);
Modified: code/trunk/src/modules/weapons/MuzzleFlash.cc
===================================================================
--- code/trunk/src/modules/weapons/MuzzleFlash.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/MuzzleFlash.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,9 +38,9 @@
namespace orxonox
{
- CreateFactory(MuzzleFlash);
+ RegisterClass(MuzzleFlash);
- MuzzleFlash::MuzzleFlash(BaseObject* creator) : Billboard(creator)
+ MuzzleFlash::MuzzleFlash(Context* context) : Billboard(context)
{
RegisterObject(MuzzleFlash);
this->setScale(0.1f);
Modified: code/trunk/src/modules/weapons/MuzzleFlash.h
===================================================================
--- code/trunk/src/modules/weapons/MuzzleFlash.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/MuzzleFlash.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -54,7 +54,7 @@
class _WeaponsExport MuzzleFlash : public Billboard
{
public:
- MuzzleFlash(BaseObject* creator);
+ MuzzleFlash(Context* context);
virtual ~MuzzleFlash() {}
private:
Modified: code/trunk/src/modules/weapons/RocketController.cc
===================================================================
--- code/trunk/src/modules/weapons/RocketController.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/RocketController.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,13 +44,13 @@
@brief
Constructor.
*/
- RocketController::RocketController(BaseObject* creator) : Controller(creator)
+ RocketController::RocketController(Context* context) : Controller(context)
{
RegisterObject(RocketController);
// orxout() << "RocketController constructed" << endl;
// Create a rocket for the controller.
- this->rocket_ = new SimpleRocket(this);
+ this->rocket_ = new SimpleRocket(this->getContext());
this->rocket_->setController(this);
this->setControllableEntity(orxonox_cast<ControllableEntity*>(this->rocket_));
}
Modified: code/trunk/src/modules/weapons/RocketController.h
===================================================================
--- code/trunk/src/modules/weapons/RocketController.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/RocketController.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -51,7 +51,7 @@
class _WeaponsExport RocketController : public Controller, public Tickable
{
public:
- RocketController(BaseObject* creator);
+ RocketController(Context* context);
virtual ~RocketController();
virtual void tick(float dt);
Modified: code/trunk/src/modules/weapons/munitions/FusionMunition.cc
===================================================================
--- code/trunk/src/modules/weapons/munitions/FusionMunition.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/munitions/FusionMunition.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,9 +36,9 @@
namespace orxonox
{
- CreateFactory(FusionMunition);
+ RegisterClass(FusionMunition);
- FusionMunition::FusionMunition(BaseObject* creator) : Munition(creator)
+ FusionMunition::FusionMunition(Context* context) : Munition(context)
{
RegisterObject(FusionMunition);
Modified: code/trunk/src/modules/weapons/munitions/FusionMunition.h
===================================================================
--- code/trunk/src/modules/weapons/munitions/FusionMunition.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/munitions/FusionMunition.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -50,7 +50,7 @@
class _WeaponsExport FusionMunition : public Munition
{
public:
- FusionMunition(BaseObject* creator);
+ FusionMunition(Context* context);
virtual ~FusionMunition() {}
};
}
Modified: code/trunk/src/modules/weapons/munitions/LaserMunition.cc
===================================================================
--- code/trunk/src/modules/weapons/munitions/LaserMunition.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/munitions/LaserMunition.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,9 +36,9 @@
namespace orxonox
{
- CreateFactory(LaserMunition);
+ RegisterClass(LaserMunition);
- LaserMunition::LaserMunition(BaseObject* creator) : ReplenishingMunition(creator)
+ LaserMunition::LaserMunition(Context* context) : ReplenishingMunition(context)
{
RegisterObject(LaserMunition);
Modified: code/trunk/src/modules/weapons/munitions/LaserMunition.h
===================================================================
--- code/trunk/src/modules/weapons/munitions/LaserMunition.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/munitions/LaserMunition.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -50,7 +50,7 @@
class _WeaponsExport LaserMunition : public ReplenishingMunition
{
public:
- LaserMunition(BaseObject* creator);
+ LaserMunition(Context* context);
virtual ~LaserMunition() {}
};
}
Modified: code/trunk/src/modules/weapons/munitions/ReplenishingMunition.cc
===================================================================
--- code/trunk/src/modules/weapons/munitions/ReplenishingMunition.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/munitions/ReplenishingMunition.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,9 +38,9 @@
namespace orxonox
{
- CreateFactory(ReplenishingMunition);
+ RegisterClass(ReplenishingMunition);
- ReplenishingMunition::ReplenishingMunition(BaseObject* creator) : Munition(creator)
+ ReplenishingMunition::ReplenishingMunition(Context* context) : Munition(context)
{
RegisterObject(ReplenishingMunition);
Modified: code/trunk/src/modules/weapons/munitions/ReplenishingMunition.h
===================================================================
--- code/trunk/src/modules/weapons/munitions/ReplenishingMunition.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/munitions/ReplenishingMunition.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -52,7 +52,7 @@
class _WeaponsExport ReplenishingMunition : public Munition
{
public:
- ReplenishingMunition(BaseObject* creator);
+ ReplenishingMunition(Context* context);
virtual ~ReplenishingMunition() {}
protected:
Modified: code/trunk/src/modules/weapons/munitions/RocketMunition.cc
===================================================================
--- code/trunk/src/modules/weapons/munitions/RocketMunition.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/munitions/RocketMunition.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,9 +36,9 @@
namespace orxonox
{
- CreateFactory(RocketMunition);
+ RegisterClass(RocketMunition);
- RocketMunition::RocketMunition(BaseObject* creator) : Munition(creator)
+ RocketMunition::RocketMunition(Context* context) : Munition(context)
{
RegisterObject(RocketMunition);
Modified: code/trunk/src/modules/weapons/munitions/RocketMunition.h
===================================================================
--- code/trunk/src/modules/weapons/munitions/RocketMunition.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/munitions/RocketMunition.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -50,7 +50,7 @@
class _WeaponsExport RocketMunition : public Munition
{
public:
- RocketMunition(BaseObject* creator);
+ RocketMunition(Context* context);
virtual ~RocketMunition() {}
};
}
Modified: code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,13 +41,15 @@
namespace orxonox
{
+ RegisterClassNoArgs(BasicProjectile);
+
/**
@brief
Constructor. Registers the object and initializes some default values.
*/
- BasicProjectile::BasicProjectile() : OrxonoxClass()
+ BasicProjectile::BasicProjectile()
{
- RegisterRootObject(BasicProjectile);// Register the BasicProjectile class to the core
+ RegisterObject(BasicProjectile);// Register the BasicProjectile class to the core
this->bDestroy_ = false;
@@ -105,7 +107,7 @@
if (!victim || (victim && !victim->hasShield() && victim->getHealth() > 0.0f && (this->getDamage() > 0.0f || this->getHealthDamage() > 0.0f)))
{
{
- ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getCreator());
+ ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getContext());
effect->setPosition(entity->getPosition());
effect->setOrientation(entity->getOrientation());
effect->setDestroyAfterLife(true);
@@ -114,7 +116,7 @@
}
// Second effect with same condition
{
- ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getCreator());
+ ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getContext());
effect->setPosition(entity->getPosition());
effect->setOrientation(entity->getOrientation());
effect->setDestroyAfterLife(true);
@@ -126,7 +128,7 @@
// victim->isAlive() is not false until the next tick, so getHealth() > 0 is used instead
if (victim && victim->hasShield() && (this->getDamage() > 0.0f || this->getShieldDamage() > 0.0f) && victim->getHealth() > 0.0f)
{
- ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getCreator());
+ ParticleSpawner* effect = new ParticleSpawner(this->getShooter()->getContext());
effect->setDestroyAfterLife(true);
effect->setSource("Orxonox/Shield");
effect->setLifetime(0.5f);
Modified: code/trunk/src/modules/weapons/projectiles/BasicProjectile.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/BasicProjectile.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/projectiles/BasicProjectile.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,7 +38,7 @@
#include "worldentities/pawns/Pawn.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxInterface.h"
namespace orxonox
{
@@ -51,7 +51,7 @@
Simon Miescher
@ingroup WeaponsProjectiles
*/
- class _WeaponsExport BasicProjectile : public virtual OrxonoxClass
+ class _WeaponsExport BasicProjectile : public virtual OrxonoxInterface
{
public:
BasicProjectile();
Modified: code/trunk/src/modules/weapons/projectiles/BillboardProjectile.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/BillboardProjectile.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/projectiles/BillboardProjectile.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,9 +39,9 @@
namespace orxonox
{
- CreateFactory(BillboardProjectile);
+ RegisterClass(BillboardProjectile);
- BillboardProjectile::BillboardProjectile(BaseObject* creator) : Projectile(creator)
+ BillboardProjectile::BillboardProjectile(Context* context) : Projectile(context)
{
RegisterObject(BillboardProjectile);
Modified: code/trunk/src/modules/weapons/projectiles/BillboardProjectile.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/BillboardProjectile.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/projectiles/BillboardProjectile.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -54,7 +54,7 @@
class _WeaponsExport BillboardProjectile : public Projectile
{
public:
- BillboardProjectile(BaseObject* creator);
+ BillboardProjectile(Context* context);
virtual ~BillboardProjectile();
virtual void setColour(const ColourValue& colour);
Modified: code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,9 +39,9 @@
namespace orxonox
{
- CreateFactory(LightningGunProjectile);
+ RegisterClass(LightningGunProjectile);
- LightningGunProjectile::LightningGunProjectile(BaseObject* creator) : BillboardProjectile(creator)
+ LightningGunProjectile::LightningGunProjectile(Context* context) : BillboardProjectile(context)
{
RegisterObject(LightningGunProjectile);
Modified: code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -54,7 +54,7 @@
class _WeaponsExport LightningGunProjectile : public BillboardProjectile
{
public:
- LightningGunProjectile(BaseObject* creator);
+ LightningGunProjectile(Context* context);
virtual ~LightningGunProjectile() {}
virtual void setMaterial(const std::string& material);
Modified: code/trunk/src/modules/weapons/projectiles/ParticleProjectile.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/ParticleProjectile.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/projectiles/ParticleProjectile.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,9 +40,9 @@
namespace orxonox
{
- CreateFactory(ParticleProjectile);
+ RegisterClass(ParticleProjectile);
- ParticleProjectile::ParticleProjectile(BaseObject* creator) : BillboardProjectile(creator)
+ ParticleProjectile::ParticleProjectile(Context* context) : BillboardProjectile(context)
{
RegisterObject(ParticleProjectile);
@@ -64,7 +64,7 @@
if (this->isInitialized() && this->particles_)
{
this->detachOgreObject(this->particles_->getParticleSystem());
- this->particles_->destroy();
+ delete this->particles_;
}
}
Modified: code/trunk/src/modules/weapons/projectiles/ParticleProjectile.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/ParticleProjectile.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/projectiles/ParticleProjectile.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -50,7 +50,7 @@
class _WeaponsExport ParticleProjectile : public BillboardProjectile
{
public:
- ParticleProjectile(BaseObject* creator);
+ ParticleProjectile(Context* context);
virtual ~ParticleProjectile();
virtual void changedVisibility();
Modified: code/trunk/src/modules/weapons/projectiles/Projectile.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Projectile.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/projectiles/Projectile.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,7 +33,7 @@
#include "Projectile.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/CoreIncludes.h"
#include "core/GameMode.h"
#include "core/command/Executor.h"
@@ -43,9 +43,9 @@
namespace orxonox
{
- CreateFactory(Projectile);
+ RegisterClass(Projectile);
- Projectile::Projectile(BaseObject* creator) : MovableEntity(creator), BasicProjectile()
+ Projectile::Projectile(Context* context) : MovableEntity(context), BasicProjectile()
{
RegisterObject(Projectile);
@@ -59,7 +59,7 @@
this->setCollisionResponse(false);
this->setCollisionType(Kinematic);
- SphereCollisionShape* shape = new SphereCollisionShape(this);
+ SphereCollisionShape* shape = new SphereCollisionShape(this->getContext());
shape->setRadius(20.0f);
this->attachCollisionShape(shape);
Modified: code/trunk/src/modules/weapons/projectiles/Projectile.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Projectile.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/projectiles/Projectile.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -57,7 +57,7 @@
class _WeaponsExport Projectile : public MovableEntity, public BasicProjectile
{
public:
- Projectile(BaseObject* creator);
+ Projectile(Context* context);
virtual ~Projectile();
void setConfigValues();
Modified: code/trunk/src/modules/weapons/projectiles/Rocket.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Rocket.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/projectiles/Rocket.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -50,16 +50,16 @@
namespace orxonox
{
- CreateFactory(Rocket);
+ RegisterClass(Rocket);
/**
@brief
Constructor. Registers the object and initializes some default values.
*/
- Rocket::Rocket(BaseObject* creator)
- : ControllableEntity(creator)
+ Rocket::Rocket(Context* context)
+ : ControllableEntity(context)
, BasicProjectile()
- , RadarViewable(creator, static_cast<WorldEntity*>(this))
+ , RadarViewable(this, static_cast<WorldEntity*>(this))
{
RegisterObject(Rocket);// Register the Rocket class to the core
@@ -72,13 +72,13 @@
this->setVelocity(0,0,-100);
// Create rocket model
- Model* model = new Model(this);
+ Model* model = new Model(this->getContext());
model->setMeshSource("rocket.mesh");
model->scale(0.7f);
this->attach(model);
// Add effects.
- ParticleEmitter* fire = new ParticleEmitter(this);
+ ParticleEmitter* fire = new ParticleEmitter(this->getContext());
this->attach(fire);
fire->setOrientation(this->getOrientation());
fire->setSource("Orxonox/rocketfire");
@@ -88,7 +88,7 @@
this->setCollisionType(Kinematic);
// Add collision shape
- ConeCollisionShape* collisionShape = new ConeCollisionShape(this);
+ ConeCollisionShape* collisionShape = new ConeCollisionShape(this->getContext());
collisionShape->setRadius(3);
collisionShape->setHeight(500);
this->attachCollisionShape(collisionShape);
@@ -96,13 +96,13 @@
this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&BasicProjectile::destroyObject, this)));
// Add sound
- this->defSndWpnEngine_ = new WorldSound(this);
+ this->defSndWpnEngine_ = new WorldSound(this->getContext());
this->defSndWpnEngine_->setLooping(true);
this->defSndWpnEngine_->setSource("sounds/Rocket_engine.ogg");
this->defSndWpnEngine_->setVolume(1.0f);
this->attach(defSndWpnEngine_);
- this->defSndWpnLaunch_ = new WorldSound(this);
+ this->defSndWpnLaunch_ = new WorldSound(this->getContext());
this->defSndWpnLaunch_->setLooping(false);
this->defSndWpnLaunch_->setSource("sounds/Rocket_launch.ogg");
this->defSndWpnLaunch_->setVolume(1.0f);
@@ -115,7 +115,7 @@
}
// Add camera
- CameraPosition* camPosition = new CameraPosition(this);
+ CameraPosition* camPosition = new CameraPosition(this->getContext());
camPosition->setPosition(0,4,15);
camPosition->setAllowMouseLook(true);
this->addCameraPosition(camPosition);
@@ -225,13 +225,13 @@
ParticleSpawner *effect1, *effect2;
if(this->getShooter())
{
- effect1 = new ParticleSpawner(this->getShooter()->getCreator());
- effect2 = new ParticleSpawner(this->getShooter()->getCreator());
+ effect1 = new ParticleSpawner(this->getShooter()->getContext());
+ effect2 = new ParticleSpawner(this->getShooter()->getContext());
}
else
{
- effect1 = new ParticleSpawner(static_cast<BaseObject*>(this->getScene().get()));
- effect2 = new ParticleSpawner(static_cast<BaseObject*>(this->getScene().get()));
+ effect1 = new ParticleSpawner(this->getContext());
+ effect2 = new ParticleSpawner(this->getContext());
}
effect1->setPosition(this->getPosition());
Modified: code/trunk/src/modules/weapons/projectiles/Rocket.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Rocket.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/projectiles/Rocket.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -58,7 +58,7 @@
class _WeaponsExport Rocket : public ControllableEntity, public BasicProjectile, public RadarViewable
{
public:
- Rocket(BaseObject* creator);
+ Rocket(Context* context);
virtual ~Rocket();
virtual void tick(float dt); //!< Defines which actions the Rocket has to take in each tick.
Modified: code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -51,14 +51,14 @@
namespace orxonox
{
- CreateFactory(SimpleRocket);
+ RegisterClass(SimpleRocket);
const float SimpleRocket::FUEL_PERCENTAGE = 0.8f;
- SimpleRocket::SimpleRocket(BaseObject* creator)
- : ControllableEntity(creator)
+ SimpleRocket::SimpleRocket(Context* context)
+ : ControllableEntity(context)
, BasicProjectile()
- , RadarViewable(creator, static_cast<WorldEntity*>(this))
+ , RadarViewable(this, static_cast<WorldEntity*>(this))
{
RegisterObject(SimpleRocket);// Register the SimpleRocket class to the core
@@ -73,13 +73,13 @@
this->fuel_ = true;
// Create rocket model.
- Model* model = new Model(this);
+ Model* model = new Model(this->getContext());
model->setMeshSource("rocket.mesh");
model->scale(0.7f);
this->attach(model);
// Add effects.
- this->fire_ = new ParticleEmitter(this);
+ this->fire_ = new ParticleEmitter(this->getContext());
this->attach(this->fire_);
this->fire_->setOrientation(this->getOrientation());
@@ -90,7 +90,7 @@
// Add collision shape.
// TODO: fix the orientation and size of this collision shape to match the rocket
- ConeCollisionShape* collisionShape = new ConeCollisionShape(this);
+ ConeCollisionShape* collisionShape = new ConeCollisionShape(this->getContext());
collisionShape->setOrientation(this->getOrientation());
collisionShape->setRadius(1.5f);
collisionShape->setHeight(5);
Modified: code/trunk/src/modules/weapons/projectiles/SimpleRocket.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/SimpleRocket.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/projectiles/SimpleRocket.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -59,7 +59,7 @@
class _WeaponsExport SimpleRocket : public ControllableEntity, public BasicProjectile, public RadarViewable
{
public:
- SimpleRocket(BaseObject* creator);
+ SimpleRocket(Context* context);
virtual ~SimpleRocket();
virtual void tick(float dt);
Modified: code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -48,9 +48,9 @@
namespace orxonox
{
- CreateFactory(EnergyDrink);
+ RegisterClass(EnergyDrink);
- EnergyDrink::EnergyDrink(BaseObject* creator) : WeaponMode(creator)
+ EnergyDrink::EnergyDrink(Context* context) : WeaponMode(context)
{
RegisterObject(EnergyDrink);
@@ -100,8 +100,8 @@
void EnergyDrink::shot()
{
// Create the projectile
- Projectile* projectile = new Projectile(this);
- Model* model = new Model(projectile);
+ Projectile* projectile = new Projectile(this->getContext());
+ Model* model = new Model(projectile->getContext());
model->setMeshSource("can.mesh");
model->setCastShadows(false);
projectile->attach(model);
@@ -126,7 +126,7 @@
*/
void EnergyDrink::muzzleflash()
{
- MuzzleFlash *muzzleFlash = new MuzzleFlash(this);
+ MuzzleFlash *muzzleFlash = new MuzzleFlash(this->getContext());
this->getWeapon()->attach(muzzleFlash);
muzzleFlash->setPosition(this->getMuzzleOffset());
muzzleFlash->setMaterial(this->material_);
Modified: code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.h
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -53,7 +53,7 @@
class _WeaponsExport EnergyDrink : public WeaponMode
{
public:
- EnergyDrink(BaseObject* creator);
+ EnergyDrink(Context* context);
virtual ~EnergyDrink() {}
virtual void fire();
Modified: code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -45,9 +45,9 @@
namespace orxonox
{
- CreateFactory(FusionFire);
+ RegisterClass(FusionFire);
- FusionFire::FusionFire(BaseObject* creator) : WeaponMode(creator)
+ FusionFire::FusionFire(Context* context) : WeaponMode(context)
{
RegisterObject(FusionFire);
@@ -65,7 +65,7 @@
*/
void FusionFire::fire()
{
- BillboardProjectile* projectile = new BillboardProjectile(this);
+ BillboardProjectile* projectile = new BillboardProjectile(this->getContext());
projectile->setOrientation(this->getMuzzleOrientation());
projectile->setPosition(this->getMuzzlePosition());
Modified: code/trunk/src/modules/weapons/weaponmodes/FusionFire.h
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/FusionFire.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/weaponmodes/FusionFire.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -50,7 +50,7 @@
class _WeaponsExport FusionFire : public WeaponMode
{
public:
- FusionFire(BaseObject* creator);
+ FusionFire(Context* context);
virtual ~FusionFire() {}
virtual void fire();
Modified: code/trunk/src/modules/weapons/weaponmodes/HsW01.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/HsW01.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/weaponmodes/HsW01.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -49,9 +49,9 @@
namespace orxonox
{
- CreateFactory(HsW01);
+ RegisterClass(HsW01);
- HsW01::HsW01(BaseObject* creator) : WeaponMode(creator)
+ HsW01::HsW01(Context* context) : WeaponMode(context)
{
RegisterObject(HsW01);
@@ -110,8 +110,8 @@
assert( this->getWeapon() && this->getWeapon()->getWeaponPack() && this->getWeapon()->getWeaponPack()->getWeaponSystem() && this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn() );
// Create the projectile.
- Projectile* projectile = new Projectile(this);
- Model* model = new Model(projectile);
+ Projectile* projectile = new Projectile(this->getContext());
+ Model* model = new Model(projectile->getContext());
model->setMeshSource(mesh_);
model->setCastShadows(false);
projectile->attach(model);
@@ -137,7 +137,7 @@
*/
void HsW01::muzzleflash()
{
- MuzzleFlash *muzzleFlash = new MuzzleFlash(this);
+ MuzzleFlash *muzzleFlash = new MuzzleFlash(this->getContext());
this->getWeapon()->attach(muzzleFlash);
muzzleFlash->setPosition(this->getMuzzleOffset());
muzzleFlash->setMaterial(this->material_);
Modified: code/trunk/src/modules/weapons/weaponmodes/HsW01.h
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/HsW01.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/weaponmodes/HsW01.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -52,7 +52,7 @@
class _WeaponsExport HsW01 : public WeaponMode
{
public:
- HsW01(BaseObject* creator);
+ HsW01(Context* context);
virtual ~HsW01();
virtual void fire();
Modified: code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,9 +44,9 @@
namespace orxonox
{
- CreateFactory(LaserFire);
+ RegisterClass(LaserFire);
- LaserFire::LaserFire(BaseObject* creator) : WeaponMode(creator)
+ LaserFire::LaserFire(Context* context) : WeaponMode(context)
{
RegisterObject(LaserFire);
@@ -63,7 +63,7 @@
*/
void LaserFire::fire()
{
- ParticleProjectile* projectile = new ParticleProjectile(this);
+ ParticleProjectile* projectile = new ParticleProjectile(this->getContext());
projectile->setOrientation(this->getMuzzleOrientation());
projectile->setPosition(this->getMuzzlePosition());
Modified: code/trunk/src/modules/weapons/weaponmodes/LaserFire.h
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/LaserFire.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/weaponmodes/LaserFire.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -50,7 +50,7 @@
class _WeaponsExport LaserFire : public WeaponMode
{
public:
- LaserFire(BaseObject* creator);
+ LaserFire(Context* context);
virtual ~LaserFire() {}
virtual void fire();
Modified: code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,9 +43,9 @@
namespace orxonox
{
- CreateFactory(LightningGun);
+ RegisterClass(LightningGun);
- LightningGun::LightningGun(BaseObject* creator) : WeaponMode(creator)
+ LightningGun::LightningGun(Context* context) : WeaponMode(context)
{
RegisterObject(LightningGun);
@@ -67,7 +67,7 @@
*/
void LightningGun::fire()
{
- LightningGunProjectile* projectile = new LightningGunProjectile(this);
+ LightningGunProjectile* projectile = new LightningGunProjectile(this->getContext());
projectile->setMaterial("Flares/LightningBall_");
this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
Modified: code/trunk/src/modules/weapons/weaponmodes/LightningGun.h
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/LightningGun.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/weaponmodes/LightningGun.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -50,7 +50,7 @@
class _WeaponsExport LightningGun : public WeaponMode
{
public:
- LightningGun(BaseObject* creator);
+ LightningGun(Context* context);
virtual ~LightningGun();
virtual void fire();
Modified: code/trunk/src/modules/weapons/weaponmodes/RocketFire.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/RocketFire.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/weaponmodes/RocketFire.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -45,9 +45,9 @@
namespace orxonox
{
- CreateFactory(RocketFire);
+ RegisterClass(RocketFire);
- RocketFire::RocketFire(BaseObject* creator) : WeaponMode(creator)
+ RocketFire::RocketFire(Context* context) : WeaponMode(context)
{
RegisterObject(RocketFire);
@@ -70,7 +70,7 @@
*/
void RocketFire::fire()
{
- Rocket* rocket = new Rocket(this);
+ Rocket* rocket = new Rocket(this->getContext());
this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
rocket->setOrientation(this->getMuzzleOrientation());
Modified: code/trunk/src/modules/weapons/weaponmodes/RocketFire.h
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/RocketFire.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/weaponmodes/RocketFire.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -50,7 +50,7 @@
class _WeaponsExport RocketFire : public WeaponMode
{
public:
- RocketFire(BaseObject* creator);
+ RocketFire(Context* context);
virtual ~RocketFire();
virtual void fire();
Modified: code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -49,9 +49,9 @@
namespace orxonox
{
- CreateFactory(SimpleRocketFire);
+ RegisterClass(SimpleRocketFire);
- SimpleRocketFire::SimpleRocketFire(BaseObject* creator) : WeaponMode(creator)
+ SimpleRocketFire::SimpleRocketFire(Context* context) : WeaponMode(context)
{
RegisterObject(SimpleRocketFire);
@@ -75,7 +75,7 @@
*/
void SimpleRocketFire::fire()
{
- RocketController* controller = new RocketController(this);
+ RocketController* controller = new RocketController(this->getContext());
SimpleRocket* rocket = controller->getRocket();
this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
rocket->setOrientation(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getWorldOrientation());
Modified: code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.h
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -49,7 +49,7 @@
class _WeaponsExport SimpleRocketFire : public WeaponMode
{
public:
- SimpleRocketFire(BaseObject* creator);
+ SimpleRocketFire(Context* context);
virtual ~SimpleRocketFire();
void deactivateFire();
virtual void fire();
Modified: code/trunk/src/orxonox/CameraManager.cc
===================================================================
--- code/trunk/src/orxonox/CameraManager.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/CameraManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,7 +37,7 @@
#include "util/ScopedSingletonManager.h"
#include "core/GameMode.h"
#include "core/GraphicsManager.h"
-#include "core/ObjectList.h"
+#include "core/object/ObjectList.h"
#include "tools/Shader.h"
#include "graphics/Camera.h"
@@ -47,8 +47,6 @@
CameraManager::CameraManager()
{
- RegisterRootObject(CameraManager);
-
assert(GameMode::showsGraphics());
}
Modified: code/trunk/src/orxonox/CameraManager.h
===================================================================
--- code/trunk/src/orxonox/CameraManager.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/CameraManager.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,11 +40,10 @@
#include <list>
#include "util/OgreForwardRefs.h"
#include "util/Singleton.h"
-#include "core/OrxonoxClass.h"
namespace orxonox
{
- class _OrxonoxExport CameraManager : public Singleton<CameraManager>, public OrxonoxClass
+ class _OrxonoxExport CameraManager : public Singleton<CameraManager>
{
friend class Singleton<CameraManager>;
public:
Modified: code/trunk/src/orxonox/Level.cc
===================================================================
--- code/trunk/src/orxonox/Level.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/Level.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,9 +42,9 @@
namespace orxonox
{
- CreateFactory(Level);
+ RegisterClass(Level);
- Level::Level(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
+ Level::Level(Context* context) : BaseObject(context), Synchronisable(context), Context(context)
{
RegisterObject(Level);
Modified: code/trunk/src/orxonox/Level.h
===================================================================
--- code/trunk/src/orxonox/Level.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/Level.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,10 +40,10 @@
namespace orxonox
{
- class _OrxonoxExport Level : public BaseObject, public Synchronisable
+ class _OrxonoxExport Level : public BaseObject, public Synchronisable, public Context
{
public:
- Level(BaseObject* creator);
+ Level(Context* context);
virtual ~Level();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/LevelInfo.cc
===================================================================
--- code/trunk/src/orxonox/LevelInfo.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/LevelInfo.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -241,7 +241,7 @@
// LevelInfo
- CreateFactory(LevelInfo);
+ RegisterClass(LevelInfo);
/**
@brief
@@ -249,7 +249,7 @@
@param creator
The creator of this object.
*/
- LevelInfo::LevelInfo(BaseObject* creator) : BaseObject(creator)
+ LevelInfo::LevelInfo(Context* context) : BaseObject(context)
{
RegisterObject(LevelInfo);
Modified: code/trunk/src/orxonox/LevelInfo.h
===================================================================
--- code/trunk/src/orxonox/LevelInfo.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/LevelInfo.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,7 +44,7 @@
#include "core/BaseObject.h"
#include <iostream>
#include <fstream>
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxInterface.h"
namespace orxonox // tolua_export
{ // tolua_export
@@ -60,7 +60,7 @@
@ingroup Orxonox
*/
class _OrxonoxExport LevelInfoItem // tolua_export
- : virtual public OrxonoxClass
+ : virtual public OrxonoxInterface
{ // tolua_export
public:
LevelInfoItem(); //!< Default constructor.
@@ -203,7 +203,7 @@
class _OrxonoxExport LevelInfo : public BaseObject, public LevelInfoItem
{
public:
- LevelInfo(BaseObject* creator);
+ LevelInfo(Context* context);
virtual ~LevelInfo();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Creates a LevelInfo object through XML.
Modified: code/trunk/src/orxonox/LevelManager.cc
===================================================================
--- code/trunk/src/orxonox/LevelManager.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/LevelManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,10 +36,10 @@
#include <map>
#include "util/ScopedSingletonManager.h"
+#include "core/config/CommandLineParser.h"
+#include "core/config/ConfigValueIncludes.h"
+#include "core/CoreIncludes.h"
#include "core/ClassTreeMask.h"
-#include "core/CommandLineParser.h"
-#include "core/ConfigValueIncludes.h"
-#include "core/CoreIncludes.h"
#include "core/Loader.h"
#include "core/Resource.h"
#include "core/XMLFile.h"
@@ -58,7 +58,7 @@
*/
LevelManager::LevelManager()
{
- RegisterRootObject(LevelManager);
+ RegisterObject(LevelManager);
this->setConfigValues();
// check override
Modified: code/trunk/src/orxonox/LevelManager.h
===================================================================
--- code/trunk/src/orxonox/LevelManager.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/LevelManager.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -45,7 +45,7 @@
#include "LevelInfo.h"
#include "util/Singleton.h"
-#include "core/OrxonoxClass.h"
+#include "core/config/Configurable.h"
// tolua_begin
namespace orxonox
@@ -66,7 +66,7 @@
*/
class _OrxonoxExport LevelManager
// tolua_end
- : public Singleton<LevelManager>, public OrxonoxClass
+ : public Singleton<LevelManager>, public Configurable
{ // tolua_export
friend class Singleton<LevelManager>;
public:
Modified: code/trunk/src/orxonox/Main.cc
===================================================================
--- code/trunk/src/orxonox/Main.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/Main.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,7 +35,7 @@
#include "Main.h"
-#include "core/CommandLineParser.h"
+#include "core/config/CommandLineParser.h"
#include "core/Game.h"
#include "core/LuaState.h"
Modified: code/trunk/src/orxonox/MoodManager.cc
===================================================================
--- code/trunk/src/orxonox/MoodManager.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/MoodManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -29,7 +29,7 @@
#include "MoodManager.h"
#include "util/ScopedSingletonManager.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/CoreIncludes.h"
#include "core/Resource.h"
@@ -42,7 +42,7 @@
MoodManager::MoodManager()
{
- RegisterRootObject(MoodManager);
+ RegisterObject(MoodManager);
this->setConfigValues();
// Need to use a variable to store old data because ResetConfigValues() doesn't seem to work.
@@ -94,7 +94,7 @@
MoodListener::MoodListener()
{
- RegisterRootObject(MoodListener);
+ RegisterObject(MoodListener);
}
/*static*/ void MoodListener::changedMood(const std::string& mood)
Modified: code/trunk/src/orxonox/MoodManager.h
===================================================================
--- code/trunk/src/orxonox/MoodManager.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/MoodManager.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,7 +33,7 @@
#include <string>
#include "util/Singleton.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxInterface.h"
namespace orxonox
{
@@ -41,7 +41,7 @@
@brief
The MoodListener class is aware of a change in themes and directs that info to dependent classes.
*/
- class _OrxonoxExport MoodListener : virtual public OrxonoxClass
+ class _OrxonoxExport MoodListener : virtual public OrxonoxInterface
{
friend class MoodManager;
@@ -59,7 +59,7 @@
@brief
The MoodManager class serves to allow for different musical themes in the game.
*/
- class _OrxonoxExport MoodManager : public Singleton<MoodManager>, public OrxonoxClass
+ class _OrxonoxExport MoodManager : public Singleton<MoodManager>, public Configurable
{
friend class Singleton<MoodManager>;
public:
@@ -73,7 +73,6 @@
static MoodManager& getInstance() { return Singleton<MoodManager>::getInstance(); }
private:
- ~MoodManager() {}
void checkMoodValidity();
// config values
Modified: code/trunk/src/orxonox/PawnManager.cc
===================================================================
--- code/trunk/src/orxonox/PawnManager.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/PawnManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,7 +38,7 @@
PawnManager::PawnManager()
{
- RegisterRootObject(PawnManager);
+ RegisterObject(PawnManager);
}
PawnManager::~PawnManager()
Modified: code/trunk/src/orxonox/PlayerManager.cc
===================================================================
--- code/trunk/src/orxonox/PlayerManager.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/PlayerManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,7 +42,7 @@
PlayerManager::PlayerManager()
{
- RegisterRootObject(PlayerManager);
+ RegisterObject(PlayerManager);
// this->getConnectedClients();
}
Modified: code/trunk/src/orxonox/Radar.cc
===================================================================
--- code/trunk/src/orxonox/Radar.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/Radar.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,7 +36,7 @@
#include <cassert>
//#include "util/Math.h"
-#include "core/ObjectList.h"
+#include "core/object/ObjectList.h"
#include "core/command/ConsoleCommand.h"
#include "interfaces/RadarListener.h"
#include "controllers/HumanController.h"
Modified: code/trunk/src/orxonox/Radar.h
===================================================================
--- code/trunk/src/orxonox/Radar.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/Radar.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
#include <set>
#include <string>
-#include "core/ObjectListIterator.h"
+#include "core/object/ObjectListIterator.h"
#include "interfaces/RadarViewable.h"
#include "tools/interfaces/Tickable.h"
@@ -73,7 +73,7 @@
void removeRadarObject(RadarViewable* rv);
void radarObjectChanged(RadarViewable* rv);
- ObjectListIterator<RadarViewable> itFocus_;
+ ObjectList<RadarViewable>::iterator itFocus_;
RadarViewable* focus_;
std::map<std::string, RadarViewable::Shape> objectTypes_;
std::set<RadarViewable*> radarObjects_;
Modified: code/trunk/src/orxonox/Scene.cc
===================================================================
--- code/trunk/src/orxonox/Scene.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/Scene.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -50,9 +50,9 @@
namespace orxonox
{
- CreateFactory(Scene);
+ RegisterClass(Scene);
- Scene::Scene(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
+ Scene::Scene(Context* context) : BaseObject(context), Synchronisable(context), Context(context)
{
RegisterObject(Scene);
Modified: code/trunk/src/orxonox/Scene.h
===================================================================
--- code/trunk/src/orxonox/Scene.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/Scene.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,10 +44,10 @@
namespace orxonox
{
- class _OrxonoxExport Scene : public BaseObject, public Synchronisable, public Tickable
+ class _OrxonoxExport Scene : public BaseObject, public Synchronisable, public Tickable, public Context
{
public:
- Scene(BaseObject* creator);
+ Scene(Context* context);
virtual ~Scene();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/Test.cc
===================================================================
--- code/trunk/src/orxonox/Test.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/Test.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -27,7 +27,7 @@
*/
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/command/ConsoleCommand.h"
#include "network/NetworkFunction.h"
#include "Test.h"
@@ -35,7 +35,7 @@
namespace orxonox
{
- CreateFactory ( Test );
+ RegisterClass ( Test );
SetConsoleCommand("Test", "printV1", &Test::printV1).addShortcut();
SetConsoleCommand("Test", "printV2", &Test::printV2).addShortcut();
@@ -55,7 +55,7 @@
Test* Test::instance_ = 0;
- Test::Test(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
+ Test::Test(Context* context) : BaseObject(context), Synchronisable(context)
{
assert(instance_==0);
instance_=this;
Modified: code/trunk/src/orxonox/Test.h
===================================================================
--- code/trunk/src/orxonox/Test.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/Test.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -45,7 +45,7 @@
class _OrxonoxExport Test: public BaseObject, public Synchronisable, public Tickable
{
public:
- Test(BaseObject* creator);
+ Test(Context* context);
virtual ~Test();
void setConfigValues();
Modified: code/trunk/src/orxonox/chat/ChatHistory.cc
===================================================================
--- code/trunk/src/orxonox/chat/ChatHistory.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/chat/ChatHistory.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,7 +38,6 @@
/* constructor */
#ifndef CHATTEST
- //ChatHistory::ChatHistory( BaseObject* creator ) : BaseObject(creator)
ChatHistory::ChatHistory()
#else
ChatHistory::ChatHistory()
Modified: code/trunk/src/orxonox/chat/ChatListener.h
===================================================================
--- code/trunk/src/orxonox/chat/ChatListener.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/chat/ChatListener.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -31,7 +31,7 @@
#include "OrxonoxPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/object/Listable.h"
namespace orxonox
{
@@ -39,7 +39,7 @@
@brief Classes inheriting from this interface get a notification whenever a chat
message was sent through ChatManager.
*/
- class _OrxonoxExport ChatListener : virtual public OrxonoxClass
+ class _OrxonoxExport ChatListener : virtual public Listable
{
friend class ChatManager;
Modified: code/trunk/src/orxonox/chat/ChatManager.cc
===================================================================
--- code/trunk/src/orxonox/chat/ChatManager.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/chat/ChatManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -112,9 +112,10 @@
//////////////////////////////////////////////////////////////////////////
// ChatListener //
//////////////////////////////////////////////////////////////////////////
+ RegisterAbstractClass(ChatListener).inheritsFrom(Class(Listable));
ChatListener::ChatListener()
{
- RegisterRootObject(ChatListener);
+ RegisterObject(ChatListener);
}
}
Modified: code/trunk/src/orxonox/collisionshapes/CollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/collisionshapes/CollisionShape.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/collisionshapes/CollisionShape.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,14 +43,15 @@
namespace orxonox
{
+ RegisterAbstractClass(CollisionShape).inheritsFrom(Class(BaseObject)).inheritsFrom(Class(Synchronisable));
/**
@brief
Constructor. Registers and initializes the object.
*/
- CollisionShape::CollisionShape(BaseObject* creator)
- : BaseObject(creator)
- , Synchronisable(creator)
+ CollisionShape::CollisionShape(Context* context)
+ : BaseObject(context)
+ , Synchronisable(context)
{
RegisterObject(CollisionShape);
Modified: code/trunk/src/orxonox/collisionshapes/CollisionShape.h
===================================================================
--- code/trunk/src/orxonox/collisionshapes/CollisionShape.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/collisionshapes/CollisionShape.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -57,7 +57,7 @@
class _OrxonoxExport CollisionShape : public BaseObject, public Synchronisable
{
public:
- CollisionShape(BaseObject* creator);
+ CollisionShape(Context* context);
virtual ~CollisionShape();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,13 +41,13 @@
namespace orxonox
{
- CreateFactory(CompoundCollisionShape);
+ RegisterClass(CompoundCollisionShape);
/**
@brief
Constructor. Registers and initializes the object.
*/
- CompoundCollisionShape::CompoundCollisionShape(BaseObject* creator) : CollisionShape(creator)
+ CompoundCollisionShape::CompoundCollisionShape(Context* context) : CollisionShape(context)
{
RegisterObject(CompoundCollisionShape);
Modified: code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.h
===================================================================
--- code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -57,7 +57,7 @@
class _OrxonoxExport CompoundCollisionShape : public CollisionShape
{
public:
- CompoundCollisionShape(BaseObject* creator);
+ CompoundCollisionShape(Context* context);
virtual ~CompoundCollisionShape();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/collisionshapes/WorldEntityCollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/collisionshapes/WorldEntityCollisionShape.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/collisionshapes/WorldEntityCollisionShape.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,11 +36,11 @@
namespace orxonox
{
- WorldEntityCollisionShape::WorldEntityCollisionShape(WorldEntity* creator) : CompoundCollisionShape(creator)
+ WorldEntityCollisionShape::WorldEntityCollisionShape(Context* context) : CompoundCollisionShape(context)
{
RegisterObject(WorldEntityCollisionShape);
- this->worldEntityOwner_ = creator;
+ this->worldEntityOwner_ = NULL;
// suppress synchronisation
this->setSyncMode(ObjectDirection::None);
}
Modified: code/trunk/src/orxonox/collisionshapes/WorldEntityCollisionShape.h
===================================================================
--- code/trunk/src/orxonox/collisionshapes/WorldEntityCollisionShape.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/collisionshapes/WorldEntityCollisionShape.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,10 +37,12 @@
class _OrxonoxExport WorldEntityCollisionShape : public CompoundCollisionShape
{
public:
- WorldEntityCollisionShape(WorldEntity* creator);
+ WorldEntityCollisionShape(Context* context);
virtual ~WorldEntityCollisionShape();
- inline WorldEntity* getWorldEntityOwner()
+ inline void setWorldEntityOwner(WorldEntity* worldEntityOwner)
+ { this->worldEntityOwner_ = worldEntityOwner; }
+ inline WorldEntity* getWorldEntityOwner() const
{ return this->worldEntityOwner_; }
protected:
Modified: code/trunk/src/orxonox/controllers/AIController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/AIController.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/AIController.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,9 +38,9 @@
{
const float AIController::ACTION_INTERVAL = 1.0f;
- CreateFactory(AIController);
+ RegisterClass(AIController);
- AIController::AIController(BaseObject* creator) : ArtificialController(creator)
+ AIController::AIController(Context* context) : ArtificialController(context)
{
RegisterObject(AIController);
Modified: code/trunk/src/orxonox/controllers/AIController.h
===================================================================
--- code/trunk/src/orxonox/controllers/AIController.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/AIController.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OrxonoxExport AIController : public ArtificialController, public Tickable
{
public:
- AIController(BaseObject* creator);
+ AIController(Context* context);
virtual ~AIController();
virtual void tick(float dt); //<! Carrying out the targets set in action().
Modified: code/trunk/src/orxonox/controllers/ArtificialController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/ArtificialController.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/ArtificialController.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,7 +44,9 @@
{
SetConsoleCommand("ArtificialController", "setbotlevel", &ArtificialController::setAllBotLevel);
- ArtificialController::ArtificialController(BaseObject* creator) : FormationController(creator)
+ RegisterClass(ArtificialController);
+
+ ArtificialController::ArtificialController(Context* context) : FormationController(context)
{
RegisterObject(ArtificialController);
Modified: code/trunk/src/orxonox/controllers/ArtificialController.h
===================================================================
--- code/trunk/src/orxonox/controllers/ArtificialController.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/ArtificialController.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,7 +38,7 @@
class _OrxonoxExport ArtificialController : public FormationController
{
public:
- ArtificialController(BaseObject* creator);
+ ArtificialController(Context* context);
virtual ~ArtificialController();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/controllers/Controller.cc
===================================================================
--- code/trunk/src/orxonox/controllers/Controller.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/Controller.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,9 +32,9 @@
namespace orxonox
{
- CreateUnloadableFactory(Controller);
+ RegisterUnloadableClass(Controller);
- Controller::Controller(BaseObject* creator) : BaseObject(creator)
+ Controller::Controller(Context* context) : BaseObject(context)
{
RegisterObject(Controller);
Modified: code/trunk/src/orxonox/controllers/Controller.h
===================================================================
--- code/trunk/src/orxonox/controllers/Controller.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/Controller.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,7 +41,7 @@
friend class ControllableEntity;
public:
- Controller(BaseObject* creator);
+ Controller(Context* context);
virtual ~Controller();
inline void setPlayer(PlayerInfo* player)
Modified: code/trunk/src/orxonox/controllers/DroneController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/DroneController.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/DroneController.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,11 +40,11 @@
@brief
Constructor.
*/
- CreateFactory(DroneController);
+ RegisterClass(DroneController);
const float DroneController::ACTION_INTERVAL = 1.0f;
- DroneController::DroneController(BaseObject* creator) : ArtificialController(creator)
+ DroneController::DroneController(Context* context) : ArtificialController(context)
{
RegisterObject(DroneController);
Modified: code/trunk/src/orxonox/controllers/DroneController.h
===================================================================
--- code/trunk/src/orxonox/controllers/DroneController.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/DroneController.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,7 +32,7 @@
#include "OrxonoxPrereqs.h"
#include "AIController.h"
-#include "core/WeakPtr.h"
+#include "core/object/WeakPtr.h"
#include "tools/interfaces/Tickable.h"
#include "tools/Timer.h"
@@ -49,7 +49,7 @@
class _OrxonoxExport DroneController : public ArtificialController, public Tickable
{
public:
- DroneController(BaseObject* creator);
+ DroneController(Context* context);
virtual ~DroneController();
virtual void tick(float dt); //!< The controlling happens here. This method defines what the controller has to do each tick.
Modified: code/trunk/src/orxonox/controllers/FormationController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/FormationController.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/FormationController.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -55,9 +55,8 @@
SetConsoleCommand("FormationController", "passivebehaviour", &FormationController::passivebehaviour);
SetConsoleCommand("FormationController", "formationsize", &FormationController::formationsize);
+ RegisterClass(FormationController);
-
-
static const unsigned int STANDARD_MAX_FORMATION_SIZE = 9;
static const int RADIUS_TO_SEARCH_FOR_MASTERS = 5000;
static const float FORMATION_LENGTH = 110;
@@ -68,7 +67,7 @@
static const float SPEED_FREE = 0.8f;
static const float ROTATEFACTOR_FREE = 0.8f;
- FormationController::FormationController(BaseObject* creator) : Controller(creator)
+ FormationController::FormationController(Context* context) : Controller(context)
{
RegisterObject(FormationController);
Modified: code/trunk/src/orxonox/controllers/FormationController.h
===================================================================
--- code/trunk/src/orxonox/controllers/FormationController.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/FormationController.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,10 +32,9 @@
#include "OrxonoxPrereqs.h"
#include <vector>
-#include "core/Super.h"
+#include "core/class/Super.h"
#include "util/Math.h"
-#include "core/OrxonoxClass.h"
#include "controllers/Controller.h"
#include "worldentities/ControllableEntity.h"
@@ -46,7 +45,7 @@
{
public:
- FormationController(BaseObject* creator);
+ FormationController(Context* context);
virtual ~FormationController();
Modified: code/trunk/src/orxonox/controllers/HumanController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/HumanController.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/HumanController.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -65,12 +65,12 @@
SetConsoleCommand("HumanController", "releaseNavigationFocus", &HumanController::releaseNavigationFocus).addShortcut();
SetConsoleCommand("HumanController", "myposition", &HumanController::myposition ).addShortcut();
- CreateUnloadableFactory(HumanController);
+ RegisterUnloadableClass(HumanController);
HumanController* HumanController::localController_s = 0;
/*static*/ const float HumanController::BOOSTING_TIME = 0.1f;
- HumanController::HumanController(BaseObject* creator) : FormationController(creator)
+ HumanController::HumanController(Context* context) : FormationController(context)
{
RegisterObject(HumanController);
Modified: code/trunk/src/orxonox/controllers/HumanController.h
===================================================================
--- code/trunk/src/orxonox/controllers/HumanController.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/HumanController.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,7 +43,7 @@
: public FormationController, public Tickable
{ // tolua_export
public:
- HumanController(BaseObject* creator);
+ HumanController(Context* context);
virtual ~HumanController();
virtual void tick(float dt);
Modified: code/trunk/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/NewHumanController.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/NewHumanController.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -55,12 +55,12 @@
SetConsoleCommand("NewHumanController", "decelerate", &NewHumanController::decelerate).keybindMode(KeybindMode::OnPress);
SetConsoleCommand("NewHumanController", "unfire", &NewHumanController::unfire ).keybindMode(KeybindMode::OnRelease).addShortcut();
- CreateUnloadableFactory(NewHumanController);
+ RegisterUnloadableClass(NewHumanController);
NewHumanController* NewHumanController::localController_s = 0;
- NewHumanController::NewHumanController(BaseObject* creator)
- : HumanController(creator)
+ NewHumanController::NewHumanController(Context* context)
+ : HumanController(context)
, crossHairOverlay_(NULL)
, centerOverlay_(NULL)
, damageOverlayTop_(NULL)
@@ -97,13 +97,13 @@
if (GameMode::showsGraphics())
{
- crossHairOverlay_ = new OrxonoxOverlay(this);
+ crossHairOverlay_ = new OrxonoxOverlay(this->getContext());
crossHairOverlay_->setBackgroundMaterial("Orxonox/Crosshair3");
crossHairOverlay_->setSize(Vector2(overlaySize_, overlaySize_));
crossHairOverlay_->hide();
//crossHairOverlay_->setAspectCorrection(true); not working
- centerOverlay_ = new OrxonoxOverlay(this);
+ centerOverlay_ = new OrxonoxOverlay(this->getContext());
centerOverlay_->setBackgroundMaterial("Orxonox/CenterOverlay");
centerOverlay_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f));
centerOverlay_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f));
@@ -111,25 +111,25 @@
if (showDamageOverlay_)
{
- damageOverlayTop_ = new OrxonoxOverlay(this);
+ damageOverlayTop_ = new OrxonoxOverlay(this->getContext());
damageOverlayTop_->setBackgroundMaterial("Orxonox/DamageOverlayTop");
damageOverlayTop_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f));
damageOverlayTop_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f));
damageOverlayTop_->hide();
- damageOverlayRight_ = new OrxonoxOverlay(this);
+ damageOverlayRight_ = new OrxonoxOverlay(this->getContext());
damageOverlayRight_->setBackgroundMaterial("Orxonox/DamageOverlayRight");
damageOverlayRight_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f));
damageOverlayRight_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f));
damageOverlayRight_->hide();
- damageOverlayBottom_ = new OrxonoxOverlay(this);
+ damageOverlayBottom_ = new OrxonoxOverlay(this->getContext());
damageOverlayBottom_->setBackgroundMaterial("Orxonox/DamageOverlayBottom");
damageOverlayBottom_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f));
damageOverlayBottom_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f));
damageOverlayBottom_->hide();
- damageOverlayLeft_ = new OrxonoxOverlay(this);
+ damageOverlayLeft_ = new OrxonoxOverlay(this->getContext());
damageOverlayLeft_->setBackgroundMaterial("Orxonox/DamageOverlayLeft");
damageOverlayLeft_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f));
damageOverlayLeft_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f));
@@ -138,28 +138,28 @@
if (showArrows_)
{
- arrowsOverlay1_ = new OrxonoxOverlay(this);
+ arrowsOverlay1_ = new OrxonoxOverlay(this->getContext());
arrowsOverlay1_->setBackgroundMaterial("Orxonox/DirectionArrows1");
arrowsOverlay1_->setSize(Vector2(0.02727f, 0.36f * arrowsSize_));
arrowsOverlay1_->setPickPoint(Vector2(0.5f, 0.5f));
arrowsOverlay1_->setPosition(Vector2(0.5f, 0.5f));
arrowsOverlay1_->hide();
- arrowsOverlay2_ = new OrxonoxOverlay(this);
+ arrowsOverlay2_ = new OrxonoxOverlay(this->getContext());
arrowsOverlay2_->setBackgroundMaterial("Orxonox/DirectionArrows2");
arrowsOverlay2_->setSize(Vector2(0.02727f, 0.59f * arrowsSize_));
arrowsOverlay2_->setPickPoint(Vector2(0.5f, 0.5f));
arrowsOverlay2_->setPosition(Vector2(0.5f, 0.5f));
arrowsOverlay2_->hide();
- arrowsOverlay3_ = new OrxonoxOverlay(this);
+ arrowsOverlay3_ = new OrxonoxOverlay(this->getContext());
arrowsOverlay3_->setBackgroundMaterial("Orxonox/DirectionArrows3");
arrowsOverlay3_->setSize(Vector2(0.02727f, 0.77f * arrowsSize_));
arrowsOverlay3_->setPickPoint(Vector2(0.5f, 0.5f));
arrowsOverlay3_->setPosition(Vector2(0.5f, 0.5f));
arrowsOverlay3_->hide();
- arrowsOverlay4_ = new OrxonoxOverlay(this);
+ arrowsOverlay4_ = new OrxonoxOverlay(this->getContext());
arrowsOverlay4_->setBackgroundMaterial("Orxonox/DirectionArrows4");
arrowsOverlay4_->setSize(Vector2(0.02727f, arrowsSize_));
arrowsOverlay4_->setPickPoint(Vector2(0.5f, 0.5f));
Modified: code/trunk/src/orxonox/controllers/NewHumanController.h
===================================================================
--- code/trunk/src/orxonox/controllers/NewHumanController.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/NewHumanController.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,7 +41,7 @@
class _OrxonoxExport NewHumanController : public HumanController
{
public:
- NewHumanController(BaseObject* creator);
+ NewHumanController(Context* context);
virtual ~NewHumanController();
virtual void tick(float dt);
Modified: code/trunk/src/orxonox/controllers/ScriptController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/ScriptController.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/ScriptController.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -31,9 +31,9 @@
namespace orxonox
{
- CreateFactory(ScriptController);
+ RegisterClass(ScriptController);
- ScriptController::ScriptController(BaseObject* creator) : ArtificialController(creator)
+ ScriptController::ScriptController(Context* context) : ArtificialController(context)
{
RegisterObject(ScriptController);
}
Modified: code/trunk/src/orxonox/controllers/ScriptController.h
===================================================================
--- code/trunk/src/orxonox/controllers/ScriptController.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/ScriptController.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,7 +37,7 @@
class _OrxonoxExport ScriptController : public ArtificialController
{
public:
- ScriptController(BaseObject* creator);
+ ScriptController(Context* context);
virtual ~ScriptController() { }
private:
Modified: code/trunk/src/orxonox/controllers/WaypointController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/WaypointController.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/WaypointController.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,9 +33,9 @@
namespace orxonox
{
- CreateFactory(WaypointController);
+ RegisterClass(WaypointController);
- WaypointController::WaypointController(BaseObject* creator) : ArtificialController(creator)
+ WaypointController::WaypointController(Context* context) : ArtificialController(context)
{
RegisterObject(WaypointController);
this->setAccuracy(100);
Modified: code/trunk/src/orxonox/controllers/WaypointController.h
===================================================================
--- code/trunk/src/orxonox/controllers/WaypointController.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/WaypointController.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OrxonoxExport WaypointController : public ArtificialController, public Tickable
{
public:
- WaypointController(BaseObject* creator);
+ WaypointController(Context* context);
virtual ~WaypointController();
virtual void tick(float dt);
Modified: code/trunk/src/orxonox/controllers/WaypointPatrolController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/WaypointPatrolController.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/WaypointPatrolController.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,9 +35,9 @@
namespace orxonox
{
- CreateFactory(WaypointPatrolController);
+ RegisterClass(WaypointPatrolController);
- WaypointPatrolController::WaypointPatrolController(BaseObject* creator) : WaypointController(creator)
+ WaypointPatrolController::WaypointPatrolController(Context* context) : WaypointController(context)
{
RegisterObject(WaypointPatrolController);
Modified: code/trunk/src/orxonox/controllers/WaypointPatrolController.h
===================================================================
--- code/trunk/src/orxonox/controllers/WaypointPatrolController.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/controllers/WaypointPatrolController.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OrxonoxExport WaypointPatrolController : public WaypointController
{
public:
- WaypointPatrolController(BaseObject* creator);
+ WaypointPatrolController(Context* context);
virtual ~WaypointPatrolController() {}
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/gamestates/GSClient.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSClient.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gamestates/GSClient.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -29,7 +29,7 @@
#include "GSClient.h"
#include "util/Exception.h"
-#include "core/CommandLineParser.h"
+#include "core/config/CommandLineParser.h"
#include "core/Game.h"
#include "core/GameMode.h"
#include "network/Client.h"
Modified: code/trunk/src/orxonox/gamestates/GSLevel.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSLevel.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gamestates/GSLevel.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,7 +33,6 @@
#include <string>
#include <set>
-#include "core/OrxonoxClass.h"
#include "core/GameState.h"
namespace orxonox
Modified: code/trunk/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSMainMenu.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gamestates/GSMainMenu.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -30,7 +30,7 @@
#include <OgreSceneManager.h>
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/CoreIncludes.h"
#include "core/Game.h"
#include "core/GraphicsManager.h"
@@ -65,7 +65,7 @@
GSMainMenu::GSMainMenu(const GameStateInfo& info)
: GameState(info)
{
- RegisterRootObject(GSMainMenu);
+ RegisterObject(GSMainMenu);
InputManager::getInstance().createInputState("MainMenuHackery", true, true)->setKeyHandler(KeyBinderManager::getInstance().getDefaultAsHandler());
Modified: code/trunk/src/orxonox/gamestates/GSMainMenu.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSMainMenu.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gamestates/GSMainMenu.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,11 +33,11 @@
#include "util/OgreForwardRefs.h"
#include "core/GameState.h"
-#include "core/OrxonoxClass.h"
+#include "core/config/Configurable.h"
namespace orxonox
{
- class _OrxonoxExport GSMainMenu : public GameState, public OrxonoxClass
+ class _OrxonoxExport GSMainMenu : public GameState, public Configurable
{
public:
GSMainMenu(const GameStateInfo& info);
Modified: code/trunk/src/orxonox/gamestates/GSServer.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSServer.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gamestates/GSServer.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -29,7 +29,7 @@
#include "GSServer.h"
#include "util/Output.h"
-#include "core/CommandLineParser.h"
+#include "core/config/CommandLineParser.h"
#include "core/Game.h"
#include "core/GameMode.h"
#include "network/Server.h"
Modified: code/trunk/src/orxonox/gametypes/Asteroids.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/Asteroids.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/Asteroids.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,9 +34,9 @@
namespace orxonox
{
- CreateUnloadableFactory(Asteroids);
+ RegisterUnloadableClass(Asteroids);
- Asteroids::Asteroids(BaseObject* creator) : Gametype(creator)
+ Asteroids::Asteroids(Context* context) : Gametype(context)
{
RegisterObject(Asteroids);
this->firstCheckpointReached_ = false;
Modified: code/trunk/src/orxonox/gametypes/Asteroids.h
===================================================================
--- code/trunk/src/orxonox/gametypes/Asteroids.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/Asteroids.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,7 +37,7 @@
class _OrxonoxExport Asteroids : public Gametype
{
public:
- Asteroids(BaseObject* creator);
+ Asteroids(Context* context);
virtual ~Asteroids() {}
virtual void tick(float dt);
Modified: code/trunk/src/orxonox/gametypes/Deathmatch.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/Deathmatch.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/Deathmatch.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,9 +35,9 @@
namespace orxonox
{
- CreateUnloadableFactory(Deathmatch);
+ RegisterUnloadableClass(Deathmatch);
- Deathmatch::Deathmatch(BaseObject* creator) : Gametype(creator)
+ Deathmatch::Deathmatch(Context* context) : Gametype(context)
{
RegisterObject(Deathmatch);
}
Modified: code/trunk/src/orxonox/gametypes/Deathmatch.h
===================================================================
--- code/trunk/src/orxonox/gametypes/Deathmatch.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/Deathmatch.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,7 +37,7 @@
class _OrxonoxExport Deathmatch : public Gametype
{
public:
- Deathmatch(BaseObject* creator);
+ Deathmatch(Context* context);
virtual ~Deathmatch() {}
virtual void start();
Modified: code/trunk/src/orxonox/gametypes/Dynamicmatch.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/Dynamicmatch.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/Dynamicmatch.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -53,7 +53,7 @@
#include "infos/PlayerInfo.h"
#include "worldentities/pawns/Pawn.h"
#include "worldentities/pawns/SpaceShip.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "interfaces/TeamColourable.h"
#include "items/Engine.h"
#include "tools/Timer.h"
@@ -61,9 +61,9 @@
namespace orxonox
{
- CreateUnloadableFactory(Dynamicmatch);
+ RegisterUnloadableClass(Dynamicmatch);
- Dynamicmatch::Dynamicmatch(BaseObject* creator) : Gametype(creator)
+ Dynamicmatch::Dynamicmatch(Context* context) : Gametype(context)
{
RegisterObject(Dynamicmatch);
this->gameTime_ = 180;
Modified: code/trunk/src/orxonox/gametypes/Dynamicmatch.h
===================================================================
--- code/trunk/src/orxonox/gametypes/Dynamicmatch.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/Dynamicmatch.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,7 +43,7 @@
class _OrxonoxExport Dynamicmatch : public Gametype
{
public:
- Dynamicmatch(BaseObject* creator);
+ Dynamicmatch(Context* context);
virtual ~Dynamicmatch() {}
bool notEnoughPigs;
Modified: code/trunk/src/orxonox/gametypes/Gametype.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/Gametype.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/Gametype.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -31,7 +31,7 @@
#include "util/Math.h"
#include "core/Core.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/GameMode.h"
#include "core/command/ConsoleCommand.h"
@@ -46,13 +46,13 @@
namespace orxonox
{
- CreateUnloadableFactory(Gametype);
+ RegisterUnloadableClass(Gametype);
- Gametype::Gametype(BaseObject* creator) : BaseObject(creator)
+ Gametype::Gametype(Context* context) : BaseObject(context)
{
RegisterObject(Gametype);
- this->gtinfo_ = new GametypeInfo(creator);
+ this->gtinfo_ = new GametypeInfo(context);
this->setGametype(SmartPtr<Gametype>(this, false));
@@ -73,7 +73,7 @@
// load the corresponding score board
if (GameMode::showsGraphics() && !this->scoreboardTemplate_.empty())
{
- this->scoreboard_ = new OverlayGroup(this);
+ this->scoreboard_ = new OverlayGroup(context);
this->scoreboard_->addTemplate(this->scoreboardTemplate_);
this->scoreboard_->setGametype(this);
}
@@ -159,7 +159,7 @@
{
ControllableEntity* oldentity = it->first->getControllableEntity();
- ControllableEntity* entity = this->defaultControllableEntity_.fabricate(oldentity);
+ ControllableEntity* entity = this->defaultControllableEntity_.fabricate(oldentity->getContext());
if (oldentity->getCamera())
{
entity->setPosition(oldentity->getCamera()->getWorldPosition());
@@ -282,7 +282,7 @@
if(victim->getPlayer()->isHumanPlayer())
this->gtinfo_->pawnKilled(victim->getPlayer());
- ControllableEntity* entity = this->defaultControllableEntity_.fabricate(victim->getCreator());
+ ControllableEntity* entity = this->defaultControllableEntity_.fabricate(victim->getContext());
if (victim->getCamera())
{
entity->setPosition(victim->getCamera()->getWorldPosition());
@@ -457,7 +457,7 @@
if (spawn)
{
// force spawn at spawnpoint with default pawn
- ControllableEntity* entity = this->defaultControllableEntity_.fabricate(spawn);
+ ControllableEntity* entity = this->defaultControllableEntity_.fabricate(spawn->getContext());
spawn->spawn(entity);
player->startControl(entity);
}
@@ -471,7 +471,7 @@
void Gametype::addBots(unsigned int amount)
{
for (unsigned int i = 0; i < amount; ++i)
- this->botclass_.fabricate(this);
+ this->botclass_.fabricate(this->getContext());
}
void Gametype::killBots(unsigned int amount)
Modified: code/trunk/src/orxonox/gametypes/Gametype.h
===================================================================
--- code/trunk/src/orxonox/gametypes/Gametype.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/Gametype.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,7 +36,7 @@
#include <string>
#include "core/BaseObject.h"
-#include "core/SubclassIdentifier.h"
+#include "core/class/SubclassIdentifier.h"
#include "tools/interfaces/Tickable.h"
#include "infos/GametypeInfo.h"
@@ -66,7 +66,7 @@
friend class PlayerInfo;
public:
- Gametype(BaseObject* creator);
+ Gametype(Context* context);
virtual ~Gametype();
void setConfigValues();
Modified: code/trunk/src/orxonox/gametypes/LastManStanding.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/LastManStanding.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/LastManStanding.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,14 +32,14 @@
#include "chat/ChatManager.h"
#include "infos/PlayerInfo.h"
#include "worldentities/pawns/Pawn.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "util/Convert.h"
namespace orxonox
{
- CreateUnloadableFactory(LastManStanding);
+ RegisterUnloadableClass(LastManStanding);
- LastManStanding::LastManStanding(BaseObject* creator) : Deathmatch(creator)
+ LastManStanding::LastManStanding(Context* context) : Deathmatch(context)
{
RegisterObject(LastManStanding);
this->bForceSpawn_=true;
Modified: code/trunk/src/orxonox/gametypes/LastManStanding.h
===================================================================
--- code/trunk/src/orxonox/gametypes/LastManStanding.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/LastManStanding.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -64,7 +64,7 @@
virtual int getMinLives(); //!< Returns minimum of each player's lives; players with 0 lives are skipped;
public:
- LastManStanding(BaseObject* creator); //!< Default Constructor.
+ LastManStanding(Context* context); //!< Default Constructor.
virtual ~LastManStanding() {} //!< Default Destructor.
void setConfigValues(); //!< Makes values configurable.
Modified: code/trunk/src/orxonox/gametypes/LastTeamStanding.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/LastTeamStanding.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/LastTeamStanding.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,14 +32,14 @@
#include "chat/ChatManager.h"
#include "infos/PlayerInfo.h"
#include "worldentities/pawns/Pawn.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "util/Convert.h"
namespace orxonox
{
- CreateUnloadableFactory(LastTeamStanding);
+ RegisterUnloadableClass(LastTeamStanding);
- LastTeamStanding::LastTeamStanding(BaseObject* creator) : TeamDeathmatch(creator)
+ LastTeamStanding::LastTeamStanding(Context* context) : TeamDeathmatch(context)
{
RegisterObject(LastTeamStanding);
this->bForceSpawn_ = true;
Modified: code/trunk/src/orxonox/gametypes/LastTeamStanding.h
===================================================================
--- code/trunk/src/orxonox/gametypes/LastTeamStanding.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/LastTeamStanding.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -70,7 +70,7 @@
virtual int getMinLives(); //!< Returns minimum of each player's lives; players with 0 lives are skipped;
public:
- LastTeamStanding(BaseObject* creator); //!< Default Constructor.
+ LastTeamStanding(Context* context); //!< Default Constructor.
virtual ~LastTeamStanding(); //!< Default Destructor.
virtual void playerEntered(PlayerInfo* player); //!< Initializes values.
Modified: code/trunk/src/orxonox/gametypes/Mission.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/Mission.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/Mission.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,9 +36,9 @@
namespace orxonox
{
- CreateUnloadableFactory(Mission);
+ RegisterUnloadableClass(Mission);
- Mission::Mission(BaseObject* creator) : TeamGametype(creator)
+ Mission::Mission(Context* context) : TeamGametype(context)
{
RegisterObject(Mission);
this->missionAccomplished_ = false;
Modified: code/trunk/src/orxonox/gametypes/Mission.h
===================================================================
--- code/trunk/src/orxonox/gametypes/Mission.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/Mission.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,7 +38,7 @@
class _OrxonoxExport Mission : public TeamGametype
{
public:
- Mission(BaseObject* creator);
+ Mission(Context* context);
virtual ~Mission() {}
virtual void tick(float dt);
Modified: code/trunk/src/orxonox/gametypes/TeamBaseMatch.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/TeamBaseMatch.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/TeamBaseMatch.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,9 +35,9 @@
namespace orxonox
{
- CreateUnloadableFactory(TeamBaseMatch);
+ RegisterUnloadableClass(TeamBaseMatch);
- TeamBaseMatch::TeamBaseMatch(BaseObject* creator) : TeamDeathmatch(creator)
+ TeamBaseMatch::TeamBaseMatch(Context* context) : TeamDeathmatch(context)
{
RegisterObject(TeamBaseMatch);
Modified: code/trunk/src/orxonox/gametypes/TeamBaseMatch.h
===================================================================
--- code/trunk/src/orxonox/gametypes/TeamBaseMatch.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/TeamBaseMatch.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OrxonoxExport TeamBaseMatch : public TeamDeathmatch
{
public:
- TeamBaseMatch(BaseObject* creator);
+ TeamBaseMatch(Context* context);
virtual ~TeamBaseMatch() {}
virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);
Modified: code/trunk/src/orxonox/gametypes/TeamDeathmatch.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/TeamDeathmatch.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/TeamDeathmatch.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,9 +35,9 @@
namespace orxonox
{
- CreateUnloadableFactory(TeamDeathmatch);
+ RegisterUnloadableClass(TeamDeathmatch);
- TeamDeathmatch::TeamDeathmatch(BaseObject* creator) : TeamGametype(creator)
+ TeamDeathmatch::TeamDeathmatch(Context* context) : TeamGametype(context)
{
RegisterObject(TeamDeathmatch);
}
Modified: code/trunk/src/orxonox/gametypes/TeamDeathmatch.h
===================================================================
--- code/trunk/src/orxonox/gametypes/TeamDeathmatch.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/TeamDeathmatch.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,7 +37,7 @@
class _OrxonoxExport TeamDeathmatch : public TeamGametype
{
public:
- TeamDeathmatch(BaseObject* creator);
+ TeamDeathmatch(Context* context);
virtual ~TeamDeathmatch() {}
virtual void start();
Modified: code/trunk/src/orxonox/gametypes/TeamGametype.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/TeamGametype.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/TeamGametype.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -29,7 +29,7 @@
#include "TeamGametype.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "infos/PlayerInfo.h"
#include "interfaces/TeamColourable.h"
#include "worldentities/TeamSpawnPoint.h"
@@ -39,9 +39,9 @@
namespace orxonox
{
- CreateUnloadableFactory(TeamGametype);
+ RegisterUnloadableClass(TeamGametype);
- TeamGametype::TeamGametype(BaseObject* creator) : Gametype(creator)
+ TeamGametype::TeamGametype(Context* context) : Gametype(context)
{
RegisterObject(TeamGametype);
Modified: code/trunk/src/orxonox/gametypes/TeamGametype.h
===================================================================
--- code/trunk/src/orxonox/gametypes/TeamGametype.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/TeamGametype.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OrxonoxExport TeamGametype : public Gametype
{
public:
- TeamGametype(BaseObject* creator);
+ TeamGametype(Context* context);
virtual ~TeamGametype() {}
void setConfigValues();
Modified: code/trunk/src/orxonox/gametypes/UnderAttack.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/UnderAttack.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/UnderAttack.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -30,16 +30,16 @@
#include "util/Convert.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "chat/ChatManager.h"
#include "worldentities/pawns/Destroyer.h"
#include "infos/PlayerInfo.h"
namespace orxonox
{
- CreateUnloadableFactory(UnderAttack);
+ RegisterUnloadableClass(UnderAttack);
- UnderAttack::UnderAttack(BaseObject* creator) : TeamDeathmatch(creator)
+ UnderAttack::UnderAttack(Context* context) : TeamDeathmatch(context)
{
RegisterObject(UnderAttack);
this->gameTime_ = 180;
Modified: code/trunk/src/orxonox/gametypes/UnderAttack.h
===================================================================
--- code/trunk/src/orxonox/gametypes/UnderAttack.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/gametypes/UnderAttack.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,7 +38,7 @@
class _OrxonoxExport UnderAttack : public TeamDeathmatch
{
public:
- UnderAttack(BaseObject* creator);
+ UnderAttack(Context* context);
virtual ~UnderAttack() {}
void setConfigValues();
Modified: code/trunk/src/orxonox/graphics/AnimatedModel.cc
===================================================================
--- code/trunk/src/orxonox/graphics/AnimatedModel.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/AnimatedModel.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,9 +38,9 @@
namespace orxonox
{
- CreateFactory(AnimatedModel);
+ RegisterClass(AnimatedModel);
- AnimatedModel::AnimatedModel(BaseObject* creator) : Model(creator)
+ AnimatedModel::AnimatedModel(Context* context) : Model(context)
{
RegisterObject(AnimatedModel);
}
Modified: code/trunk/src/orxonox/graphics/AnimatedModel.h
===================================================================
--- code/trunk/src/orxonox/graphics/AnimatedModel.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/AnimatedModel.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OrxonoxExport AnimatedModel : public Model, public Tickable
{
public:
- AnimatedModel(BaseObject* creator);
+ AnimatedModel(Context* context);
virtual ~AnimatedModel();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/graphics/Backlight.cc
===================================================================
--- code/trunk/src/orxonox/graphics/Backlight.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/Backlight.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,9 +44,9 @@
namespace orxonox
{
- CreateFactory(Backlight);
+ RegisterClass(Backlight);
- Backlight::Backlight(BaseObject* creator) : FadingBillboard(creator)
+ Backlight::Backlight(Context* context) : FadingBillboard(context)
{
RegisterObject(Backlight);
Modified: code/trunk/src/orxonox/graphics/Backlight.h
===================================================================
--- code/trunk/src/orxonox/graphics/Backlight.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/Backlight.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OrxonoxExport Backlight : public FadingBillboard, public TimeFactorListener
{
public:
- Backlight(BaseObject* creator);
+ Backlight(Context* context);
virtual ~Backlight();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/graphics/Billboard.cc
===================================================================
--- code/trunk/src/orxonox/graphics/Billboard.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/Billboard.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,9 +37,9 @@
namespace orxonox
{
- CreateFactory(Billboard);
+ RegisterClass(Billboard);
- Billboard::Billboard(BaseObject* creator) : StaticEntity(creator)
+ Billboard::Billboard(Context* context) : StaticEntity(context)
{
RegisterObject(Billboard);
Modified: code/trunk/src/orxonox/graphics/Billboard.h
===================================================================
--- code/trunk/src/orxonox/graphics/Billboard.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/Billboard.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,7 +43,7 @@
class _OrxonoxExport Billboard : public StaticEntity, public TeamColourable
{
public:
- Billboard(BaseObject* creator);
+ Billboard(Context* context);
virtual ~Billboard();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/graphics/BlinkingBillboard.cc
===================================================================
--- code/trunk/src/orxonox/graphics/BlinkingBillboard.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/BlinkingBillboard.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,9 +34,9 @@
namespace orxonox
{
- CreateFactory(BlinkingBillboard);
+ RegisterClass(BlinkingBillboard);
- BlinkingBillboard::BlinkingBillboard(BaseObject* creator) : Billboard(creator)
+ BlinkingBillboard::BlinkingBillboard(Context* context) : Billboard(context)
{
RegisterObject(BlinkingBillboard);
Modified: code/trunk/src/orxonox/graphics/BlinkingBillboard.h
===================================================================
--- code/trunk/src/orxonox/graphics/BlinkingBillboard.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/BlinkingBillboard.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OrxonoxExport BlinkingBillboard : public Billboard, public Tickable
{
public:
- BlinkingBillboard(BaseObject* creator);
+ BlinkingBillboard(Context* context);
virtual ~BlinkingBillboard();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/graphics/Camera.cc
===================================================================
--- code/trunk/src/orxonox/graphics/Camera.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/Camera.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,7 +36,7 @@
#include "util/Exception.h"
#include "util/StringUtils.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/GameMode.h"
#include "core/GUIManager.h"
#include "Scene.h"
@@ -45,9 +45,9 @@
namespace orxonox
{
- CreateFactory(Camera);
+ RegisterClass(Camera);
- Camera::Camera(BaseObject* creator) : StaticEntity(creator)
+ Camera::Camera(Context* context) : StaticEntity(context)
{
RegisterObject(Camera);
Modified: code/trunk/src/orxonox/graphics/Camera.h
===================================================================
--- code/trunk/src/orxonox/graphics/Camera.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/Camera.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -45,7 +45,7 @@
friend class CameraManager;
public:
- Camera(BaseObject* creator);
+ Camera(Context* context);
virtual ~Camera();
void setConfigValues();
Modified: code/trunk/src/orxonox/graphics/FadingBillboard.cc
===================================================================
--- code/trunk/src/orxonox/graphics/FadingBillboard.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/FadingBillboard.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,9 +33,9 @@
namespace orxonox
{
- CreateFactory(FadingBillboard);
+ RegisterClass(FadingBillboard);
- FadingBillboard::FadingBillboard(BaseObject* creator) : Billboard(creator)
+ FadingBillboard::FadingBillboard(Context* context) : Billboard(context)
{
RegisterObject(FadingBillboard);
Modified: code/trunk/src/orxonox/graphics/FadingBillboard.h
===================================================================
--- code/trunk/src/orxonox/graphics/FadingBillboard.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/FadingBillboard.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,7 +41,7 @@
class _OrxonoxExport FadingBillboard : public Billboard, public Tickable
{
public:
- FadingBillboard(BaseObject* creator);
+ FadingBillboard(Context* context);
virtual ~FadingBillboard();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/graphics/GlobalShader.cc
===================================================================
--- code/trunk/src/orxonox/graphics/GlobalShader.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/GlobalShader.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,9 +35,9 @@
namespace orxonox
{
- CreateFactory(GlobalShader);
+ RegisterClass(GlobalShader);
- GlobalShader::GlobalShader(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
+ GlobalShader::GlobalShader(Context* context) : BaseObject(context), Synchronisable(context)
{
RegisterObject(GlobalShader);
Modified: code/trunk/src/orxonox/graphics/GlobalShader.h
===================================================================
--- code/trunk/src/orxonox/graphics/GlobalShader.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/GlobalShader.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OrxonoxExport GlobalShader : public BaseObject, public Synchronisable
{
public:
- GlobalShader(BaseObject* creator);
+ GlobalShader(Context* context);
virtual ~GlobalShader();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/graphics/Light.cc
===================================================================
--- code/trunk/src/orxonox/graphics/Light.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/Light.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,14 +41,14 @@
namespace orxonox
{
- CreateFactory(Light);
+ RegisterClass(Light);
// Be sure we don't do bad conversions
BOOST_STATIC_ASSERT((int)Ogre::Light::LT_POINT == (int)Light::Point);
BOOST_STATIC_ASSERT((int)Ogre::Light::LT_DIRECTIONAL == (int)Light::Directional);
BOOST_STATIC_ASSERT((int)Ogre::Light::LT_SPOTLIGHT == (int)Light::Spotlight);
- Light::Light(BaseObject* creator) : StaticEntity(creator)
+ Light::Light(Context* context) : StaticEntity(context)
{
RegisterObject(Light);
Modified: code/trunk/src/orxonox/graphics/Light.h
===================================================================
--- code/trunk/src/orxonox/graphics/Light.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/Light.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -52,7 +52,7 @@
};
public:
- Light(BaseObject* creator);
+ Light(Context* context);
virtual ~Light();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/graphics/MeshLodInformation.cc
===================================================================
--- code/trunk/src/orxonox/graphics/MeshLodInformation.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/MeshLodInformation.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,10 +37,10 @@
namespace orxonox
{
- CreateFactory(MeshLodInformation);
+ RegisterClass(MeshLodInformation);
- MeshLodInformation::MeshLodInformation(BaseObject* creator)
- : BaseObject(creator), lodLevel_(5), bEnabled_(true), numLevels_(10), reductionRate_(0.15f)
+ MeshLodInformation::MeshLodInformation(Context* context)
+ : BaseObject(context), lodLevel_(5), bEnabled_(true), numLevels_(10), reductionRate_(0.15f)
{
RegisterObject(MeshLodInformation);
}
Modified: code/trunk/src/orxonox/graphics/MeshLodInformation.h
===================================================================
--- code/trunk/src/orxonox/graphics/MeshLodInformation.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/MeshLodInformation.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OrxonoxExport MeshLodInformation : public BaseObject
{
public:
- MeshLodInformation(BaseObject* creator);
+ MeshLodInformation(Context* context);
virtual ~MeshLodInformation();
float getLodLevel();
Modified: code/trunk/src/orxonox/graphics/Model.cc
===================================================================
--- code/trunk/src/orxonox/graphics/Model.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/Model.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -31,7 +31,7 @@
#include <OgreEntity.h>
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/GameMode.h"
#include "core/XMLPort.h"
#include "Scene.h"
@@ -40,10 +40,10 @@
namespace orxonox
{
- CreateFactory(Model);
+ RegisterClass(Model);
- Model::Model(BaseObject* creator) :
- StaticEntity(creator), bCastShadows_(true), lodLevel_(5), bLodEnabled_(true), numLodLevels_(10), lodReductionRate_(.15f)
+ Model::Model(Context* context) :
+ StaticEntity(context), bCastShadows_(true), lodLevel_(5), bLodEnabled_(true), numLodLevels_(10), lodReductionRate_(.15f)
{
RegisterObject(Model);
Modified: code/trunk/src/orxonox/graphics/Model.h
===================================================================
--- code/trunk/src/orxonox/graphics/Model.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/Model.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OrxonoxExport Model : public StaticEntity
{
public:
- Model(BaseObject* creator);
+ Model(Context* context);
virtual ~Model();
void setConfigValues();
Modified: code/trunk/src/orxonox/graphics/ParticleEmitter.cc
===================================================================
--- code/trunk/src/orxonox/graphics/ParticleEmitter.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/ParticleEmitter.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,9 +42,9 @@
namespace orxonox
{
- CreateFactory(ParticleEmitter);
+ RegisterClass(ParticleEmitter);
- ParticleEmitter::ParticleEmitter(BaseObject* creator) : StaticEntity(creator)
+ ParticleEmitter::ParticleEmitter(Context* context) : StaticEntity(context)
{
RegisterObject(ParticleEmitter);
@@ -62,7 +62,7 @@
if (this->isInitialized() && this->particles_)
{
this->detachOgreObject(this->particles_->getParticleSystem());
- this->particles_->destroy();
+ delete this->particles_;
}
}
@@ -100,7 +100,7 @@
{
if (this->particles_)
{
- this->particles_->destroy();
+ delete this->particles_;
this->particles_ = 0;
}
Modified: code/trunk/src/orxonox/graphics/ParticleEmitter.h
===================================================================
--- code/trunk/src/orxonox/graphics/ParticleEmitter.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/ParticleEmitter.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OrxonoxExport ParticleEmitter : public StaticEntity
{
public:
- ParticleEmitter(BaseObject* creator);
+ ParticleEmitter(Context* context);
virtual ~ParticleEmitter();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/graphics/ParticleSpawner.cc
===================================================================
--- code/trunk/src/orxonox/graphics/ParticleSpawner.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/ParticleSpawner.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,9 +36,9 @@
namespace orxonox
{
- CreateFactory(ParticleSpawner);
+ RegisterClass(ParticleSpawner);
- ParticleSpawner::ParticleSpawner(BaseObject* creator) : ParticleEmitter(creator)
+ ParticleSpawner::ParticleSpawner(Context* context) : ParticleEmitter(context)
{
RegisterObject(ParticleSpawner);
Modified: code/trunk/src/orxonox/graphics/ParticleSpawner.h
===================================================================
--- code/trunk/src/orxonox/graphics/ParticleSpawner.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/graphics/ParticleSpawner.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OrxonoxExport ParticleSpawner : public ParticleEmitter
{
public:
- ParticleSpawner(BaseObject* creator);
+ ParticleSpawner(Context* context);
virtual ~ParticleSpawner();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/infos/Bot.cc
===================================================================
--- code/trunk/src/orxonox/infos/Bot.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/infos/Bot.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -31,15 +31,15 @@
#include "util/Math.h"
#include "core/GameMode.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "gametypes/Gametype.h"
#include "controllers/AIController.h"
namespace orxonox
{
- CreateFactory(Bot);
+ RegisterClass(Bot);
- Bot::Bot(BaseObject* creator) : PlayerInfo(creator)
+ Bot::Bot(Context* context) : PlayerInfo(context)
{
RegisterObject(Bot);
Modified: code/trunk/src/orxonox/infos/Bot.h
===================================================================
--- code/trunk/src/orxonox/infos/Bot.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/infos/Bot.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OrxonoxExport Bot : public PlayerInfo
{
public:
- Bot(BaseObject* creator);
+ Bot(Context* context);
virtual ~Bot();
void setConfigValues();
Modified: code/trunk/src/orxonox/infos/GametypeInfo.cc
===================================================================
--- code/trunk/src/orxonox/infos/GametypeInfo.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/infos/GametypeInfo.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -47,7 +47,7 @@
namespace orxonox
{
- CreateUnloadableFactory(GametypeInfo);
+ RegisterUnloadableClass(GametypeInfo);
registerMemberNetworkFunction(GametypeInfo, dispatchAnnounceMessage);
registerMemberNetworkFunction(GametypeInfo, dispatchKillMessage);
@@ -64,7 +64,7 @@
@brief
Registers and initializes the object.
*/
- GametypeInfo::GametypeInfo(BaseObject* creator) : Info(creator)
+ GametypeInfo::GametypeInfo(Context* context) : Info(context)
{
RegisterObject(GametypeInfo);
Modified: code/trunk/src/orxonox/infos/GametypeInfo.h
===================================================================
--- code/trunk/src/orxonox/infos/GametypeInfo.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/infos/GametypeInfo.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -57,7 +57,7 @@
friend class Gametype;
public:
- GametypeInfo(BaseObject* creator);
+ GametypeInfo(Context* context);
virtual ~GametypeInfo();
/**
Modified: code/trunk/src/orxonox/infos/HumanPlayer.cc
===================================================================
--- code/trunk/src/orxonox/infos/HumanPlayer.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/infos/HumanPlayer.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -29,7 +29,7 @@
#include "HumanPlayer.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/GameMode.h"
// #include "network/ClientInformation.h"
#include "network/Host.h"
@@ -40,9 +40,9 @@
namespace orxonox
{
- CreateUnloadableFactory(HumanPlayer);
+ RegisterUnloadableClass(HumanPlayer);
- HumanPlayer::HumanPlayer(BaseObject* creator) : PlayerInfo(creator)
+ HumanPlayer::HumanPlayer(Context* context) : PlayerInfo(context)
{
RegisterObject(HumanPlayer);
@@ -182,7 +182,7 @@
if (this->isLocalPlayer() && !this->humanHudTemplate_.empty() && GameMode::showsGraphics())
{
- this->humanHud_ = new OverlayGroup(this);
+ this->humanHud_ = new OverlayGroup(this->getContext());
this->humanHud_->addTemplate(this->humanHudTemplate_);
this->humanHud_->setOwner(this);
}
@@ -198,7 +198,7 @@
if (this->isLocalPlayer() && !this->gametypeHudTemplate_.empty())
{
- this->gametypeHud_ = new OverlayGroup(this);
+ this->gametypeHud_ = new OverlayGroup(this->getContext());
this->gametypeHud_->addTemplate(this->gametypeHudTemplate_);
this->gametypeHud_->setOwner(this);
}
Modified: code/trunk/src/orxonox/infos/HumanPlayer.h
===================================================================
--- code/trunk/src/orxonox/infos/HumanPlayer.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/infos/HumanPlayer.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OrxonoxExport HumanPlayer : public PlayerInfo
{
public:
- HumanPlayer(BaseObject* creator);
+ HumanPlayer(Context* context);
virtual ~HumanPlayer();
void setConfigValues();
Modified: code/trunk/src/orxonox/infos/Info.cc
===================================================================
--- code/trunk/src/orxonox/infos/Info.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/infos/Info.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -31,7 +31,9 @@
namespace orxonox
{
- Info::Info(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
+ RegisterClass(Info);
+
+ Info::Info(Context* context) : BaseObject(context), Synchronisable(context)
{
RegisterObject(Info);
}
Modified: code/trunk/src/orxonox/infos/Info.h
===================================================================
--- code/trunk/src/orxonox/infos/Info.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/infos/Info.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OrxonoxExport Info : public BaseObject, public Synchronisable
{
public:
- Info(BaseObject* creator);
+ Info(Context* context);
virtual ~Info() {}
};
}
Modified: code/trunk/src/orxonox/infos/PlayerInfo.cc
===================================================================
--- code/trunk/src/orxonox/infos/PlayerInfo.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/infos/PlayerInfo.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,9 @@
namespace orxonox
{
- PlayerInfo::PlayerInfo(BaseObject* creator) : Info(creator)
+ RegisterAbstractClass(PlayerInfo).inheritsFrom(Class(Info));
+
+ PlayerInfo::PlayerInfo(Context* context) : Info(context)
{
RegisterObject(PlayerInfo);
@@ -135,7 +137,7 @@
this->controller_->destroy();
this->controller_ = 0;
}
- this->controller_ = this->defaultController_.fabricate(this);
+ this->controller_ = this->defaultController_.fabricate(this->getContext());
assert(this->controller_);
this->controller_->setPlayer(this);
if (this->controllableEntity_)
Modified: code/trunk/src/orxonox/infos/PlayerInfo.h
===================================================================
--- code/trunk/src/orxonox/infos/PlayerInfo.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/infos/PlayerInfo.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,7 +32,7 @@
#include "OrxonoxPrereqs.h"
#include "Info.h"
-#include "core/SubclassIdentifier.h"
+#include "core/class/SubclassIdentifier.h"
namespace orxonox // tolua_export
{ // tolua_export
@@ -40,7 +40,7 @@
: public Info
{ // tolua_export
public:
- PlayerInfo(BaseObject* creator);
+ PlayerInfo(Context* context);
virtual ~PlayerInfo();
virtual void changedName();
Modified: code/trunk/src/orxonox/interfaces/GametypeMessageListener.h
===================================================================
--- code/trunk/src/orxonox/interfaces/GametypeMessageListener.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/interfaces/GametypeMessageListener.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -30,11 +30,11 @@
#define _GametypeMessageListener_H__
#include "OrxonoxPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxInterface.h"
namespace orxonox
{
- class _OrxonoxExport GametypeMessageListener : virtual public OrxonoxClass
+ class _OrxonoxExport GametypeMessageListener : virtual public OrxonoxInterface
{
public:
GametypeMessageListener();
Modified: code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -49,17 +49,21 @@
//----------------------------
// GametypeMessageListener
//----------------------------
+ RegisterAbstractClass(GametypeMessageListener).inheritsFrom(Class(OrxonoxInterface));
+
GametypeMessageListener::GametypeMessageListener()
{
- RegisterRootObject(GametypeMessageListener);
+ RegisterObject(GametypeMessageListener);
}
//----------------------------
// PlayerTrigger
//----------------------------
+ RegisterAbstractClass(PlayerTrigger).inheritsFrom(Class(OrxonoxInterface));
+
PlayerTrigger::PlayerTrigger()
{
- RegisterRootObject(PlayerTrigger);
+ RegisterObject(PlayerTrigger);
this->isForPlayer_ = false;
}
@@ -75,24 +79,30 @@
//----------------------------
// RadarListener
//----------------------------
+ RegisterAbstractClass(RadarListener).inheritsFrom(Class(OrxonoxInterface));
+
RadarListener::RadarListener()
{
- RegisterRootObject(RadarListener);
+ RegisterObject(RadarListener);
}
//----------------------------
// TeamColourable
//----------------------------
+ RegisterAbstractClass(TeamColourable).inheritsFrom(Class(OrxonoxInterface));
+
TeamColourable::TeamColourable()
{
- RegisterRootObject(TeamColourable);
+ RegisterObject(TeamColourable);
}
//----------------------------
// Rewardable
//----------------------------
+ RegisterAbstractClass(Rewardable).inheritsFrom(Class(OrxonoxInterface));
+
Rewardable::Rewardable()
{
- RegisterRootObject(Rewardable);
+ RegisterObject(Rewardable);
}
}
Modified: code/trunk/src/orxonox/interfaces/NotificationListener.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/NotificationListener.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/interfaces/NotificationListener.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -52,7 +52,7 @@
NotificationListener::NotificationListener()
{
- RegisterRootObject(NotificationListener);
+ RegisterObject(NotificationListener);
}
/**
@@ -158,4 +158,4 @@
}
}
-}
\ No newline at end of file
+}
Modified: code/trunk/src/orxonox/interfaces/NotificationListener.h
===================================================================
--- code/trunk/src/orxonox/interfaces/NotificationListener.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/interfaces/NotificationListener.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,7 +43,7 @@
#include "util/StringUtils.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxInterface.h"
namespace orxonox
{
@@ -89,7 +89,7 @@
@ingroup Notifications
@todo Consistent terminology between message, notification and command.
*/
- class _OrxonoxExport NotificationListener : virtual public OrxonoxClass
+ class _OrxonoxExport NotificationListener : virtual public OrxonoxInterface
{
public:
NotificationListener();
Modified: code/trunk/src/orxonox/interfaces/PickupCarrier.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/PickupCarrier.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/interfaces/PickupCarrier.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,11 +34,13 @@
#include "PickupCarrier.h"
#include "core/CoreIncludes.h"
-#include "core/Identifier.h"
+#include "core/class/Identifier.h"
#include "Pickupable.h"
-namespace orxonox {
+namespace orxonox
+{
+ RegisterAbstractClass(PickupCarrier).inheritsFrom(Class(OrxonoxInterface));
/**
@brief
@@ -46,7 +48,7 @@
*/
PickupCarrier::PickupCarrier()
{
- RegisterRootObject(PickupCarrier);
+ RegisterObject(PickupCarrier);
}
/**
Modified: code/trunk/src/orxonox/interfaces/PickupCarrier.h
===================================================================
--- code/trunk/src/orxonox/interfaces/PickupCarrier.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/interfaces/PickupCarrier.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
#include <set>
#include <vector>
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxInterface.h"
namespace orxonox
{
@@ -65,7 +65,7 @@
@ingroup Pickup
*/
- class _OrxonoxExport PickupCarrier : virtual public OrxonoxClass
+ class _OrxonoxExport PickupCarrier : virtual public OrxonoxInterface
{
// So that the different Pickupables have full access to their PickupCarrier.
friend class Pickupable;
Modified: code/trunk/src/orxonox/interfaces/PickupListener.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/PickupListener.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/interfaces/PickupListener.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -46,7 +46,7 @@
*/
PickupListener::PickupListener()
{
- RegisterRootObject(PickupListener);
+ RegisterObject(PickupListener);
}
/**
Modified: code/trunk/src/orxonox/interfaces/PickupListener.h
===================================================================
--- code/trunk/src/orxonox/interfaces/PickupListener.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/interfaces/PickupListener.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,7 +38,7 @@
#include "Pickupable.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxInterface.h"
namespace orxonox
{
@@ -54,7 +54,7 @@
@ingroup Pickup
*/
- class _OrxonoxExport PickupListener : virtual public OrxonoxClass
+ class _OrxonoxExport PickupListener : virtual public OrxonoxInterface
{
public:
PickupListener();
Modified: code/trunk/src/orxonox/interfaces/Pickupable.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/Pickupable.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/interfaces/Pickupable.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,7 +33,7 @@
#include "Pickupable.h"
-#include "core/Identifier.h"
+#include "core/class/Identifier.h"
#include "core/CoreIncludes.h"
#include "util/Convert.h"
@@ -45,6 +45,7 @@
namespace orxonox
{
+ RegisterAbstractClass(Pickupable).inheritsFrom(Class(OrxonoxInterface)).inheritsFrom(Class(Rewardable));
/**
@brief
@@ -52,7 +53,7 @@
*/
Pickupable::Pickupable() : used_(false), pickedUp_(false)
{
- RegisterRootObject(Pickupable);
+ RegisterObject(Pickupable);
this->carrier_ = NULL;
@@ -70,7 +71,7 @@
/**
@brief
- A method that is called by OrxonoxClass::destroy() before the object is actually destroyed.
+ A method that is called by Destroyable::destroy() before the object is actually destroyed.
*/
void Pickupable::preDestroy(void)
{
@@ -97,7 +98,7 @@
void Pickupable::destroyPickup(void)
{
if(!this->isBeingDestroyed())
- this->OrxonoxClass::destroy();
+ this->Destroyable::destroy();
else
orxout(internal_warning, context::pickups) << this->getIdentifier()->getName() << " may be unsafe. " << endl;
}
Modified: code/trunk/src/orxonox/interfaces/Pickupable.h
===================================================================
--- code/trunk/src/orxonox/interfaces/Pickupable.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/interfaces/Pickupable.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,9 +38,9 @@
#include "OrxonoxPrereqs.h"
#include <list>
-#include "core/Super.h"
+#include "core/class/Super.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxInterface.h"
#include "Rewardable.h"
namespace orxonox
@@ -57,7 +57,7 @@
@ingroup Pickup
*/
- class _OrxonoxExport Pickupable : virtual public OrxonoxClass, public Rewardable
+ class _OrxonoxExport Pickupable : virtual public OrxonoxInterface, public Rewardable
{
friend class PickupCarrier;
@@ -143,7 +143,7 @@
void destroy(void); //!< Is called internally within the Pickupable module to destroy pickups.
protected:
- virtual void preDestroy(void); //!< A method that is called by OrxonoxClass::destroy() before the object is actually destroyed.
+ virtual void preDestroy(void); //!< A method that is called by Destroyable::destroy() before the object is actually destroyed.
virtual void destroyPickup(void); //!< Destroys a Pickupable.
virtual void carrierDestroyed(void); //!< Is called by the PickupCarrier when it is being destroyed.
Modified: code/trunk/src/orxonox/interfaces/PlayerTrigger.h
===================================================================
--- code/trunk/src/orxonox/interfaces/PlayerTrigger.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/interfaces/PlayerTrigger.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,8 +37,8 @@
#include "OrxonoxPrereqs.h"
-#include "core/OrxonoxClass.h"
-#include "core/WeakPtr.h"
+#include "core/class/OrxonoxInterface.h"
+#include "core/object/WeakPtr.h"
namespace orxonox
{
@@ -51,7 +51,7 @@
@ingroup Triggers
*/
- class _OrxonoxExport PlayerTrigger : virtual public OrxonoxClass
+ class _OrxonoxExport PlayerTrigger : virtual public OrxonoxInterface
{
public:
PlayerTrigger();
Modified: code/trunk/src/orxonox/interfaces/RadarListener.h
===================================================================
--- code/trunk/src/orxonox/interfaces/RadarListener.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/interfaces/RadarListener.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -30,11 +30,11 @@
#define _RadarListener_H__
#include "OrxonoxPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxInterface.h"
namespace orxonox
{
- class _OrxonoxExport RadarListener : virtual public OrxonoxClass
+ class _OrxonoxExport RadarListener : virtual public OrxonoxInterface
{
public:
RadarListener();
Modified: code/trunk/src/orxonox/interfaces/RadarViewable.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/RadarViewable.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/interfaces/RadarViewable.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,6 +37,8 @@
namespace orxonox
{
+ RegisterAbstractClass(RadarViewable).inheritsFrom(Class(OrxonoxInterface));
+
/**
@brief Constructor.
*/
@@ -44,19 +46,18 @@
: isHumanShip_(false)
, bVisibility_(true)
, bInitialized_(false)
- , creator_(creator)
, wePtr_(wePtr)
, radarObjectCamouflage_(0.0f)
, radarObjectShape_(Dot)
, radarObjectDescription_("staticObject")
, scale_(1.0f)
{
- RegisterRootObject(RadarViewable);
+ RegisterObject(RadarViewable);
this->uniqueId_=getUniqueNumberString();
if( GameMode::showsGraphics() )
{
- this->radar_ = this->creator_->getScene()->getRadar();
+ this->radar_ = creator->getScene()->getRadar();
this->radar_->addRadarObject(this);
}
this->bInitialized_ = true;
Modified: code/trunk/src/orxonox/interfaces/RadarViewable.h
===================================================================
--- code/trunk/src/orxonox/interfaces/RadarViewable.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/interfaces/RadarViewable.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,8 +35,8 @@
#include <cassert>
#include "util/Math.h"
-#include "core/OrxonoxClass.h"
-#include "core/SmartPtr.h"
+#include "core/class/OrxonoxInterface.h"
+#include "core/object/SmartPtr.h"
namespace orxonox
{
@@ -45,7 +45,7 @@
/**
@brief Interface for receiving window events.
*/
- class _OrxonoxExport RadarViewable : virtual public OrxonoxClass
+ class _OrxonoxExport RadarViewable : virtual public OrxonoxInterface
{
public:
enum Shape
@@ -152,7 +152,6 @@
bool bInitialized_;
//Map
std::string uniqueId_;
- BaseObject* creator_;
//Radar
Modified: code/trunk/src/orxonox/interfaces/Rewardable.h
===================================================================
--- code/trunk/src/orxonox/interfaces/Rewardable.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/interfaces/Rewardable.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,7 +35,7 @@
#define _Rewardable_H__
#include "OrxonoxPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxInterface.h"
namespace orxonox
{
@@ -47,7 +47,7 @@
@author
Damian 'Mozork' Frick
*/
- class _OrxonoxExport Rewardable : virtual public OrxonoxClass
+ class _OrxonoxExport Rewardable : virtual public OrxonoxInterface
{
public:
Rewardable();
Modified: code/trunk/src/orxonox/interfaces/TeamColourable.h
===================================================================
--- code/trunk/src/orxonox/interfaces/TeamColourable.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/interfaces/TeamColourable.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,11 +32,11 @@
#include "OrxonoxPrereqs.h"
#include "util/UtilPrereqs.h"
-#include "core/OrxonoxClass.h"
+#include "core/class/OrxonoxInterface.h"
namespace orxonox
{
- class _OrxonoxExport TeamColourable : virtual public OrxonoxClass
+ class _OrxonoxExport TeamColourable : virtual public OrxonoxInterface
{
public:
virtual void setTeamColour(const ColourValue& colour) = 0;
Modified: code/trunk/src/orxonox/items/Engine.cc
===================================================================
--- code/trunk/src/orxonox/items/Engine.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/items/Engine.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -29,7 +29,7 @@
#include "Engine.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/Template.h"
#include "core/XMLPort.h"
#include "util/Math.h"
@@ -39,13 +39,13 @@
namespace orxonox
{
- CreateFactory(Engine);
+ RegisterClass(Engine);
/**
@brief
Constructor. Registers and initializes the object.
*/
- Engine::Engine(BaseObject* creator) : Item(creator)
+ Engine::Engine(Context* context) : Item(context)
{
RegisterObject(Engine);
Modified: code/trunk/src/orxonox/items/Engine.h
===================================================================
--- code/trunk/src/orxonox/items/Engine.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/items/Engine.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -55,7 +55,7 @@
class _OrxonoxExport Engine : public Item
{
public:
- Engine(BaseObject* creator);
+ Engine(Context* context);
virtual ~Engine();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/items/Item.cc
===================================================================
--- code/trunk/src/orxonox/items/Item.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/items/Item.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -31,7 +31,9 @@
namespace orxonox
{
- Item::Item(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
+ RegisterClass(Item);
+
+ Item::Item(Context* context) : BaseObject(context), Synchronisable(context)
{
RegisterObject(Item);
}
Modified: code/trunk/src/orxonox/items/Item.h
===================================================================
--- code/trunk/src/orxonox/items/Item.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/items/Item.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OrxonoxExport Item : public BaseObject, public Synchronisable
{
public:
- Item(BaseObject* creator);
+ Item(Context* context);
virtual ~Item() {}
};
}
Modified: code/trunk/src/orxonox/items/MultiStateEngine.cc
===================================================================
--- code/trunk/src/orxonox/items/MultiStateEngine.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/items/MultiStateEngine.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -48,16 +48,16 @@
static const float MAX_VELOCITY_NORMAL = 111;
static const float MAX_VELOCITY_BOOST = 221;
- CreateFactory(MultiStateEngine);
+ RegisterClass(MultiStateEngine);
- MultiStateEngine::MultiStateEngine(BaseObject* creator) : Engine(creator)
+ MultiStateEngine::MultiStateEngine(Context* context) : Engine(context)
{
RegisterObject(MultiStateEngine);
if (GameMode::isMaster())
{
- this->defEngineSndNormal_ = new WorldSound(this);
- this->defEngineSndBoost_ = new WorldSound(this);
+ this->defEngineSndNormal_ = new WorldSound(this->getContext());
+ this->defEngineSndBoost_ = new WorldSound(this->getContext());
this->defEngineSndNormal_->setLooping(true);
this->defEngineSndBoost_->setLooping(true);
this->lua_ = new LuaState();
Modified: code/trunk/src/orxonox/items/MultiStateEngine.h
===================================================================
--- code/trunk/src/orxonox/items/MultiStateEngine.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/items/MultiStateEngine.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -48,7 +48,7 @@
Boost = 8
};
- MultiStateEngine(BaseObject* creator);
+ MultiStateEngine(Context* context);
virtual ~MultiStateEngine();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/overlays/GUISheet.cc
===================================================================
--- code/trunk/src/orxonox/overlays/GUISheet.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/overlays/GUISheet.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,10 +35,10 @@
namespace orxonox
{
- CreateFactory(GUISheet);
+ RegisterClass(GUISheet);
- GUISheet::GUISheet(BaseObject* creator)
- : BaseObject(creator)
+ GUISheet::GUISheet(Context* context)
+ : BaseObject(context)
, bShowOnLoad_(false)
, bHidePrevious_(false)
, bHidePreviousSet_(false)
Modified: code/trunk/src/orxonox/overlays/GUISheet.h
===================================================================
--- code/trunk/src/orxonox/overlays/GUISheet.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/overlays/GUISheet.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OrxonoxExport GUISheet : public BaseObject
{
public:
- GUISheet(BaseObject* creator);
+ GUISheet(Context* context);
~GUISheet();
void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/overlays/InGameConsole.cc
===================================================================
--- code/trunk/src/orxonox/overlays/InGameConsole.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/overlays/InGameConsole.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -48,7 +48,7 @@
#include "util/output/MemoryWriter.h"
#include "util/output/OutputManager.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/command/ConsoleCommand.h"
#include "core/GUIManager.h"
#include "core/input/InputManager.h"
@@ -109,7 +109,7 @@
InputManager::getInstance().destroyState("console");
// destroy the underlaying shell
- this->shell_->destroy();
+ delete this->shell_;
Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr();
if (ovMan)
Modified: code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -62,8 +62,10 @@
SetConsoleCommand("OrxonoxOverlay", "show", &OrxonoxOverlay::showOverlay);
SetConsoleCommand("OrxonoxOverlay", "rotateOverlay", &OrxonoxOverlay::rotateOverlay);
- OrxonoxOverlay::OrxonoxOverlay(BaseObject* creator)
- : BaseObject(creator)
+ RegisterClass(OrxonoxOverlay);
+
+ OrxonoxOverlay::OrxonoxOverlay(Context* context)
+ : BaseObject(context)
{
RegisterObject(OrxonoxOverlay);
Modified: code/trunk/src/orxonox/overlays/OrxonoxOverlay.h
===================================================================
--- code/trunk/src/orxonox/overlays/OrxonoxOverlay.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/overlays/OrxonoxOverlay.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,8 +41,8 @@
#include "util/Math.h"
#include "util/OgreForwardRefs.h"
#include "core/BaseObject.h"
-#include "core/Super.h"
#include "core/WindowEventListener.h"
+#include "core/class/Super.h"
namespace orxonox
{
@@ -86,7 +86,7 @@
};
public:
- OrxonoxOverlay(BaseObject* creator);
+ OrxonoxOverlay(Context* context);
virtual ~OrxonoxOverlay();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/overlays/OverlayGroup.cc
===================================================================
--- code/trunk/src/orxonox/overlays/OverlayGroup.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/overlays/OverlayGroup.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,15 +40,15 @@
namespace orxonox
{
- CreateFactory(OverlayGroup);
+ RegisterClass(OverlayGroup);
SetConsoleCommand("OverlayGroup", "toggleVisibility", &OverlayGroup::toggleVisibility);
SetConsoleCommand("OverlayGroup", "show", &OverlayGroup::show);
SetConsoleCommand("OverlayGroup", "scaleGroup", &OverlayGroup::scaleGroup);
SetConsoleCommand("OverlayGroup", "scrollGroup", &OverlayGroup::scrollGroup);
- OverlayGroup::OverlayGroup(BaseObject* creator)
- : BaseObject(creator)
+ OverlayGroup::OverlayGroup(Context* context)
+ : BaseObject(context)
{
RegisterObject(OverlayGroup);
@@ -149,6 +149,15 @@
(*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed
}
+ //! Changes the gametype of all elements
+ void OverlayGroup::changedGametype()
+ {
+ SUPER( OverlayGroup, changedGametype );
+
+ for (std::set< SmartPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)
+ (*it)->setGametype(this->getGametype());
+ }
+
void OverlayGroup::setOwner(BaseObject* owner)
{
this->owner_ = owner;
Modified: code/trunk/src/orxonox/overlays/OverlayGroup.h
===================================================================
--- code/trunk/src/orxonox/overlays/OverlayGroup.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/overlays/OverlayGroup.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -53,7 +53,7 @@
class _OrxonoxExport OverlayGroup : public BaseObject
{
public:
- OverlayGroup(BaseObject* creator);
+ OverlayGroup(Context* context);
//! Empty destructor.
~OverlayGroup();
@@ -67,7 +67,8 @@
inline const std::set< SmartPtr<OrxonoxOverlay> >& getOverlays() const
{ return this->hudElements_; }
- void changedVisibility();
+ virtual void changedVisibility();
+ virtual void changedGametype();
void setOwner(BaseObject* owner);
inline BaseObject* getOwner() const
Modified: code/trunk/src/orxonox/sound/BaseSound.cc
===================================================================
--- code/trunk/src/orxonox/sound/BaseSound.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/sound/BaseSound.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,6 +42,8 @@
namespace orxonox
{
+ RegisterAbstractClass(BaseSound).inheritsFrom(Class(Listable));
+
BaseSound::BaseSound()
: bPooling_(false)
, volume_(1.0)
@@ -49,7 +51,7 @@
, state_(Stopped)
, pitch_ (1.0)
{
- RegisterRootObject(BaseSound);
+ RegisterObject(BaseSound);
// Initialise audioSource_ to a value that is not a source
// 0 is unfortunately not guaranteed to be no source ID.
Modified: code/trunk/src/orxonox/sound/BaseSound.h
===================================================================
--- code/trunk/src/orxonox/sound/BaseSound.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/sound/BaseSound.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,7 +34,7 @@
#include <string>
#include <boost/shared_ptr.hpp>
#include <OgreDataStream.h>
-#include "core/OrxonoxClass.h"
+#include "core/object/Listable.h"
namespace orxonox
{
@@ -42,7 +42,7 @@
* The BaseSound class is the base class for all sound file loader classes.
* It serves as main interface to the OpenAL library.
*/
- class _OrxonoxExport BaseSound : virtual public OrxonoxClass
+ class _OrxonoxExport BaseSound : virtual public Listable
{
public:
BaseSound();
Modified: code/trunk/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/trunk/src/orxonox/sound/SoundManager.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/sound/SoundManager.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,7 +38,7 @@
#include "util/Math.h"
#include "util/Clock.h"
#include "util/ScopedSingletonManager.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/CoreIncludes.h"
#include "core/GameMode.h"
#include "core/Resource.h"
@@ -68,7 +68,7 @@
SoundManager::SoundManager()
: effectsPoolSize_(0)
{
- RegisterRootObject(SoundManager);
+ RegisterObject(SoundManager);
orxout(user_status) << "Loading sound" << endl;
Modified: code/trunk/src/orxonox/sound/SoundManager.h
===================================================================
--- code/trunk/src/orxonox/sound/SoundManager.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/sound/SoundManager.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,8 +38,8 @@
#include <boost/shared_ptr.hpp>
#include "util/Singleton.h"
-#include "core/OrxonoxClass.h"
-#include "core/SmartPtr.h"
+#include "core/config/Configurable.h"
+#include "core/object/SmartPtr.h"
// tolua_begin
namespace orxonox
@@ -58,7 +58,7 @@
//! The SoundManager class manages the OpenAL device, context and listener position.
class _OrxonoxExport SoundManager
// tolua_end
- : public Singleton<SoundManager>, public OrxonoxClass
+ : public Singleton<SoundManager>, public Configurable
{ // tolua_export
friend class Singleton<SoundManager>;
Modified: code/trunk/src/orxonox/sound/WorldAmbientSound.cc
===================================================================
--- code/trunk/src/orxonox/sound/WorldAmbientSound.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/sound/WorldAmbientSound.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,9 +35,9 @@
namespace orxonox
{
- CreateFactory(WorldAmbientSound);
+ RegisterClass(WorldAmbientSound);
- WorldAmbientSound::WorldAmbientSound(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
+ WorldAmbientSound::WorldAmbientSound(Context* context) : BaseObject(context), Synchronisable(context)
{
RegisterObject(WorldAmbientSound);
Modified: code/trunk/src/orxonox/sound/WorldAmbientSound.h
===================================================================
--- code/trunk/src/orxonox/sound/WorldAmbientSound.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/sound/WorldAmbientSound.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,7 +43,7 @@
class _OrxonoxExport WorldAmbientSound : public BaseObject, public Synchronisable
{
public:
- WorldAmbientSound(BaseObject* creator);
+ WorldAmbientSound(Context* context);
virtual ~WorldAmbientSound();
void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/sound/WorldSound.cc
===================================================================
--- code/trunk/src/orxonox/sound/WorldSound.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/sound/WorldSound.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,10 +40,10 @@
namespace orxonox
{
- CreateFactory(WorldSound);
+ RegisterClass(WorldSound);
- WorldSound::WorldSound(BaseObject* creator)
- : StaticEntity(creator)
+ WorldSound::WorldSound(Context* context)
+ : StaticEntity(context)
{
RegisterObject(WorldSound);
// WorldSound buffers should be pooled when they're not used anymore
Modified: code/trunk/src/orxonox/sound/WorldSound.h
===================================================================
--- code/trunk/src/orxonox/sound/WorldSound.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/sound/WorldSound.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,7 +44,7 @@
class _OrxonoxExport WorldSound : public StaticEntity, public BaseSound, public Tickable
{
public:
- WorldSound(BaseObject* creator);
+ WorldSound(Context* context);
void XMLPort(Element& xmlelement, XMLPort::Mode mode);
void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/weaponsystem/DefaultWeaponmodeLink.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/DefaultWeaponmodeLink.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/weaponsystem/DefaultWeaponmodeLink.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,9 +34,9 @@
namespace orxonox
{
- CreateFactory(DefaultWeaponmodeLink);
+ RegisterClass(DefaultWeaponmodeLink);
- DefaultWeaponmodeLink::DefaultWeaponmodeLink(BaseObject* creator) : BaseObject(creator)
+ DefaultWeaponmodeLink::DefaultWeaponmodeLink(Context* context) : BaseObject(context)
{
RegisterObject(DefaultWeaponmodeLink);
Modified: code/trunk/src/orxonox/weaponsystem/DefaultWeaponmodeLink.h
===================================================================
--- code/trunk/src/orxonox/weaponsystem/DefaultWeaponmodeLink.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/weaponsystem/DefaultWeaponmodeLink.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,7 +38,7 @@
class _OrxonoxExport DefaultWeaponmodeLink : public BaseObject
{
public:
- DefaultWeaponmodeLink(BaseObject* creator);
+ DefaultWeaponmodeLink(Context* context);
virtual ~DefaultWeaponmodeLink();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/weaponsystem/Munition.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/Munition.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/weaponsystem/Munition.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,9 +34,9 @@
namespace orxonox
{
- CreateFactory(Munition);
+ RegisterClass(Munition);
- Munition::Munition(BaseObject* creator) : BaseObject(creator)
+ Munition::Munition(Context* context) : BaseObject(context)
{
RegisterObject(Munition);
Modified: code/trunk/src/orxonox/weaponsystem/Munition.h
===================================================================
--- code/trunk/src/orxonox/weaponsystem/Munition.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/weaponsystem/Munition.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -55,7 +55,7 @@
};
public:
- Munition(BaseObject* creator);
+ Munition(Context* context);
virtual ~Munition();
unsigned int getNumMunition(WeaponMode* user) const;
Modified: code/trunk/src/orxonox/weaponsystem/Weapon.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/Weapon.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/weaponsystem/Weapon.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,9 +38,9 @@
namespace orxonox
{
- CreateFactory(Weapon);
+ RegisterClass(Weapon);
- Weapon::Weapon(BaseObject* creator) : StaticEntity(creator)
+ Weapon::Weapon(Context* context) : StaticEntity(context)
{
RegisterObject(Weapon);
Modified: code/trunk/src/orxonox/weaponsystem/Weapon.h
===================================================================
--- code/trunk/src/orxonox/weaponsystem/Weapon.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/weaponsystem/Weapon.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -41,7 +41,7 @@
class _OrxonoxExport Weapon : public StaticEntity
{
public:
- Weapon(BaseObject* creator);
+ Weapon(Context* context);
virtual ~Weapon();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/weaponsystem/WeaponMode.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponMode.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/weaponsystem/WeaponMode.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,7 +44,9 @@
namespace orxonox
{
- WeaponMode::WeaponMode(BaseObject* creator) : BaseObject(creator)
+ RegisterAbstractClass(WeaponMode).inheritsFrom(Class(BaseObject));
+
+ WeaponMode::WeaponMode(Context* context) : BaseObject(context)
{
RegisterObject(WeaponMode);
@@ -74,7 +76,7 @@
if( GameMode::isMaster() )
{
- this->defSndWpnFire_ = new WorldSound(this);
+ this->defSndWpnFire_ = new WorldSound(this->getContext());
this->defSndWpnFire_->setLooping(false);
this->bSoundAttached_ = false;
}
Modified: code/trunk/src/orxonox/weaponsystem/WeaponMode.h
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponMode.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/weaponsystem/WeaponMode.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -35,7 +35,7 @@
#include <string>
#include "util/Math.h"
#include "core/BaseObject.h"
-#include "core/SubclassIdentifier.h"
+#include "core/class/SubclassIdentifier.h"
#include "tools/Timer.h"
namespace orxonox
@@ -43,7 +43,7 @@
class _OrxonoxExport WeaponMode : public BaseObject
{
public:
- WeaponMode(BaseObject* creator);
+ WeaponMode(Context* context);
virtual ~WeaponMode();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/weaponsystem/WeaponPack.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponPack.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/weaponsystem/WeaponPack.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,9 +37,9 @@
namespace orxonox
{
- CreateFactory(WeaponPack);
+ RegisterClass(WeaponPack);
- WeaponPack::WeaponPack(BaseObject* creator) : BaseObject(creator)
+ WeaponPack::WeaponPack(Context* context) : BaseObject(context)
{
RegisterObject(WeaponPack);
Modified: code/trunk/src/orxonox/weaponsystem/WeaponPack.h
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponPack.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/weaponsystem/WeaponPack.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OrxonoxExport WeaponPack : public BaseObject
{
public:
- WeaponPack(BaseObject* creator);
+ WeaponPack(Context* context);
virtual ~WeaponPack();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/weaponsystem/WeaponSet.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponSet.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/weaponsystem/WeaponSet.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,9 +36,9 @@
namespace orxonox
{
- CreateFactory(WeaponSet);
+ RegisterClass(WeaponSet);
- WeaponSet::WeaponSet(BaseObject* creator) : BaseObject(creator)
+ WeaponSet::WeaponSet(Context* context) : BaseObject(context)
{
RegisterObject(WeaponSet);
Modified: code/trunk/src/orxonox/weaponsystem/WeaponSet.h
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponSet.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/weaponsystem/WeaponSet.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OrxonoxExport WeaponSet : public BaseObject
{
public:
- WeaponSet(BaseObject* creator);
+ WeaponSet(Context* context);
virtual ~WeaponSet();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/weaponsystem/WeaponSlot.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponSlot.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/weaponsystem/WeaponSlot.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,9 +36,9 @@
namespace orxonox
{
- CreateFactory(WeaponSlot);
+ RegisterClass(WeaponSlot);
- WeaponSlot::WeaponSlot(BaseObject* creator) : StaticEntity(creator)
+ WeaponSlot::WeaponSlot(Context* context) : StaticEntity(context)
{
RegisterObject(WeaponSlot);
Modified: code/trunk/src/orxonox/weaponsystem/WeaponSlot.h
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponSlot.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/weaponsystem/WeaponSlot.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -56,7 +56,7 @@
class _OrxonoxExport WeaponSlot : public StaticEntity
{
public:
- WeaponSlot(BaseObject* creator);
+ WeaponSlot(Context* context);
virtual ~WeaponSlot();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/weaponsystem/WeaponSystem.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponSystem.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/weaponsystem/WeaponSystem.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -29,7 +29,7 @@
#include "WeaponSystem.h"
#include "core/CoreIncludes.h"
-#include "core/SubclassIdentifier.h"
+#include "core/class/SubclassIdentifier.h"
#include "worldentities/pawns/Pawn.h"
#include "WeaponSlot.h"
@@ -45,9 +45,9 @@
namespace orxonox
{
- CreateFactory(WeaponSystem);
+ RegisterClass(WeaponSystem);
- WeaponSystem::WeaponSystem(BaseObject* creator) : BaseObject(creator)
+ WeaponSystem::WeaponSystem(Context* context) : BaseObject(context)
{
RegisterObject(WeaponSystem);
@@ -307,7 +307,7 @@
}
else if (identifier->getIdentifier()->isA(Class(Munition)))
{
- Munition* munition = identifier->fabricate(this);
+ Munition* munition = identifier->fabricate(this->getContext());
this->munitions_[identifier->getIdentifier()] = munition;
return munition;
}
Modified: code/trunk/src/orxonox/weaponsystem/WeaponSystem.h
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponSystem.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/weaponsystem/WeaponSystem.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,7 +42,7 @@
class _OrxonoxExport WeaponSystem : public BaseObject
{
public:
- WeaponSystem(BaseObject* creator);
+ WeaponSystem(Context* context);
virtual ~WeaponSystem();
// adding and removing WeaponSlots
Modified: code/trunk/src/orxonox/worldentities/BigExplosion.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/BigExplosion.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/BigExplosion.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,9 +40,9 @@
namespace orxonox
{
- CreateFactory(BigExplosion);
+ RegisterClass(BigExplosion);
- BigExplosion::BigExplosion(BaseObject* creator) : StaticEntity(creator)
+ BigExplosion::BigExplosion(Context* context) : StaticEntity(context)
{
RegisterObject(BigExplosion);
@@ -79,27 +79,27 @@
void BigExplosion::init()
{
- this->debrisEntity1_ = new MovableEntity(this);
- this->debrisEntity2_ = new MovableEntity(this);
- this->debrisEntity3_ = new MovableEntity(this);
- this->debrisEntity4_ = new MovableEntity(this);
+ this->debrisEntity1_ = new MovableEntity(this->getContext());
+ this->debrisEntity2_ = new MovableEntity(this->getContext());
+ this->debrisEntity3_ = new MovableEntity(this->getContext());
+ this->debrisEntity4_ = new MovableEntity(this->getContext());
this->debrisEntity1_->setSyncMode(0);
this->debrisEntity2_->setSyncMode(0);
this->debrisEntity3_->setSyncMode(0);
this->debrisEntity4_->setSyncMode(0);
- this->debris1_ = new Model(this);
- this->debris2_ = new Model(this);
- this->debris3_ = new Model(this);
- this->debris4_ = new Model(this);
+ this->debris1_ = new Model(this->getContext());
+ this->debris2_ = new Model(this->getContext());
+ this->debris3_ = new Model(this->getContext());
+ this->debris4_ = new Model(this->getContext());
this->debris1_->setSyncMode(0);
this->debris2_->setSyncMode(0);
this->debris3_->setSyncMode(0);
this->debris4_->setSyncMode(0);
- this->explosion_ = new StaticEntity(this);
+ this->explosion_ = new StaticEntity(this->getContext());
this->explosion_->setSyncMode(0);
this->debrisSmoke1_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);
@@ -147,13 +147,13 @@
this->debrisEntity3_->attach(debris3_);
this->debrisEntity4_->attach(debris4_);
- ParticleSpawner* effect = new ParticleSpawner(this->getCreator());
+ ParticleSpawner* effect = new ParticleSpawner(this->getContext());
effect->setDestroyAfterLife(true);
effect->setSource("Orxonox/explosion2b");
effect->setLifetime(4.0f);
effect->setSyncMode(0);
- ParticleSpawner* effect2 = new ParticleSpawner(this->getCreator());
+ ParticleSpawner* effect2 = new ParticleSpawner(this->getContext());
effect2->setDestroyAfterLife(true);
effect2->setSource("Orxonox/smoke6");
effect2->setLifetime(4.0f);
@@ -171,11 +171,11 @@
for(int i=0;i<10;i++)
{
- Model* part1 = new Model(this);
- Model* part2 = new Model(this);
+ Model* part1 = new Model(this->getContext());
+ Model* part2 = new Model(this->getContext());
- MovableEntity* partEntity1 = new MovableEntity(this);
- MovableEntity* partEntity2 = new MovableEntity(this);
+ MovableEntity* partEntity1 = new MovableEntity(this->getContext());
+ MovableEntity* partEntity2 = new MovableEntity(this->getContext());
part1->setSyncMode(0);
part2->setSyncMode(0);
@@ -224,45 +224,45 @@
if (this->debrisFire1_)
{
this->debris1_->detachOgreObject(this->debrisFire1_->getParticleSystem());
- this->debrisFire1_->destroy();
+ delete this->debrisFire1_;
}
if (this->debrisSmoke1_)
{
this->debris1_->detachOgreObject(this->debrisSmoke1_->getParticleSystem());
- this->debrisSmoke1_->destroy();
+ delete this->debrisSmoke1_;
}
if (this->debrisFire2_)
{
this->debris2_->detachOgreObject(this->debrisFire2_->getParticleSystem());
- this->debrisFire2_->destroy();
+ delete this->debrisFire2_;
}
if (this->debrisSmoke2_)
{
this->debris2_->detachOgreObject(this->debrisSmoke2_->getParticleSystem());
- this->debrisSmoke2_->destroy();
+ delete this->debrisSmoke2_;
}
if (this->debrisFire3_)
{
this->debris3_->detachOgreObject(this->debrisFire3_->getParticleSystem());
- this->debrisFire3_->destroy();
+ delete this->debrisFire3_;
}
if (this->debrisSmoke3_)
{
this->debris3_->detachOgreObject(this->debrisSmoke3_->getParticleSystem());
- this->debrisSmoke3_->destroy();
+ delete this->debrisSmoke3_;
}
if (this->debrisFire4_)
{
this->debris4_->detachOgreObject(this->debrisFire4_->getParticleSystem());
- this->debrisFire4_->destroy();
+ delete this->debrisFire4_;
}
if (this->debrisSmoke4_)
{
this->debris4_->detachOgreObject(this->debrisSmoke4_->getParticleSystem());
- this->debrisSmoke4_->destroy();
+ delete this->debrisSmoke4_;
}
}
}
Modified: code/trunk/src/orxonox/worldentities/BigExplosion.h
===================================================================
--- code/trunk/src/orxonox/worldentities/BigExplosion.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/BigExplosion.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OrxonoxExport BigExplosion : public StaticEntity
{
public:
- BigExplosion(BaseObject* creator);
+ BigExplosion(Context* context);
virtual ~BigExplosion();
inline void setLOD(LODParticle::Value level)
Modified: code/trunk/src/orxonox/worldentities/CameraPosition.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/CameraPosition.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/CameraPosition.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -34,9 +34,9 @@
namespace orxonox
{
- CreateFactory(CameraPosition);
+ RegisterClass(CameraPosition);
- CameraPosition::CameraPosition(BaseObject* creator) : StaticEntity(creator)
+ CameraPosition::CameraPosition(Context* context) : StaticEntity(context)
{
RegisterObject(CameraPosition);
Modified: code/trunk/src/orxonox/worldentities/CameraPosition.h
===================================================================
--- code/trunk/src/orxonox/worldentities/CameraPosition.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/CameraPosition.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,7 +37,7 @@
class _OrxonoxExport CameraPosition : public StaticEntity
{
public:
- CameraPosition(BaseObject* creator);
+ CameraPosition(Context* context);
virtual ~CameraPosition();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/worldentities/ControllableEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/ControllableEntity.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/ControllableEntity.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,7 +32,7 @@
#include <OgreSceneNode.h>
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/GameMode.h"
#include "core/XMLPort.h"
#include "network/NetworkFunction.h"
@@ -46,12 +46,12 @@
namespace orxonox
{
- CreateFactory(ControllableEntity);
+ RegisterClass(ControllableEntity);
registerMemberNetworkFunction( ControllableEntity, fire );
registerMemberNetworkFunction( ControllableEntity, setTargetInternal );
- ControllableEntity::ControllableEntity(BaseObject* creator) : MobileEntity(creator)
+ ControllableEntity::ControllableEntity(Context* context) : MobileEntity(context)
{
RegisterObject(ControllableEntity);
@@ -396,7 +396,7 @@
{
if (!this->camera_ && GameMode::showsGraphics())
{
- this->camera_ = new Camera(this);
+ this->camera_ = new Camera(this->getContext());
this->camera_->requestFocus();
if (!this->cameraPositionTemplate_.empty())
this->addTemplate(this->cameraPositionTemplate_);
@@ -422,7 +422,7 @@
{
if (!this->hudtemplate_.empty())
{
- this->hud_ = new OverlayGroup(this);
+ this->hud_ = new OverlayGroup(this->getContext());
this->hud_->addTemplate(this->hudtemplate_);
this->hud_->setOwner(this);
}
Modified: code/trunk/src/orxonox/worldentities/ControllableEntity.h
===================================================================
--- code/trunk/src/orxonox/worldentities/ControllableEntity.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/ControllableEntity.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -43,7 +43,7 @@
friend class PlayerInfo; // PlayerInfo uses setPlayer and removePlayer
public:
- ControllableEntity(BaseObject* creator);
+ ControllableEntity(Context* context);
virtual ~ControllableEntity();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/worldentities/Drone.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/Drone.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/Drone.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,12 +33,12 @@
namespace orxonox
{
- CreateFactory(Drone);
+ RegisterClass(Drone);
/**
@brief
Constructor. Registers the object and initializes some default values.
*/
- Drone::Drone(BaseObject* creator) : Pawn(creator)
+ Drone::Drone(Context* context) : Pawn(context)
{
RegisterObject(Drone);
@@ -49,7 +49,7 @@
this->setRadarVisibility(false);
this->setCollisionType(WorldEntity::Dynamic);
- myController_ = new DroneController(static_cast<BaseObject*>(this)); //!< Creates a new controller and passes our this pointer to it as creator.
+ myController_ = new DroneController(this->getContext()); //!< Creates a new controller and passes our this pointer to it as creator.
myController_->setDrone(this);
this->setController(myController_);
Modified: code/trunk/src/orxonox/worldentities/Drone.h
===================================================================
--- code/trunk/src/orxonox/worldentities/Drone.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/Drone.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -46,7 +46,7 @@
class _OrxonoxExport Drone : public Pawn
{
public:
- Drone(BaseObject* creator);
+ Drone(Context* context);
virtual ~Drone();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Drone through XML.
Modified: code/trunk/src/orxonox/worldentities/EffectContainer.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/EffectContainer.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/EffectContainer.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,10 +39,10 @@
namespace orxonox
{
- CreateFactory(EffectContainer);
+ RegisterClass(EffectContainer);
- EffectContainer::EffectContainer(BaseObject* creator)
- : BaseObject(creator)
+ EffectContainer::EffectContainer(Context* context)
+ : BaseObject(context)
, lua_(NULL)
{
RegisterObject(EffectContainer);
Modified: code/trunk/src/orxonox/worldentities/EffectContainer.h
===================================================================
--- code/trunk/src/orxonox/worldentities/EffectContainer.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/EffectContainer.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OrxonoxExport EffectContainer : public BaseObject
{
public:
- EffectContainer(BaseObject* creator);
+ EffectContainer(Context* context);
virtual ~EffectContainer();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/worldentities/ExplosionChunk.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/ExplosionChunk.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/ExplosionChunk.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,9 +37,9 @@
namespace orxonox
{
- CreateFactory(ExplosionChunk);
+ RegisterClass(ExplosionChunk);
- ExplosionChunk::ExplosionChunk(BaseObject* creator) : MovableEntity(creator)
+ ExplosionChunk::ExplosionChunk(Context* context) : MovableEntity(context)
{
RegisterObject(ExplosionChunk);
@@ -91,12 +91,12 @@
if (this->fire_)
{
this->detachOgreObject(this->fire_->getParticleSystem());
- this->fire_->destroy();
+ delete this->fire_;
}
if (this->smoke_)
{
this->detachOgreObject(this->smoke_->getParticleSystem());
- this->smoke_->destroy();
+ delete this->smoke_;
}
}
}
Modified: code/trunk/src/orxonox/worldentities/ExplosionChunk.h
===================================================================
--- code/trunk/src/orxonox/worldentities/ExplosionChunk.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/ExplosionChunk.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OrxonoxExport ExplosionChunk : public MovableEntity
{
public:
- ExplosionChunk(BaseObject* creator);
+ ExplosionChunk(Context* context);
virtual ~ExplosionChunk();
virtual void tick(float dt);
Modified: code/trunk/src/orxonox/worldentities/MobileEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/MobileEntity.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/MobileEntity.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,7 +38,9 @@
namespace orxonox
{
- MobileEntity::MobileEntity(BaseObject* creator) : WorldEntity(creator)
+ RegisterClass(MobileEntity);
+
+ MobileEntity::MobileEntity(Context* context) : WorldEntity(context)
{
RegisterObject(MobileEntity);
Modified: code/trunk/src/orxonox/worldentities/MobileEntity.h
===================================================================
--- code/trunk/src/orxonox/worldentities/MobileEntity.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/MobileEntity.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,7 +40,7 @@
class _OrxonoxExport MobileEntity : public WorldEntity, public Tickable
{
public:
- MobileEntity(BaseObject* creator);
+ MobileEntity(Context* context);
virtual ~MobileEntity();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/worldentities/MovableEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/MovableEntity.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/MovableEntity.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -40,9 +40,9 @@
static const float MAX_RESYNCHRONIZE_TIME = 3.0f;
static const float CONTINUOUS_SYNCHRONIZATION_TIME = 10.0f;
- CreateFactory(MovableEntity);
+ RegisterClass(MovableEntity);
- MovableEntity::MovableEntity(BaseObject* creator) : MobileEntity(creator)
+ MovableEntity::MovableEntity(Context* context) : MobileEntity(context)
{
RegisterObject(MovableEntity);
Modified: code/trunk/src/orxonox/worldentities/MovableEntity.h
===================================================================
--- code/trunk/src/orxonox/worldentities/MovableEntity.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/MovableEntity.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,7 +42,7 @@
class _OrxonoxExport MovableEntity : public MobileEntity, public ClientConnectionListener
{
public:
- MovableEntity(BaseObject* creator);
+ MovableEntity(Context* context);
virtual ~MovableEntity();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/worldentities/SpawnPoint.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/SpawnPoint.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/SpawnPoint.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,9 +36,9 @@
namespace orxonox
{
- CreateFactory(SpawnPoint);
+ RegisterClass(SpawnPoint);
- SpawnPoint::SpawnPoint(BaseObject* creator) : StaticEntity(creator)
+ SpawnPoint::SpawnPoint(Context* context) : StaticEntity(context)
{
RegisterObject(SpawnPoint);
@@ -80,7 +80,7 @@
Pawn* SpawnPoint::spawn()
{
- Pawn* entity = this->spawnclass_.fabricate(this);
+ Pawn* entity = this->spawnclass_.fabricate(this->getContext());
if (entity)
{
this->getGametype()->pawnPreSpawn(entity);
Modified: code/trunk/src/orxonox/worldentities/SpawnPoint.h
===================================================================
--- code/trunk/src/orxonox/worldentities/SpawnPoint.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/SpawnPoint.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -32,7 +32,7 @@
#include "OrxonoxPrereqs.h"
#include <string>
-#include "core/SubclassIdentifier.h"
+#include "core/class/SubclassIdentifier.h"
#include "worldentities/StaticEntity.h"
namespace orxonox
@@ -40,7 +40,7 @@
class _OrxonoxExport SpawnPoint : public StaticEntity
{
public:
- SpawnPoint(BaseObject* creator);
+ SpawnPoint(Context* context);
virtual ~SpawnPoint() {}
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/worldentities/StaticEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/StaticEntity.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/StaticEntity.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,9 +36,9 @@
namespace orxonox
{
- CreateFactory(StaticEntity);
+ RegisterClass(StaticEntity);
- StaticEntity::StaticEntity(BaseObject* creator) : WorldEntity(creator)
+ StaticEntity::StaticEntity(Context* context) : WorldEntity(context)
{
RegisterObject(StaticEntity);
Modified: code/trunk/src/orxonox/worldentities/StaticEntity.h
===================================================================
--- code/trunk/src/orxonox/worldentities/StaticEntity.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/StaticEntity.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,7 +38,7 @@
class _OrxonoxExport StaticEntity : public WorldEntity
{
public:
- StaticEntity(BaseObject* creator);
+ StaticEntity(Context* context);
virtual ~StaticEntity();
using WorldEntity::setPosition;
Modified: code/trunk/src/orxonox/worldentities/TeamSpawnPoint.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/TeamSpawnPoint.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/TeamSpawnPoint.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,9 +33,9 @@
namespace orxonox
{
- CreateFactory(TeamSpawnPoint);
+ RegisterClass(TeamSpawnPoint);
- TeamSpawnPoint::TeamSpawnPoint(BaseObject* creator) : SpawnPoint(creator)
+ TeamSpawnPoint::TeamSpawnPoint(Context* context) : SpawnPoint(context)
{
RegisterObject(TeamSpawnPoint);
Modified: code/trunk/src/orxonox/worldentities/TeamSpawnPoint.h
===================================================================
--- code/trunk/src/orxonox/worldentities/TeamSpawnPoint.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/TeamSpawnPoint.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OrxonoxExport TeamSpawnPoint : public SpawnPoint
{
public:
- TeamSpawnPoint(BaseObject* creator);
+ TeamSpawnPoint(Context* context);
virtual ~TeamSpawnPoint() {}
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/worldentities/WorldEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/WorldEntity.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/WorldEntity.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -60,12 +60,14 @@
BOOST_STATIC_ASSERT((int)Ogre::Node::TS_PARENT == (int)WorldEntity::Parent);
BOOST_STATIC_ASSERT((int)Ogre::Node::TS_WORLD == (int)WorldEntity::World);
+ RegisterAbstractClass(WorldEntity).inheritsFrom(Class(BaseObject)).inheritsFrom(Class(Synchronisable));
+
/**
@brief
Creates a new WorldEntity that may immediately be used.
All the default values are being set here.
*/
- WorldEntity::WorldEntity(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
+ WorldEntity::WorldEntity(Context* context) : BaseObject(context), Synchronisable(context)
{
RegisterObject(WorldEntity);
@@ -91,7 +93,8 @@
this->bPhysicsActive_ = false;
this->bPhysicsActiveSynchronised_ = false;
this->bPhysicsActiveBeforeAttaching_ = false;
- this->collisionShape_ = new WorldEntityCollisionShape(this);
+ this->collisionShape_ = new WorldEntityCollisionShape(this->getContext());
+ this->collisionShape_->setWorldEntityOwner(this);
this->collisionType_ = None;
this->collisionTypeSynchronised_ = None;
this->mass_ = 1.0f;
Modified: code/trunk/src/orxonox/worldentities/WorldEntity.h
===================================================================
--- code/trunk/src/orxonox/worldentities/WorldEntity.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/WorldEntity.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -89,7 +89,7 @@
};
public:
- WorldEntity(BaseObject* creator);
+ WorldEntity(Context* context);
virtual ~WorldEntity();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/worldentities/pawns/Destroyer.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Destroyer.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/pawns/Destroyer.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -33,9 +33,9 @@
namespace orxonox
{
- CreateFactory(Destroyer);
+ RegisterClass(Destroyer);
- Destroyer::Destroyer(BaseObject* creator) : SpaceShip(creator)
+ Destroyer::Destroyer(Context* context) : SpaceShip(context)
{
RegisterObject(Destroyer);
Modified: code/trunk/src/orxonox/worldentities/pawns/Destroyer.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Destroyer.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/pawns/Destroyer.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -38,7 +38,7 @@
class _OrxonoxExport Destroyer : public SpaceShip
{
public:
- Destroyer(BaseObject* creator);
+ Destroyer(Context* context);
virtual ~Destroyer() {};
};
Modified: code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -37,7 +37,7 @@
#include <OgreEntity.h>
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/Template.h"
#include "core/XMLPort.h"
#include "items/Engine.h"
@@ -52,9 +52,9 @@
{
const float orientationGain_ = 100;
const float jumpValue_ = 300;
- CreateFactory(FpsPlayer);
+ RegisterClass(FpsPlayer);
- FpsPlayer::FpsPlayer(BaseObject* creator) : Pawn(creator)
+ FpsPlayer::FpsPlayer(Context* context) : Pawn(context)
{
RegisterObject(FpsPlayer);
this->speed_ = 200;
Modified: code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/pawns/FpsPlayer.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -42,7 +42,7 @@
class _OrxonoxExport FpsPlayer : public Pawn
{
public:
- FpsPlayer(BaseObject* creator);
+ FpsPlayer(Context* context);
virtual ~FpsPlayer();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -50,11 +50,11 @@
namespace orxonox
{
- CreateFactory(Pawn);
+ RegisterClass(Pawn);
- Pawn::Pawn(BaseObject* creator)
- : ControllableEntity(creator)
- , RadarViewable(creator, static_cast<WorldEntity*>(this))
+ Pawn::Pawn(Context* context)
+ : ControllableEntity(context)
+ , RadarViewable(this, static_cast<WorldEntity*>(this))
{
RegisterObject(Pawn);
@@ -85,7 +85,7 @@
if (GameMode::isMaster())
{
- this->weaponSystem_ = new WeaponSystem(this);
+ this->weaponSystem_ = new WeaponSystem(this->getContext());
this->weaponSystem_->setPawn(this);
}
else
@@ -298,7 +298,7 @@
// play spawn effect
if (!this->spawnparticlesource_.empty())
{
- ParticleSpawner* effect = new ParticleSpawner(this->getCreator());
+ ParticleSpawner* effect = new ParticleSpawner(this->getContext());
effect->setPosition(this->getPosition());
effect->setOrientation(this->getOrientation());
effect->setDestroyAfterLife(true);
@@ -364,7 +364,7 @@
this->bAlive_ = false;
this->setDestroyWhenPlayerLeft(false);
- BigExplosion* chunk = new BigExplosion(this->getCreator());
+ BigExplosion* chunk = new BigExplosion(this->getContext());
chunk->setPosition(this->getPosition());
}
@@ -372,7 +372,7 @@
{
// play death effect
{
- ParticleSpawner* effect = new ParticleSpawner(this->getCreator());
+ ParticleSpawner* effect = new ParticleSpawner(this->getContext());
effect->setPosition(this->getPosition());
effect->setOrientation(this->getOrientation());
effect->setDestroyAfterLife(true);
@@ -380,7 +380,7 @@
effect->setLifetime(4.0f);
}
{
- ParticleSpawner* effect = new ParticleSpawner(this->getCreator());
+ ParticleSpawner* effect = new ParticleSpawner(this->getContext());
effect->setPosition(this->getPosition());
effect->setOrientation(this->getOrientation());
effect->setDestroyAfterLife(true);
@@ -388,7 +388,7 @@
effect->setLifetime(4.0f);
}
{
- ParticleSpawner* effect = new ParticleSpawner(this->getCreator());
+ ParticleSpawner* effect = new ParticleSpawner(this->getContext());
effect->setPosition(this->getPosition());
effect->setOrientation(this->getOrientation());
effect->setDestroyAfterLife(true);
@@ -397,7 +397,7 @@
}
for (unsigned int i = 0; i < this->numexplosionchunks_; ++i)
{
- ExplosionChunk* chunk = new ExplosionChunk(this->getCreator());
+ ExplosionChunk* chunk = new ExplosionChunk(this->getContext());
chunk->setPosition(this->getPosition());
}
}
Modified: code/trunk/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -44,7 +44,7 @@
friend class WeaponSystem;
public:
- Pawn(BaseObject* creator);
+ Pawn(Context* context);
virtual ~Pawn();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -31,7 +31,7 @@
#include <BulletDynamics/Dynamics/btRigidBody.h>
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/Template.h"
#include "core/XMLPort.h"
#include "tools/Shader.h"
@@ -45,9 +45,9 @@
namespace orxonox
{
- CreateFactory(SpaceShip);
+ RegisterClass(SpaceShip);
- SpaceShip::SpaceShip(BaseObject* creator) : Pawn(creator), boostBlur_(NULL)
+ SpaceShip::SpaceShip(Context* context) : Pawn(context), boostBlur_(NULL)
{
RegisterObject(SpaceShip);
@@ -95,7 +95,7 @@
this->removeAllEngines();
if (this->boostBlur_)
- this->boostBlur_->destroy();
+ delete this->boostBlur_;
}
}
@@ -446,7 +446,7 @@
{
if (!this->bEnableMotionBlur_ && this->boostBlur_ != NULL)
{
- this->boostBlur_->destroy();
+ delete this->boostBlur_;
this->boostBlur_ = NULL;
}
}
Modified: code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -87,7 +87,7 @@
class _OrxonoxExport SpaceShip : public Pawn
{
public:
- SpaceShip(BaseObject* creator);
+ SpaceShip(Context* context);
virtual ~SpaceShip();
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
Modified: code/trunk/src/orxonox/worldentities/pawns/Spectator.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Spectator.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/pawns/Spectator.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -30,7 +30,7 @@
#include "util/Convert.h"
#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
+#include "core/config/ConfigValueIncludes.h"
#include "core/GameMode.h"
#include "core/command/CommandExecutor.h"
#include "core/command/ConsoleCommand.h"
@@ -44,9 +44,9 @@
extern const std::string __CC_fire_name;
extern const std::string __CC_suicide_name;
- CreateFactory(Spectator);
+ RegisterClass(Spectator);
- Spectator::Spectator(BaseObject* creator) : ControllableEntity(creator)
+ Spectator::Spectator(Context* context) : ControllableEntity(context)
{
RegisterObject(Spectator);
Modified: code/trunk/src/orxonox/worldentities/pawns/Spectator.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Spectator.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/pawns/Spectator.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -39,7 +39,7 @@
class _OrxonoxExport Spectator : public ControllableEntity
{
public:
- Spectator(BaseObject* creator);
+ Spectator(Context* context);
virtual ~Spectator();
void setConfigValues();
Modified: code/trunk/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc 2013-08-25 19:08:42 UTC (rev 9667)
@@ -36,9 +36,9 @@
namespace orxonox
{
- CreateFactory(TeamBaseMatchBase);
+ RegisterClass(TeamBaseMatchBase);
- TeamBaseMatchBase::TeamBaseMatchBase(BaseObject* creator) : Pawn(creator)
+ TeamBaseMatchBase::TeamBaseMatchBase(Context* context) : Pawn(context)
{
RegisterObject(TeamBaseMatchBase);
Modified: code/trunk/src/orxonox/worldentities/pawns/TeamBaseMatchBase.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/TeamBaseMatchBase.h 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/src/orxonox/worldentities/pawns/TeamBaseMatchBase.h 2013-08-25 19:08:42 UTC (rev 9667)
@@ -49,7 +49,7 @@
class _OrxonoxExport TeamBaseMatchBase : public Pawn
{
public:
- TeamBaseMatchBase(BaseObject* creator);
+ TeamBaseMatchBase(Context* context);
// if class closes, close everything
virtual ~TeamBaseMatchBase() {}
Modified: code/trunk/test/CMakeLists.txt
===================================================================
--- code/trunk/test/CMakeLists.txt 2013-08-25 08:21:41 UTC (rev 9666)
+++ code/trunk/test/CMakeLists.txt 2013-08-25 19:08:42 UTC (rev 9667)
@@ -52,3 +52,4 @@
################ Sub Directories ################
ADD_SUBDIRECTORY(util)
+ADD_SUBDIRECTORY(core)
More information about the Orxonox-commit
mailing list