Instructions Jenkins Doxygen

[fixed] stability issues 81/781/1
authorVictor Popovici <theanswer@swgemu.com>
Sun, 8 Sep 2013 15:10:23 +0000 (17:10 +0200)
committerVictor Popovici <theanswer@swgemu.com>
Sun, 8 Sep 2013 15:10:23 +0000 (17:10 +0200)
Change-Id: Ia7983cc0aa21b4251e925d4de14f77c506aa2cbd

72 files changed:
MMOCoreORB/src/server/zone/managers/auction/AuctionManagerImplementation.cpp
MMOCoreORB/src/server/zone/managers/city/CityManagerImplementation.cpp
MMOCoreORB/src/server/zone/managers/creature/CreatureManagerImplementation.cpp
MMOCoreORB/src/server/zone/managers/creature/CreatureTemplateManager.h
MMOCoreORB/src/server/zone/managers/loot/LootGroupMap.cpp
MMOCoreORB/src/server/zone/managers/minigames/FishingManagerImplementation.cpp
MMOCoreORB/src/server/zone/managers/planet/PlanetManager.cpp
MMOCoreORB/src/server/zone/managers/planet/PlanetManager.h
MMOCoreORB/src/server/zone/managers/planet/PlanetManager.idl
MMOCoreORB/src/server/zone/managers/planet/PlanetManagerImplementation.cpp
MMOCoreORB/src/server/zone/managers/player/PlayerManagerImplementation.cpp
MMOCoreORB/src/server/zone/managers/resource/ResourceManagerImplementation.cpp
MMOCoreORB/src/server/zone/managers/resource/resourcespawner/ResourceSpawner.cpp
MMOCoreORB/src/server/zone/managers/resource/resourcespawner/SampleTask.h
MMOCoreORB/src/server/zone/managers/structure/StructureManager.cpp
MMOCoreORB/src/server/zone/managers/structure/tasks/StructureConstructionCompleteTask.h
MMOCoreORB/src/server/zone/objects/area/areashapes/tests/CircularAreaShapeTest.cpp
MMOCoreORB/src/server/zone/objects/creature/CreatureObjectImplementation.cpp
MMOCoreORB/src/server/zone/objects/creature/LuaCreatureObject.cpp
MMOCoreORB/src/server/zone/objects/creature/commands/CancelCraftingSessionCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/ChangeBandMusicCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/ChangeDanceCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/ChangeMusicCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/CreateManfSchematicCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/CreatePrototypeCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/DenyServiceCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/ForceChokeCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/GetAccountInfoCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/NextCraftingStageCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/RequestCoreSampleCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/RequestCraftingSessionCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/RequestSurveyCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/SampleCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/SelectDraftSchematicCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/StartBandCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/StopBandCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/SurveyCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/TransferItemArmorCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/TransferItemMiscCommand.h
MMOCoreORB/src/server/zone/objects/creature/commands/TransferItemWeaponCommand.h
MMOCoreORB/src/server/zone/objects/creature/conversation/ConversationObserverImplementation.cpp
MMOCoreORB/src/server/zone/objects/creature/conversation/screenhandlers/TrainerScreenHandlers.cpp
MMOCoreORB/src/server/zone/objects/intangible/VehicleControlDeviceImplementation.cpp
MMOCoreORB/src/server/zone/objects/manufactureschematic/ManufactureSchematicImplementation.cpp
MMOCoreORB/src/server/zone/objects/player/PlayerObjectImplementation.cpp
MMOCoreORB/src/server/zone/objects/player/events/ForceMeditateTask.h
MMOCoreORB/src/server/zone/objects/player/events/MeditateTask.h
MMOCoreORB/src/server/zone/objects/player/sessions/survey/sui/SurveyCMinigameSuiCallback.h
MMOCoreORB/src/server/zone/objects/player/sessions/survey/sui/SurveyGMinigameSuiCallback.h
MMOCoreORB/src/server/zone/objects/player/sui/callbacks/AdBarkingPhraseSuiCallback.h
MMOCoreORB/src/server/zone/objects/player/sui/callbacks/CityRemoveMilitiaMemberSuiCallback.h
MMOCoreORB/src/server/zone/objects/player/sui/callbacks/CitySpecializationConfirmSuiCallback.h
MMOCoreORB/src/server/zone/objects/player/sui/callbacks/CitySpecializationSuiCallback.h
MMOCoreORB/src/server/zone/objects/player/sui/callbacks/CityTreasuryWithdrawalReasonSuiCallback.h
MMOCoreORB/src/server/zone/objects/player/sui/callbacks/CityTreasuryWithdrawalSuiCallback.h
MMOCoreORB/src/server/zone/objects/player/sui/callbacks/DestroyStructureCodeSuiCallback.h
MMOCoreORB/src/server/zone/objects/player/sui/callbacks/DestroyStructureRequestSuiCallback.h
MMOCoreORB/src/server/zone/objects/player/sui/callbacks/StructureSetAccessDurationSuiCallback.h
MMOCoreORB/src/server/zone/objects/player/sui/callbacks/StructureSetAccessFeeSuiCallback.h
MMOCoreORB/src/server/zone/objects/region/CityRegionImplementation.cpp
MMOCoreORB/src/server/zone/objects/scene/SceneObject.cpp
MMOCoreORB/src/server/zone/objects/scene/SceneObject.h
MMOCoreORB/src/server/zone/objects/scene/SceneObject.idl
MMOCoreORB/src/server/zone/objects/tangible/tool/CraftingToolImplementation.cpp
MMOCoreORB/src/server/zone/objects/tangible/tool/SurveyToolImplementation.cpp
MMOCoreORB/src/server/zone/objects/terrain/TargaBitmap.cpp
MMOCoreORB/src/server/zone/packets/object/CraftingAddIngredientCallback.h
MMOCoreORB/src/server/zone/packets/object/CraftingCustomizationCallback.h
MMOCoreORB/src/server/zone/packets/object/CraftingExperimentCallback.h
MMOCoreORB/src/server/zone/packets/object/CraftingRemoveIngredientCallback.h
MMOCoreORB/src/server/zone/packets/object/ItemDropTradeCallback.h
MMOCoreORB/src/server/zone/templates/mobile/ConversationScreen.h

index 82660d7..547aee1 100644 (file)
@@ -206,7 +206,7 @@ void AuctionManagerImplementation::addSaleItem(CreatureObject* player, uint64 ob
                return;
        }
 
-       ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(player->getActiveSession(SessionFacadeType::TRADE));
+       ManagedReference<TradeSession*> tradeContainer = player->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
        if (tradeContainer != NULL) {
                zoneServer->getPlayerManager()->handleAbortTradeMessage(player);
index 6676e1a..14f5d1e 100644 (file)
@@ -534,8 +534,7 @@ void CityManagerImplementation::withdrawFromCityTreasury(CityRegion* city,
 
        ManagedReference<CityTreasuryWithdrawalSession*>
                        session =
-                                       dynamic_cast<CityTreasuryWithdrawalSession*> (mayor->getActiveSession(
-                                                       SessionFacadeType::CITYWITHDRAW));
+                                       mayor->getActiveSession(SessionFacadeType::CITYWITHDRAW).castTo<CityTreasuryWithdrawalSession*>();
 
        if (session == NULL)
                return;
index 58bf021..fc79a79 100644 (file)
@@ -480,7 +480,7 @@ int CreatureManagerImplementation::notifyDestruction(TangibleObject* destructor,
 
        if (shouldRescheduleCorpseDestruction) {
 
-               Reference<DespawnCreatureTask*> despawn = dynamic_cast<DespawnCreatureTask*>(destructedObject->getPendingTask("despawn"));
+               Reference<DespawnCreatureTask*> despawn = destructedObject->getPendingTask("despawn").castTo<DespawnCreatureTask*>();
 
                if (despawn != NULL) {
                        despawn->cancel();
@@ -647,7 +647,7 @@ void CreatureManagerImplementation::harvest(Creature* creature, CreatureObject*
        creature->addAlreadyHarvested(player);
 
        if (!creature->hasLoot() && creature->getBankCredits() < 1 && creature->getCashCredits() < 1 && !playerManager->canGroupMemberHarvestCorpse(player, creature)) {
-               Reference<DespawnCreatureTask*> despawn = dynamic_cast<DespawnCreatureTask*>(creature->getPendingTask("despawn"));
+               Reference<DespawnCreatureTask*> despawn = creature->getPendingTask("despawn").castTo<DespawnCreatureTask*>();
 
                if (despawn != NULL) {
                        despawn->cancel();
index 71d303e..5f00b38 100644 (file)
@@ -27,8 +27,8 @@ namespace creature {
 class CreatureTemplateManager : public Singleton<CreatureTemplateManager>, public Object, public Logger {
 protected:
        VectorMap<uint32, Vector<String> > weaponMap;
-       VectorMap<uint32, DynamicSpawnGroup*> dynamicGroupMap;
-       VectorMap<uint32, StaticSpawnGroup*> staticGroupMap;
+       VectorMap<uint32, Reference<DynamicSpawnGroup*> > dynamicGroupMap;
+       VectorMap<uint32, Reference<StaticSpawnGroup*> > staticGroupMap;
        Reference<Lua*> lua;
        HashTable<uint32, Reference<CreatureTemplate*> > hashTable;
 
index 23614ac..fd58ffe 100644 (file)
@@ -26,6 +26,9 @@ LootGroupMap::~LootGroupMap() {
 }
 
 int LootGroupMap::initialize() {
+       if (lua != NULL)
+               return ERROR_CODE;
+
        lua = new Lua();
        lua->init();
 
index e03a4ab..62b78f1 100644 (file)
@@ -106,7 +106,7 @@ int FishingManagerImplementation::startFishing(CreatureObject* player) {
        createFishingSession(player, createFishingEvent(player, WAITING), markerObject, DONOTHING, 0, 0, WAITING, moodString);
        uint32 boxID = createWindow(player, 0);
 
-       FishingSession* session = dynamic_cast<FishingSession*>(player->getActiveSession(SessionFacadeType::FISHING));
+       Reference<FishingSession*> session = player->getActiveSession(SessionFacadeType::FISHING).castTo<FishingSession*>();
        session->setFishBoxID(boxID);
 
        player->doAnimation("fishing_cast");
@@ -128,7 +128,7 @@ void FishingManagerImplementation::stopFishing(CreatureObject* player, uint32 bo
 
        player->doAnimation("fishing_reel");
 
-       FishingSession* session = dynamic_cast<FishingSession*>(player->getActiveSession(SessionFacadeType::FISHING));
+       Reference<FishingSession*> session = player->getActiveSession(SessionFacadeType::FISHING).castTo<FishingSession*>();
 
        if (fishingEvent != NULL) {
                moodString = session->getMoodString();
@@ -168,7 +168,7 @@ void FishingManagerImplementation::fishingStep(CreatureObject* player) {
        if (player == NULL)
                return;
 
-       ManagedReference<FishingSession*> fishingSession = dynamic_cast<FishingSession*>(player->getActiveSession(SessionFacadeType::FISHING));
+       ManagedReference<FishingSession*> fishingSession = player->getActiveSession(SessionFacadeType::FISHING).castTo<FishingSession*>();
 
        if (fishingSession == NULL)
                return;
@@ -634,7 +634,7 @@ int FishingManagerImplementation::getNextAction(CreatureObject* player) {
        if (player == NULL)
                return DONOTHING;
 
-       ManagedReference<FishingSession*> fishingSession = dynamic_cast<FishingSession*>(player->getActiveSession(SessionFacadeType::FISHING));
+       ManagedReference<FishingSession*> fishingSession = player->getActiveSession(SessionFacadeType::FISHING).castTo<FishingSession*>();
 
        if (fishingSession == NULL)
                return DONOTHING;
@@ -646,7 +646,7 @@ void FishingManagerImplementation::setNextAction(CreatureObject* player, int nex
        if (player == NULL)
                return;
 
-       ManagedReference<FishingSession*> fishingSession = dynamic_cast<FishingSession*>(player->getActiveSession(SessionFacadeType::FISHING));
+       ManagedReference<FishingSession*> fishingSession = player->getActiveSession(SessionFacadeType::FISHING).castTo<FishingSession*>();
 
        if (fishingSession == NULL)
                return;
@@ -703,7 +703,7 @@ uint32 FishingManagerImplementation::getFishBoxID(CreatureObject* player) {
        if (player == NULL)
                return -1;
 
-       ManagedReference<FishingSession*> fishingSession = dynamic_cast<FishingSession*>(player->getActiveSession(SessionFacadeType::FISHING));
+       ManagedReference<FishingSession*> fishingSession = player->getActiveSession(SessionFacadeType::FISHING).castTo<FishingSession*>();
 
        if (fishingSession != NULL) {
                return fishingSession->getFishBoxID();
@@ -716,7 +716,7 @@ void FishingManagerImplementation::setFishBoxID(CreatureObject* player, uint32 b
        if (player == NULL)
                return;
 
-       ManagedReference<FishingSession*> fishingSession = dynamic_cast<FishingSession*>(player->getActiveSession(SessionFacadeType::FISHING));
+       ManagedReference<FishingSession*> fishingSession = player->getActiveSession(SessionFacadeType::FISHING).castTo<FishingSession*>();
 
        if (fishingSession != NULL) {
                fishingSession->setFishBoxID(boxID);
@@ -727,7 +727,7 @@ int FishingManagerImplementation::getFishingState(CreatureObject* player) {
        if (player == NULL)
                return NOTFISHING;
 
-       ManagedReference<FishingSession*> fishingSession = dynamic_cast<FishingSession*>(player->getActiveSession(SessionFacadeType::FISHING));
+       ManagedReference<FishingSession*> fishingSession = player->getActiveSession(SessionFacadeType::FISHING).castTo<FishingSession*>();
 
        if (fishingSession != NULL) {
                int state = fishingSession->getFishingState();
@@ -744,7 +744,7 @@ void FishingManagerImplementation::setFishingState(CreatureObject* player, int s
        if (player == NULL)
                return;
 
-       ManagedReference<FishingSession*> fishingSession = dynamic_cast<FishingSession*>(player->getActiveSession(SessionFacadeType::FISHING));
+       ManagedReference<FishingSession*> fishingSession = player->getActiveSession(SessionFacadeType::FISHING).castTo<FishingSession*>();
 
        if (fishingSession == NULL)
                return;
@@ -758,7 +758,7 @@ SceneObject* FishingManagerImplementation::getFishMarker(CreatureObject* player)
        if (player == NULL)
                return NULL;
 
-       ManagedReference<FishingSession*> fishingSession = dynamic_cast<FishingSession*>(player->getActiveSession(SessionFacadeType::FISHING));
+       ManagedReference<FishingSession*> fishingSession = player->getActiveSession(SessionFacadeType::FISHING).castTo<FishingSession*>();
 
        if (fishingSession != NULL)
                return fishingSession->getMarker();
@@ -769,7 +769,7 @@ SceneObject* FishingManagerImplementation::getFishMarker(CreatureObject* player)
 
 void FishingManagerImplementation::setFishMarker(CreatureObject* player, SceneObject* marker) {
        if (player != NULL) {
-               ManagedReference<FishingSession*> fishingSession = dynamic_cast<FishingSession*>(player->getActiveSession(SessionFacadeType::FISHING));
+               ManagedReference<FishingSession*> fishingSession = player->getActiveSession(SessionFacadeType::FISHING).castTo<FishingSession*>();
                if (fishingSession == NULL)
                        return;
 
@@ -802,7 +802,7 @@ void FishingManagerImplementation::fishingProceed(CreatureObject* player, int ne
                player->sendSystemMessage("@fishing:fish_fight_closer");
        }
 
-       ManagedReference<FishingSession*> fishingSession = dynamic_cast<FishingSession*>(player->getActiveSession(SessionFacadeType::FISHING));
+       ManagedReference<FishingSession*> fishingSession = player->getActiveSession(SessionFacadeType::FISHING).castTo<FishingSession*>();
 
        if (notifyClient) {
 
@@ -907,7 +907,7 @@ void FishingManagerImplementation::mishapEvent(const String& text, CreatureObjec
                        stopFishing(player, boxID, true);
                        loseBait(player);
                } else {
-                       ManagedReference<FishingSession*> fishingSession = dynamic_cast<FishingSession*>(player->getActiveSession(SessionFacadeType::FISHING));
+                       ManagedReference<FishingSession*> fishingSession = player->getActiveSession(SessionFacadeType::FISHING).castTo<FishingSession*>();
 
                        if (fishingSession) {
                                FishingEvent* fishingEvent = createFishingEvent(player, WAITING);
@@ -1240,7 +1240,7 @@ void FishingManagerImplementation::stopFishingEvent(CreatureObject* player) {
                fishingEvent->cancel();
                player->removePendingTask("fishing");
 
-               ManagedReference<FishingSession*> fishingSession = dynamic_cast<FishingSession*>(player->getActiveSession(SessionFacadeType::FISHING));
+               ManagedReference<FishingSession*> fishingSession = player->getActiveSession(SessionFacadeType::FISHING).castTo<FishingSession*>();
 
                if (fishingSession)
                        fishingSession->setEvent(NULL);
@@ -1254,7 +1254,7 @@ FishingEvent* FishingManagerImplementation::getFishingEvent(CreatureObject* play
        if (player == NULL)
                return NULL;
 
-       ManagedReference<FishingSession*> fishingSession = dynamic_cast<FishingSession*>(player->getActiveSession(SessionFacadeType::FISHING));
+       ManagedReference<FishingSession*> fishingSession = player->getActiveSession(SessionFacadeType::FISHING).castTo<FishingSession*>();
 
        if (fishingSession == NULL)
                return NULL;
@@ -1265,7 +1265,7 @@ FishingEvent* FishingManagerImplementation::getFishingEvent(CreatureObject* play
 }
 
 bool FishingManagerImplementation::isPlaying(CreatureObject* player) {
-       return (dynamic_cast<FishingSession*>(player->getActiveSession(SessionFacadeType::FISHING)) != NULL);
+       return ((player->getActiveSession(SessionFacadeType::FISHING).castTo<FishingSession*>()) != NULL);
 }
 
 int FishingManagerImplementation::notifyCloseContainer(CreatureObject* player, SceneObject* container) {
@@ -1282,7 +1282,7 @@ void FishingManagerImplementation::checkFishingOnPositionUpdate(CreatureObject*
        int fishingState = getFishingState(player);
 
        if (fishingState != FishingManager::NOTFISHING) {
-               ManagedReference<FishingSession*> fishingSession = dynamic_cast<FishingSession*>(player->getActiveSession(SessionFacadeType::FISHING));
+               ManagedReference<FishingSession*> fishingSession = player->getActiveSession(SessionFacadeType::FISHING).castTo<FishingSession*>();
 
                if (fishingSession == NULL)
                        return;
index 94bcb3e..90f266e 100644 (file)
@@ -251,7 +251,7 @@ void PlanetManager::sendPlanetTravelPointListResponse(CreatureObject* player) {
                _implementation->sendPlanetTravelPointListResponse(player);
 }
 
-SceneObject* PlanetManager::createTicket(const String& departurePoint, const String& arrivalPlanet, const String& arrivalPoint) {
+Reference<SceneObject* > PlanetManager::createTicket(const String& departurePoint, const String& arrivalPlanet, const String& arrivalPoint) {
        PlanetManagerImplementation* _implementation = static_cast<PlanetManagerImplementation*>(_getImplementation());
        if (_implementation == NULL) {
                if (!deployed)
@@ -1321,7 +1321,7 @@ void PlanetManagerAdapter::sendPlanetTravelPointListResponse(CreatureObject* pla
        (static_cast<PlanetManager*>(stub))->sendPlanetTravelPointListResponse(player);
 }
 
-SceneObject* PlanetManagerAdapter::createTicket(const String& departurePoint, const String& arrivalPlanet, const String& arrivalPoint) {
+Reference<SceneObject* > PlanetManagerAdapter::createTicket(const String& departurePoint, const String& arrivalPlanet, const String& arrivalPoint) {
        return (static_cast<PlanetManager*>(stub))->createTicket(departurePoint, arrivalPlanet, arrivalPoint);
 }
 
index f197971..33935d3 100644 (file)
@@ -234,7 +234,7 @@ public:
 
        void sendPlanetTravelPointListResponse(CreatureObject* player);
 
-       SceneObject* createTicket(const String& departurePoint, const String& arrivalPlanet, const String& arrivalPoint);
+       Reference<SceneObject* > createTicket(const String& departurePoint, const String& arrivalPlanet, const String& arrivalPoint);
 
        bool validateRegionName(const String& name);
 
@@ -365,7 +365,7 @@ public:
        PlanetManagerImplementation(DummyConstructorParameter* param);
 
 private:
-       SceneObject* loadSnapshotObject(WorldSnapshotNode* node, WorldSnapshotIff* wsiff, int& totalObjects);
+       Reference<SceneObject* > loadSnapshotObject(WorldSnapshotNode* node, WorldSnapshotIff* wsiff, int& totalObjects);
 
        void loadSnapshotObjects();
 
@@ -412,7 +412,7 @@ public:
 
        void sendPlanetTravelPointListResponse(CreatureObject* player);
 
-       SceneObject* createTicket(const String& departurePoint, const String& arrivalPlanet, const String& arrivalPoint);
+       Reference<SceneObject* > createTicket(const String& departurePoint, const String& arrivalPlanet, const String& arrivalPoint);
 
        bool validateRegionName(const String& name);
 
@@ -537,7 +537,7 @@ public:
 
        void sendPlanetTravelPointListResponse(CreatureObject* player);
 
-       SceneObject* createTicket(const String& departurePoint, const String& arrivalPlanet, const String& arrivalPoint);
+       Reference<SceneObject* > createTicket(const String& departurePoint, const String& arrivalPlanet, const String& arrivalPoint);
 
        bool validateRegionName(const String& name);
 
index 5521046..01d2c78 100644 (file)
@@ -154,6 +154,7 @@ class PlanetManager extends ManagedService implements Logger {
        }
        
        @local
+       @reference
        private native SceneObject loadSnapshotObject(WorldSnapshotNode node, WorldSnapshotIff wsiff, @dereferenced int totalObjects);
        private native void loadSnapshotObjects();
        private native void loadTravelFares();
@@ -220,6 +221,7 @@ class PlanetManager extends ManagedService implements Logger {
         * @param departurePoint The point on the arrival planet to which the ticket is set to arrive.
         * @return Returns a travel ticket for the route specified, or NULL if it could not be created.
         */
+       @reference
        public native SceneObject createTicket(final string departurePoint, final string arrivalPlanet, final string arrivalPoint);
        
        public native boolean validateRegionName(final string name);
index d9b3beb..6b81b94 100644 (file)
@@ -251,7 +251,7 @@ int PlanetManagerImplementation::getTravelFare(const String& departurePlanet, co
        return fare;
 }
 
-SceneObject* PlanetManagerImplementation::loadSnapshotObject(WorldSnapshotNode* node, WorldSnapshotIff* wsiff, int& totalObjects) {
+Reference<SceneObject*> PlanetManagerImplementation::loadSnapshotObject(WorldSnapshotNode* node, WorldSnapshotIff* wsiff, int& totalObjects) {
        uint64 objectID = node->getObjectID();
        String templateName = wsiff->getObjectTemplateName(node->getNameID());
 
@@ -760,7 +760,7 @@ Reference<SceneObject*> PlanetManagerImplementation::findObjectTooCloseToDecorat
 }
 
 
-SceneObject* PlanetManagerImplementation::createTicket(const String& departurePoint, const String& arrivalPlanet, const String& arrivalPoint) {
+Reference<SceneObject*> PlanetManagerImplementation::createTicket(const String& departurePoint, const String& arrivalPlanet, const String& arrivalPoint) {
        ManagedReference<SceneObject*> obj = server->getZoneServer()->createObject(String("object/tangible/travel/travel_ticket/base/base_travel_ticket.iff").hashCode(), 1);
 
        if (obj == NULL || !obj->isTangibleObject())
index 34028d0..29a58f7 100644 (file)
@@ -1452,7 +1452,7 @@ void PlayerManagerImplementation::resendLoginMessageToAll() {
 void PlayerManagerImplementation::handleAbortTradeMessage(CreatureObject* player) {
        Locker _locker(player);
 
-       ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(player->getActiveSession(SessionFacadeType::TRADE));
+       ManagedReference<TradeSession*> tradeContainer = player->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
        if (tradeContainer == NULL) {
                AbortTradeMessage* msg = new AbortTradeMessage();
@@ -1471,7 +1471,7 @@ void PlayerManagerImplementation::handleAbortTradeMessage(CreatureObject* player
 
                Locker locker(receiver, player);
 
-               ManagedReference<TradeSession*> receiverContainer = dynamic_cast<TradeSession*>(receiver->getActiveSession(SessionFacadeType::TRADE));
+               ManagedReference<TradeSession*> receiverContainer = receiver->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
                if (receiverContainer != NULL && receiverContainer->getTradeTargetPlayer() == player->getObjectID()) {
                        receiver->dropActiveSession(SessionFacadeType::TRADE);
@@ -1491,7 +1491,7 @@ void PlayerManagerImplementation::handleAbortTradeMessage(CreatureObject* player
 void PlayerManagerImplementation::handleAddItemToTradeWindow(CreatureObject* player, uint64 itemID) {
        Locker _locker(player);
 
-       ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(player->getActiveSession(SessionFacadeType::TRADE));
+       ManagedReference<TradeSession*> tradeContainer = player->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
        if (tradeContainer == NULL)
                return;
@@ -1542,7 +1542,7 @@ void PlayerManagerImplementation::handleGiveMoneyMessage(CreatureObject* player,
        if (value > currentMoney)
                value = currentMoney;
 
-       ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(player->getActiveSession(SessionFacadeType::TRADE));
+       ManagedReference<TradeSession*> tradeContainer = player->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
        if (tradeContainer == NULL)
                return;
@@ -1563,7 +1563,7 @@ void PlayerManagerImplementation::handleGiveMoneyMessage(CreatureObject* player,
 void PlayerManagerImplementation::handleAcceptTransactionMessage(CreatureObject* player) {
        Locker _locker(player);
 
-       ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(player->getActiveSession(SessionFacadeType::TRADE));
+       ManagedReference<TradeSession*> tradeContainer = player->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
        if (tradeContainer == NULL)
                return;
@@ -1584,7 +1584,7 @@ void PlayerManagerImplementation::handleAcceptTransactionMessage(CreatureObject*
 void PlayerManagerImplementation::handleUnAcceptTransactionMessage(CreatureObject* player) {
        Locker _locker(player);
 
-       ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(player->getActiveSession(SessionFacadeType::TRADE));
+       ManagedReference<TradeSession*> tradeContainer = player->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
        if (tradeContainer == NULL)
                return;
@@ -1607,8 +1607,8 @@ bool PlayerManagerImplementation::checkTradeItems(CreatureObject* player, Creatu
        PlayerObject* ghost = player->getPlayerObject();
        PlayerObject* targetGhost = receiver->getPlayerObject();
 
-       ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(player->getActiveSession(SessionFacadeType::TRADE));
-       ManagedReference<TradeSession*> receiverContainer = dynamic_cast<TradeSession*>(receiver->getActiveSession(SessionFacadeType::TRADE));
+       ManagedReference<TradeSession*> tradeContainer = player->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
+       ManagedReference<TradeSession*> receiverContainer = receiver->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
        if (tradeContainer == NULL || receiverContainer == NULL)
                return false;
@@ -1751,7 +1751,7 @@ void PlayerManagerImplementation::handleVerifyTradeMessage(CreatureObject* playe
 
        Locker locker(player);
 
-       ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(player->getActiveSession(SessionFacadeType::TRADE));
+       ManagedReference<TradeSession*> tradeContainer = player->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
        if (tradeContainer == NULL) {
                return;
@@ -1767,7 +1767,7 @@ void PlayerManagerImplementation::handleVerifyTradeMessage(CreatureObject* playe
 
                Locker clocker(receiver, player);
 
-               ManagedReference<TradeSession*> receiverTradeContainer = dynamic_cast<TradeSession*>(receiver->getActiveSession(SessionFacadeType::TRADE));
+               ManagedReference<TradeSession*> receiverTradeContainer = receiver->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
                if (receiverTradeContainer == NULL) {
                        tradeContainer->setVerifiedTrade(false);
@@ -1851,7 +1851,7 @@ int PlayerManagerImplementation::notifyObserverEvent(uint32 eventType, Observabl
                        creature->clearState(CreatureState::ALERT, true);
 
                        // Check POSTERCHANGE on Meditate...
-                       Reference<MeditateTask*> meditateTask = cast<MeditateTask*>( creature->getPendingTask("meditate"));
+                       Reference<MeditateTask*> meditateTask = creature->getPendingTask("meditate").castTo<MeditateTask*>();
                        if (meditateTask != NULL) {
                                creature->removePendingTask("meditate");
 
@@ -1860,7 +1860,7 @@ int PlayerManagerImplementation::notifyObserverEvent(uint32 eventType, Observabl
                        }
 
                        // Check POSTERCHANGE on Force Meditate...
-                       Reference<ForceMeditateTask*> fmeditateTask = cast<ForceMeditateTask*>( creature->getPendingTask("forcemeditate"));
+                       Reference<ForceMeditateTask*> fmeditateTask = creature->getPendingTask("forcemeditate").castTo<ForceMeditateTask*>( );
 
                        if (fmeditateTask != NULL) {
                                creature->removePendingTask("forcemeditate");
@@ -1871,7 +1871,7 @@ int PlayerManagerImplementation::notifyObserverEvent(uint32 eventType, Observabl
                }
 
                // Check POSTURECHANGED disrupting Logout...
-               Reference<LogoutTask*> logoutTask = cast<LogoutTask*>(creature->getPendingTask("logout"));
+               Reference<LogoutTask*> logoutTask = creature->getPendingTask("logout").castTo<LogoutTask*>();
                if(logoutTask != NULL) {
                        logoutTask->cancelLogout();
                }
@@ -3569,7 +3569,7 @@ void PlayerManagerImplementation::rescheduleCorpseDestruction(CreatureObject* pl
 
        //If the looting player or no group members in the area can harvest then despawn immediately
        if (shouldRescheduleCorpseDestruction(player, ai)) {
-               Reference<DespawnCreatureTask*> despawn = dynamic_cast<DespawnCreatureTask*>(ai->getPendingTask("despawn"));
+               Reference<DespawnCreatureTask*> despawn = ai->getPendingTask("despawn").castTo<DespawnCreatureTask*>();
                if (despawn != NULL) {
                        despawn->cancel();
                        despawn->reschedule(1000);
index 72d5f19..ae189fa 100644 (file)
@@ -76,8 +76,8 @@ int ResourceManagerImplementation::notifyObserverEvent(uint32 eventType, Observa
        if (eventType == ObserverEventType::POSTURECHANGED) {
                CreatureObject* creature = cast<CreatureObject*>( observable);
                // Cancel Sampling on posture change
-               Reference<SampleTask*> task = cast<SampleTask*>( creature->getPendingTask("sample"));
-               Reference<SampleResultsTask*> sampleResultsTask = cast<SampleResultsTask*>( creature->getPendingTask("sampleresults"));
+               Reference<SampleTask*> task = creature->getPendingTask("sample").castTo<SampleTask*>( );
+               Reference<SampleResultsTask*> sampleResultsTask = creature->getPendingTask("sampleresults").castTo<SampleResultsTask*>( );
 
                if (task != NULL) {
 
index 382770c..93b5c2d 100644 (file)
@@ -757,7 +757,7 @@ void ResourceSpawner::sendSurvey(CreatureObject* player, const String& resname)
 
        player->inflictDamage(player, CreatureAttribute::MIND, mindCost, false, true);
 
-       ManagedReference<SurveySession*> session = cast<SurveySession*>(player->getActiveSession(SessionFacadeType::SURVEY));
+       ManagedReference<SurveySession*> session = player->getActiveSession(SessionFacadeType::SURVEY).castTo<SurveySession*>();
        if(session == NULL) {
                return;
        }
@@ -846,7 +846,7 @@ void ResourceSpawner::sendSample(CreatureObject* player, const String& resname,
                const String& sampleAnimation) {
 
        // Determine if survey tool is valid, and that resource actually exists
-       ManagedReference<SurveySession*> session = cast<SurveySession*>(player->getActiveSession(SessionFacadeType::SURVEY));
+       ManagedReference<SurveySession*> session = player->getActiveSession(SessionFacadeType::SURVEY).castTo<SurveySession*>();
        if(session == NULL) {
                return;
        }
@@ -890,7 +890,7 @@ void ResourceSpawner::sendSample(CreatureObject* player, const String& resname,
 
 void ResourceSpawner::sendSampleResults(CreatureObject* player, const float density, const String& resname) {
 
-       ManagedReference<SurveySession*> session = cast<SurveySession*>(player->getActiveSession(SessionFacadeType::SURVEY));
+       ManagedReference<SurveySession*> session = player->getActiveSession(SessionFacadeType::SURVEY).castTo<SurveySession*>();
 
        if(session == NULL) {
                return;
index fdc73fb..b698c22 100755 (executable)
@@ -81,7 +81,7 @@ public:
                if (!cancelled && playerCreature->getPendingTask("sample") != NULL) {
                        playerCreature->removePendingTask("sample");
 
-                       ManagedReference<SurveySession*> session = cast<SurveySession*>(playerCreature->getActiveSession(SessionFacadeType::SURVEY));
+                       ManagedReference<SurveySession*> session = playerCreature->getActiveSession(SessionFacadeType::SURVEY).castTo<SurveySession*>();
                        if(session != NULL) {
                                session->reSample();
                        }
index 86791c9..bf03c0a 100644 (file)
@@ -711,9 +711,7 @@ SceneObject* StructureManager::getInRangeParkingGarage(SceneObject* obj,
 }
 
 int StructureManager::redeedStructure(CreatureObject* creature) {
-       ManagedReference<DestroyStructureSession*> session =
-                       dynamic_cast<DestroyStructureSession*>(creature->getActiveSession(
-                                       SessionFacadeType::DESTROYSTRUCTURE));
+       ManagedReference<DestroyStructureSession*> session = creature->getActiveSession(SessionFacadeType::DESTROYSTRUCTURE).castTo<DestroyStructureSession*>();
 
        if (session == NULL)
                return 0;
index 734ebb7..1f3de2c 100644 (file)
@@ -23,7 +23,7 @@ public:
        void run() {
                Locker lock(creatureObject);
 
-               ManagedReference<PlaceStructureSession*> session = dynamic_cast<PlaceStructureSession*>(creatureObject->getActiveSession(SessionFacadeType::PLACESTRUCTURE));
+               ManagedReference<PlaceStructureSession*> session = creatureObject->getActiveSession(SessionFacadeType::PLACESTRUCTURE).castTo<PlaceStructureSession*>();
 
                if (session == NULL)
                        return;
index e04dc7d..b04a3ee 100644 (file)
@@ -36,19 +36,19 @@ public:
 };
 
 TEST_F(CircularAreaShapeTest, CircularAreaShapeHasItsCenterAtZeroZeroZeroAfterCreation) {
-       CircularAreaShape* circularAreaShape = new CircularAreaShape();
+       Reference<CircularAreaShape*> circularAreaShape = new CircularAreaShape();
        EXPECT_EQ(circularAreaShape->getAreaCenter().getX(), 0);
        EXPECT_EQ(circularAreaShape->getAreaCenter().getY(), 0);
        EXPECT_EQ(circularAreaShape->getAreaCenter().getZ(), 0);
 }
 
 TEST_F(CircularAreaShapeTest, CircularAreaShapeHasRadiusEqualToZeroAfterCreation) {
-       CircularAreaShape* circularAreaShape = new CircularAreaShape();
+       Reference<CircularAreaShape*> circularAreaShape = new CircularAreaShape();
        EXPECT_EQ(circularAreaShape->getRadius(), 0);
 }
 
 TEST_F(CircularAreaShapeTest, CircularAreaShapeHasRadiusSquareEqualToZeroAfterCreation) {
-       CircularAreaShape* circularAreaShape = new CircularAreaShape();
+       Reference<CircularAreaShape*> circularAreaShape = new CircularAreaShape();
        EXPECT_EQ(circularAreaShape->getRadius2(), 0);
 }
 
index 5bbcf16..9824aac 100644 (file)
@@ -611,7 +611,7 @@ void CreatureObjectImplementation::setCombatState() {
                if (posture == CreaturePosture::SITTING)
                        setPosture(CreaturePosture::UPRIGHT);
 
-               Reference<LogoutTask*> logoutTask = cast<LogoutTask*>(getPendingTask("logout"));
+               Reference<LogoutTask*> logoutTask = getPendingTask("logout").castTo<LogoutTask*>();
 
                if (logoutTask != NULL)
                        logoutTask->cancelLogout();
index 1272819..1b8a699 100644 (file)
@@ -380,11 +380,12 @@ int LuaCreatureObject::getBankCredits(lua_State *L) {
 }
 
 int LuaCreatureObject::getConversationSession(lua_State* L) {
-       ConversationSession* session = cast<ConversationSession*>(realObject->getActiveSession(SessionFacadeType::CONVERSATION));
+       Reference<ConversationSession*> session = realObject->getActiveSession(SessionFacadeType::CONVERSATION).castTo<ConversationSession*>();
 
-       if (session != NULL)
+       if (session != NULL) {
+               session->_setUpdated(true);
                lua_pushlightuserdata(L, session);
-       else
+       } else
                lua_pushnil(L);
 
        return 1;
index 64dec1d..ef00d2a 100755 (executable)
@@ -68,7 +68,7 @@ public:
                if(creature == NULL || !creature->isPlayerCreature())
                        return INVALIDTARGET;
 
-               Reference<CraftingSession*> session = cast<CraftingSession*>(creature->getActiveSession(SessionFacadeType::CRAFTING));
+               Reference<CraftingSession*> session = creature->getActiveSession(SessionFacadeType::CRAFTING).castTo<CraftingSession*>();
 
                if(session == NULL) {
                        return GENERALERROR;
index 9648d4a..c7f0da0 100755 (executable)
@@ -63,7 +63,7 @@ public:
        }
 
        bool canPlaySong(CreatureObject* entertainer, String song) {
-               ManagedReference<EntertainingSession*> session = dynamic_cast<EntertainingSession*>(entertainer->getActiveSession(SessionFacadeType::ENTERTAINING));
+               ManagedReference<EntertainingSession*> session = entertainer->getActiveSession(SessionFacadeType::ENTERTAINING).castTo<EntertainingSession*>();
 
                if (session == NULL || !session->isPlayingMusic())
                        return false;
@@ -113,7 +113,7 @@ public:
                        return GENERALERROR;
                }
 
-               ManagedReference<EntertainingSession*> session = dynamic_cast<EntertainingSession*>(creature->getActiveSession(SessionFacadeType::ENTERTAINING));
+               ManagedReference<EntertainingSession*> session = creature->getActiveSession(SessionFacadeType::ENTERTAINING).castTo<EntertainingSession*>();
 
                if (session == NULL) {
                        creature->sendSystemMessage("@performance:music_must_be_performing_self"); // You must be playing music before you can change the song.
@@ -188,7 +188,7 @@ public:
                                if (groupMember == NULL || !groupMember->isPlayingMusic())
                                        continue;
 
-                               ManagedReference<EntertainingSession*> bandMemberSession = dynamic_cast<EntertainingSession*>(groupMember->getActiveSession(SessionFacadeType::ENTERTAINING));
+                               ManagedReference<EntertainingSession*> bandMemberSession = groupMember->getActiveSession(SessionFacadeType::ENTERTAINING).castTo<EntertainingSession*>();
 
                                if (bandMemberSession == NULL || !bandMemberSession->isPlayingMusic())
                                        continue;
index e121f79..000ff30 100755 (executable)
@@ -63,7 +63,7 @@ public:
                if (!checkInvalidLocomotions(creature))
                        return INVALIDLOCOMOTION;
 
-               ManagedReference<EntertainingSession*> session = dynamic_cast<EntertainingSession*>(creature->getActiveSession(SessionFacadeType::ENTERTAINING));
+               ManagedReference<EntertainingSession*> session = creature->getActiveSession(SessionFacadeType::ENTERTAINING).castTo<EntertainingSession*>();
 
                if (session == NULL) {
                        creature->sendSystemMessage("@performance:dance_must_be_performing_self");
index e04a2f8..b1cbd37 100755 (executable)
@@ -65,7 +65,7 @@ public:
                if (!checkInvalidLocomotions(creature))
                        return INVALIDLOCOMOTION;
 
-               ManagedReference<EntertainingSession*> session = dynamic_cast<EntertainingSession*>(creature->getActiveSession(SessionFacadeType::ENTERTAINING));
+               ManagedReference<EntertainingSession*> session = creature->getActiveSession(SessionFacadeType::ENTERTAINING).castTo<EntertainingSession*>();
 
                if (session == NULL) {
                        creature->sendSystemMessage("@performance:music_must_be_performing_self"); // You must be playing music before you can change the song.
index 982c452..3aa659b 100755 (executable)
@@ -76,7 +76,7 @@ public:
                if (!creature->isPlayerCreature())
                        return INVALIDTARGET;
 
-               ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(creature->getActiveSession(SessionFacadeType::TRADE));
+               ManagedReference<TradeSession*> tradeContainer = creature->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
                if (tradeContainer != NULL) {
                        server->getZoneServer()->getPlayerManager()->handleAbortTradeMessage(creature);
@@ -90,7 +90,7 @@ public:
                else
                        return GENERALERROR;
 
-               Reference<CraftingSession*> session = cast<CraftingSession*>(creature->getActiveSession(SessionFacadeType::CRAFTING));
+               Reference<CraftingSession*> session = creature->getActiveSession(SessionFacadeType::CRAFTING).castTo<CraftingSession*>();
 
                if(session == NULL) {
                        warning("Trying to create manf schematic when no session exists");
index 3bad01f..de4ab5f 100755 (executable)
@@ -76,7 +76,7 @@ public:
                if (!creature->isPlayerCreature())
                        return INVALIDTARGET;
 
-               ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(creature->getActiveSession(SessionFacadeType::TRADE));
+               ManagedReference<TradeSession*> tradeContainer = creature->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
                if (tradeContainer != NULL) {
                        server->getZoneServer()->getPlayerManager()->handleAbortTradeMessage(creature);
@@ -99,7 +99,7 @@ public:
                else
                        createItem = true;
 
-               Reference<CraftingSession*> session = cast<CraftingSession*>(creature->getActiveSession(SessionFacadeType::CRAFTING));
+               Reference<CraftingSession*> session = creature->getActiveSession(SessionFacadeType::CRAFTING).castTo<CraftingSession*>();
 
                if(session == NULL) {
                        return GENERALERROR;
index a22c7fc..49dcef4 100755 (executable)
@@ -71,7 +71,7 @@ public:
                if(targetObject == creature || !targetObject->isPlayerCreature())
                        return GENERALERROR;
 
-               ManagedReference<EntertainingSession*> session = dynamic_cast<EntertainingSession*>(creature->getActiveSession(SessionFacadeType::ENTERTAINING));
+               ManagedReference<EntertainingSession*> session = creature->getActiveSession(SessionFacadeType::ENTERTAINING).castTo<EntertainingSession*>();
 
                if(session == NULL)
                        return GENERALERROR;
index 95e418c..b2e2e82 100755 (executable)
@@ -85,7 +85,7 @@ public:
                        if (creatureTarget == NULL)
                                return GENERALERROR;
 
-                       Reference<ForceChokeTickTask*> chokeCheck = dynamic_cast<ForceChokeTickTask*>(creatureTarget->getPendingTask("forceChokeTickTask"));
+                       Reference<ForceChokeTickTask*> chokeCheck = creatureTarget->getPendingTask("forceChokeTickTask").castTo<ForceChokeTickTask*>();
 
                        if (chokeCheck != NULL) {
                                return SUCCESS;
index 3b1f7fa..8d91d0f 100755 (executable)
@@ -81,7 +81,7 @@ public:
                ManagedReference<PlayerManager*> playerManager = server->getPlayerManager();
                ManagedReference<Account*> account = NULL;
 
-               session = cast<PlayerManagementSession*>(creature->getActiveSession(SessionFacadeType::PLAYERMANAGEMENT));
+               session = creature->getActiveSession(SessionFacadeType::PLAYERMANAGEMENT).castTo<PlayerManagementSession*>();
 
                if(session != NULL) {
                        if(!admin->hasSuiBoxWindowType(SuiWindowType::ADMIN_ACCOUNTINFO))
index 6aca09c..5c414c3 100755 (executable)
@@ -74,13 +74,13 @@ public:
                if(!creature->isPlayerCreature())
                        return INVALIDTARGET;
 
-               ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(creature->getActiveSession(SessionFacadeType::TRADE));
+               ManagedReference<TradeSession*> tradeContainer = creature->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
                if (tradeContainer != NULL) {
                        server->getZoneServer()->getPlayerManager()->handleAbortTradeMessage(creature);
                }
 
-               Reference<CraftingSession*> session = cast<CraftingSession*>(creature->getActiveSession(SessionFacadeType::CRAFTING));
+               Reference<CraftingSession*> session = creature->getActiveSession(SessionFacadeType::CRAFTING).castTo<CraftingSession*>();
 
                if(session == NULL) {
                        return GENERALERROR;
index d1d2fd1..3f46cb0 100755 (executable)
@@ -104,7 +104,7 @@ public:
                        }
 
 
-                       ManagedReference<SurveySession*> session = cast<SurveySession*>(creature->getActiveSession(SessionFacadeType::SURVEY));
+                       ManagedReference<SurveySession*> session = creature->getActiveSession(SessionFacadeType::SURVEY).castTo<SurveySession*>();
 
                        if(session == NULL) {
                                creature->sendSystemMessage("@ui:survey_notool");
index 93b747e..69e8d15 100755 (executable)
@@ -71,7 +71,7 @@ public:
                if(object == NULL || !creature->isPlayerCreature())
                        return INVALIDTARGET;
 
-               ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(creature->getActiveSession(SessionFacadeType::TRADE));
+               ManagedReference<TradeSession*> tradeContainer = creature->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
                if (tradeContainer != NULL) {
                        server->getZoneServer()->getPlayerManager()->handleAbortTradeMessage(creature);
@@ -155,7 +155,7 @@ public:
                                craftingStation = playerMan->getNearbyCraftingStation(creature, craftingTool->getToolType());
                        }
 
-                       Reference<CraftingSession*> session = cast<CraftingSession*>(creature->getActiveSession(SessionFacadeType::CRAFTING));
+                       Reference<CraftingSession*> session = creature->getActiveSession(SessionFacadeType::CRAFTING).castTo<CraftingSession*>();
                        if(session != NULL) {
                                Locker locker(session);
                                session->cancelSession();
index ab63321..de9f45a 100755 (executable)
@@ -95,7 +95,7 @@ public:
                                }
                        }
 
-                       ManagedReference<SurveySession*> session = cast<SurveySession*>(creature->getActiveSession(SessionFacadeType::SURVEY));
+                       ManagedReference<SurveySession*> session = creature->getActiveSession(SessionFacadeType::SURVEY).castTo<SurveySession*>();
 
                        if(session == NULL) {
                                creature->sendSystemMessage("@ui:survey_notool");
index 8b6b565..31833b2 100755 (executable)
@@ -67,7 +67,7 @@ public:
                        return INVALIDLOCOMOTION;
 
                if (creature->isPlayerCreature()) {
-                       ManagedReference<SurveySession*> session = cast<SurveySession*>(creature->getActiveSession(SessionFacadeType::SURVEY));
+                       ManagedReference<SurveySession*> session = creature->getActiveSession(SessionFacadeType::SURVEY).castTo<SurveySession*>();
                        if(session == NULL) {
                                creature->sendSystemMessage("@ui:survey_notool");
                        }
index e194851..d3d53f1 100755 (executable)
@@ -73,7 +73,7 @@ public:
            if(!creature->isPlayerCreature())
                        return INVALIDTARGET;
 
-           ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(creature->getActiveSession(SessionFacadeType::TRADE));
+           ManagedReference<TradeSession*> tradeContainer = creature->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
            if (tradeContainer != NULL) {
                server->getZoneServer()->getPlayerManager()->handleAbortTradeMessage(creature);
@@ -81,7 +81,7 @@ public:
 
            ManagedReference<CreatureObject* > player = creature;
 
-               Reference<CraftingSession*> session = cast<CraftingSession*>(creature->getActiveSession(SessionFacadeType::CRAFTING));
+               Reference<CraftingSession*> session = creature->getActiveSession(SessionFacadeType::CRAFTING).castTo<CraftingSession*>();
 
                if(session == NULL) {
                        return GENERALERROR;
index 6455b0e..33b9dd2 100755 (executable)
@@ -77,7 +77,7 @@ public:
                        return GENERALERROR;
                }
 
-               ManagedReference<EntertainingSession*> session = dynamic_cast<EntertainingSession*>(creature->getActiveSession(SessionFacadeType::ENTERTAINING));
+               ManagedReference<EntertainingSession*> session = creature->getActiveSession(SessionFacadeType::ENTERTAINING).castTo<EntertainingSession*>();
 
                if (session != NULL) {
                        if (session->isDancing()) {
@@ -148,7 +148,7 @@ public:
                                if (groupMember == NULL)
                                        continue;
 
-                               ManagedReference<EntertainingSession*> groupMemberSession = dynamic_cast<EntertainingSession*>(groupMember->getActiveSession(SessionFacadeType::ENTERTAINING));
+                               ManagedReference<EntertainingSession*> groupMemberSession = groupMember->getActiveSession(SessionFacadeType::ENTERTAINING).castTo<EntertainingSession*>();
 
                                if (groupMemberSession != NULL)
                                        continue;
index ce280f8..e7966aa 100755 (executable)
@@ -99,7 +99,7 @@ public:
                                if (groupMember == NULL || !groupMember->isPlayingMusic())
                                        continue;
 
-                               ManagedReference<EntertainingSession*> bandMemberSession = dynamic_cast<EntertainingSession*>(groupMember->getActiveSession(SessionFacadeType::ENTERTAINING));
+                               ManagedReference<EntertainingSession*> bandMemberSession = groupMember->getActiveSession(SessionFacadeType::ENTERTAINING).castTo<EntertainingSession*>();
 
                                if (bandMemberSession == NULL || !bandMemberSession->isPlayingMusic())
                                        continue;
index 2b495d2..7ac8bcc 100755 (executable)
@@ -66,7 +66,7 @@ public:
 
                if (creature->isPlayerCreature()) {
 
-                       ManagedReference<SurveySession*> session = cast<SurveySession*>(creature->getActiveSession(SessionFacadeType::SURVEY));
+                       ManagedReference<SurveySession*> session = creature->getActiveSession(SessionFacadeType::SURVEY).castTo<SurveySession*>();
                        if(session == NULL) {
                                creature->sendSystemMessage("@ui:survey_notool");
                        }
index bc86643..4eeed48 100755 (executable)
@@ -80,7 +80,7 @@ public:
                float unknown2 = tokenizer.getFloatToken();
                float unknown3 = tokenizer.getFloatToken();
 
-               ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(creature->getActiveSession(SessionFacadeType::TRADE));
+               ManagedReference<TradeSession*> tradeContainer = creature->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
                if (tradeContainer != NULL) {
                        server->getZoneServer()->getPlayerManager()->handleAbortTradeMessage(creature);
index 574fc4e..01891df 100755 (executable)
@@ -82,7 +82,7 @@ public:
                float unknown2 = tokenizer.getFloatToken();
                float unknown3 = tokenizer.getFloatToken();
 
-               ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(creature->getActiveSession(SessionFacadeType::TRADE));
+               ManagedReference<TradeSession*> tradeContainer = creature->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
                if (tradeContainer != NULL) {
                        server->getZoneServer()->getPlayerManager()->handleAbortTradeMessage(creature);
index f080c30..c861e33 100755 (executable)
@@ -81,7 +81,7 @@ public:
                float unknown2 = tokenizer.getFloatToken();
                float unknown3 = tokenizer.getFloatToken();
 
-               ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(creature->getActiveSession(SessionFacadeType::TRADE));
+               ManagedReference<TradeSession*> tradeContainer = creature->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
                if (tradeContainer != NULL) {
                        server->getZoneServer()->getPlayerManager()->handleAbortTradeMessage(creature);
index 3be1679..b9e9eaf 100644 (file)
@@ -93,7 +93,7 @@ int ConversationObserverImplementation::notifyObserverEvent(unsigned int eventTy
        switch (eventType) {
        case ObserverEventType::POSITIONCHANGED:
                if (npc != NULL) { //the observable in this case is the player
-                       ManagedReference<ConversationSession*> session = dynamic_cast<ConversationSession*>(npc->getActiveSession(SessionFacadeType::CONVERSATION));
+                       ManagedReference<ConversationSession*> session = npc->getActiveSession(SessionFacadeType::CONVERSATION).castTo<ConversationSession*>();
 
                        if (session != NULL) {
                                ManagedReference<CreatureObject*> sessionNpc = session->getNPC();
@@ -168,7 +168,7 @@ void ConversationObserverImplementation::cancelConversationSession(CreatureObjec
 
 ConversationScreen* ConversationObserverImplementation::getNextConversationScreen(CreatureObject* conversingPlayer, int selectedOption, CreatureObject* conversingNPC) {
        //Get screen ID from last conversation screen.
-       Reference<ConversationSession*> session = cast<ConversationSession* >(conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION));
+       Reference<ConversationSession*> session = conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION).castTo<ConversationSession* >();
        /*String lastScreenId = "";
        if (session != NULL) {
                lastScreenId = session->getLastConversationScreenName();
@@ -227,7 +227,7 @@ void ConversationObserverImplementation::sendConversationScreenToPlayer(Creature
                conversationScreen->sendTo(conversingPlayer, conversingNPC);
        } else {
                //Clear screen ID from last conversation screen.
-               ConversationSession* session = cast<ConversationSession* >(conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION));
+               Reference<ConversationSession*> session = conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION).castTo<ConversationSession* >();
                if (session != NULL) {
                        session->setLastConversationScreen(NULL);
                }
index bffa616..685bd39 100644 (file)
@@ -62,7 +62,7 @@ const String TrainerScreenHandlers::ERRORSCREENHANDLERID = "convoscreenerror";
 const String TrainerScreenHandlers::NONEXISTINGSCREENHANDLERID = "non-existing-screen";
 
 ConversationScreen* TrainerInfoScreenHandler::handleScreen(CreatureObject* conversingPlayer, CreatureObject* conversingNPC, int selectedOption, ConversationScreen* conversationScreen) {
-       TrainerConversationSession* session = cast<TrainerConversationSession* >(conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION));
+       Reference<TrainerConversationSession*> session = conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION).castTo<TrainerConversationSession* >();
        if (session == NULL) {
                nextScreenId = TrainerScreenHandlers::ERRORSCREENHANDLERID;
                return NULL;
@@ -110,7 +110,7 @@ ConversationScreen* TrainerTrainableSkillsScreenHandler::handleScreen(CreatureOb
        Vector<String> trainableSkills;
        Vector<Skill*> masterSkills;
 
-       TrainerConversationSession* session = cast<TrainerConversationSession* >(conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION));
+       Reference<TrainerConversationSession*> session = conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION).castTo<TrainerConversationSession* >();
        if (session == NULL) {
                nextScreenId = TrainerScreenHandlers::ERRORSCREENHANDLERID;
                return NULL;
@@ -181,7 +181,7 @@ ConversationScreen* TrainerNextSkillsScreenHandler::handleScreen(CreatureObject*
        Vector<String> nextSkills;
        Vector<Skill*> masterSkills;
 
-       TrainerConversationSession* session = cast<TrainerConversationSession* >(conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION));
+       Reference<TrainerConversationSession*> session = conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION).castTo<TrainerConversationSession* >();
        if (session == NULL) {
                nextScreenId = TrainerScreenHandlers::ERRORSCREENHANDLERID;
                return NULL;
@@ -249,7 +249,7 @@ void TrainerNextSkillsScreenHandler::getNextSkillsList(CreatureObject* conversin
 
 ConversationScreen* TrainerSkillInfoScreenHandler::handleScreen(CreatureObject* conversingPlayer, CreatureObject* conversingNPC, int selectedOption, ConversationScreen* conversationScreen) {
        //Get conversation session.
-       TrainerConversationSession* session = cast<TrainerConversationSession* >(conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION));
+       Reference<TrainerConversationSession*> session = conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION).castTo<TrainerConversationSession* >();
        if (session == NULL) {
                nextScreenId = TrainerScreenHandlers::ERRORSCREENHANDLERID;
                return NULL;
@@ -275,7 +275,7 @@ ConversationScreen* TrainerSkillInfoScreenHandler::handleScreen(CreatureObject*
 
 ConversationScreen* TrainerCanLearnSkillScreenHandler::handleScreen(CreatureObject* conversingPlayer, CreatureObject* conversingNPC, int selectedOption, ConversationScreen* conversationScreen) {
        //Get conversation session.
-       TrainerConversationSession* session = cast<TrainerConversationSession* >(conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION));
+       Reference<TrainerConversationSession*> session = conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION).castTo<TrainerConversationSession* >();
        if (session == NULL) {
                nextScreenId = TrainerScreenHandlers::ERRORSCREENHANDLERID;
                return NULL;
@@ -314,7 +314,7 @@ ConversationScreen* TrainerTrainSkillScreenHandler::handleScreen(CreatureObject*
        ManagedReference<PlayerObject* > ghost = conversingPlayer->getPlayerObject();
 
        //Skill previously stored in player session.
-       TrainerConversationSession* session = cast<TrainerConversationSession* >(conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION));
+       Reference<TrainerConversationSession*> session = conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION).castTo<TrainerConversationSession* >();
        if (session == NULL) {
                nextScreenId = TrainerScreenHandlers::ERRORSCREENHANDLERID;
                return NULL;
@@ -391,7 +391,7 @@ ConversationScreen* TrainerTrainSkillScreenHandler::handleScreen(CreatureObject*
 
 ConversationScreen* TrainerNotEnoughCreditsScreenHandler::handleScreen(CreatureObject* conversingPlayer, CreatureObject* conversingNPC, int selectedOption, ConversationScreen* conversationScreen) {
        //Skill previously stored in player session.
-       TrainerConversationSession* session = cast<TrainerConversationSession* >(conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION));
+       Reference<TrainerConversationSession*> session = conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION).castTo<TrainerConversationSession* >();
        if (session == NULL) {
                nextScreenId = TrainerScreenHandlers::ERRORSCREENHANDLERID;
                return NULL;
@@ -412,7 +412,7 @@ ConversationScreen* TrainerNotEnoughCreditsScreenHandler::handleScreen(CreatureO
 
 ConversationScreen* TrainerNotEnoughSkillPointsScreenHandler::handleScreen(CreatureObject* conversingPlayer, CreatureObject* conversingNPC, int selectedOption, ConversationScreen* conversationScreen) {
        //Skill previously stored in player session.
-       TrainerConversationSession* session = cast<TrainerConversationSession* >(conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION));
+       Reference<TrainerConversationSession*> session = conversingPlayer->getActiveSession(SessionFacadeType::CONVERSATION).castTo<TrainerConversationSession* >();
        if (session == NULL) {
                nextScreenId = TrainerScreenHandlers::ERRORSCREENHANDLERID;
                return NULL;
index efefbf0..edd5ab3 100644 (file)
@@ -35,7 +35,7 @@ void VehicleControlDeviceImplementation::generateObject(CreatureObject* player)
        if (player->isInCombat() || player->isDead() || player->isIncapacitated())
                return;
 
-       ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(player->getActiveSession(SessionFacadeType::TRADE));
+       ManagedReference<TradeSession*> tradeContainer = player->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
        if (tradeContainer != NULL) {
                server->getZoneServer()->getPlayerManager()->handleAbortTradeMessage(player);
@@ -112,7 +112,7 @@ void VehicleControlDeviceImplementation::spawnObject(CreatureObject* player) {
        if (!isASubChildOf(player))
                return;
 
-       ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(player->getActiveSession(SessionFacadeType::TRADE));
+       ManagedReference<TradeSession*> tradeContainer = player->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
        if (tradeContainer != NULL) {
                server->getZoneServer()->getPlayerManager()->handleAbortTradeMessage(player);
@@ -155,8 +155,9 @@ void VehicleControlDeviceImplementation::spawnObject(CreatureObject* player) {
 
 void VehicleControlDeviceImplementation::cancelSpawnObject(CreatureObject* player) {
 
-       if(player->getPendingTask("call_mount")) {
-               player->getPendingTask("call_mount")->cancel();
+       Reference<Task*> mountTask = player->getPendingTask("call_mount");
+       if(mountTask) {
+               mountTask->cancel();
                player->removePendingTask("call_mount");
        }
 
index ab34535..8b60c41 100644 (file)
@@ -161,7 +161,7 @@ void ManufactureSchematicImplementation::synchronizedUIListen(SceneObject* playe
        if(!player->isPlayerCreature() || draftSchematic == NULL)
                return;
 
-       Reference<CraftingSession*> session = cast<CraftingSession*>(player->getActiveSession(SessionFacadeType::CRAFTING));
+       Reference<CraftingSession*> session = player->getActiveSession(SessionFacadeType::CRAFTING).castTo<CraftingSession*>();
        if(session == NULL || session->getSchematic() != _this.get()) {
                return;
        }
index e28ddd5..df74053 100644 (file)
@@ -238,7 +238,7 @@ void PlayerObjectImplementation::unload() {
 
        creature->stopEntertaining();
 
-       ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(creature->getActiveSession(SessionFacadeType::TRADE));
+       ManagedReference<TradeSession*> tradeContainer = creature->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
        if (tradeContainer != NULL)
                creature->dropActiveSession(SessionFacadeType::TRADE);
index 3530666..4885b92 100644 (file)
@@ -75,7 +75,7 @@ public:
                Locker playerLocker(player);
 
                try {
-                       Reference<ForceMeditateTask*> fmeditateTask = dynamic_cast<ForceMeditateTask*>(player->getPendingTask("forcemeditate"));
+                       Reference<ForceMeditateTask*> fmeditateTask = player->getPendingTask("forcemeditate").castTo<ForceMeditateTask*>();
 
                        if (!player->isMeditating())
                                return;
index 3e9ff08..e6a10f6 100644 (file)
@@ -80,7 +80,7 @@ public:
                Locker playerLocker(player);
 
                try {
-                       Reference<MeditateTask*> meditateTask = dynamic_cast<MeditateTask*>(player->getPendingTask("meditate"));
+                       Reference<MeditateTask*> meditateTask = player->getPendingTask("meditate").castTo<MeditateTask*>();
                        int meditateMod = player->getSkillMod("meditate"); // get Meditate Skill Mod
 
                        if (!player->isMeditating())
index 359703b..217f0ba 100644 (file)
@@ -28,7 +28,7 @@ public:
                                return;
                }
 
-               ManagedReference<SurveySession*> session = cast<SurveySession*>(player->getActiveSession(SessionFacadeType::SURVEY));
+               ManagedReference<SurveySession*> session = player->getActiveSession(SessionFacadeType::SURVEY).castTo<SurveySession*>();
 
                if(session == NULL) {
                        return;
index c3fa230..da0ef22 100644 (file)
@@ -28,7 +28,7 @@ public:
                                return;
                }
 
-               ManagedReference<SurveySession*> session = cast<SurveySession*>(player->getActiveSession(SessionFacadeType::SURVEY));
+               ManagedReference<SurveySession*> session = player->getActiveSession(SessionFacadeType::SURVEY).castTo<SurveySession*>();
                if(session == NULL) {
                        return;
                }
index baec152..1d8bacb 100644 (file)
@@ -21,7 +21,7 @@ public:
 
        void run(CreatureObject* creature, SuiBox* sui, bool cancelPressed, Vector<UnicodeString>* args) {
 
-               ManagedReference<VendorAdBarkingSession*> session = cast<VendorAdBarkingSession*>(creature->getActiveSession(SessionFacadeType::VENDORADBARKING));
+               ManagedReference<VendorAdBarkingSession*> session = creature->getActiveSession(SessionFacadeType::VENDORADBARKING).castTo<VendorAdBarkingSession*>();
                if(session == NULL)
                        return;
 
index e7c2429..a035e85 100644 (file)
@@ -38,7 +38,7 @@ public:
        }
 
        void run(CreatureObject* player, SuiBox* suiBox, bool cancelPressed, Vector<UnicodeString>* args) {
-               ManagedReference<CityRemoveMilitiaSession*> session = dynamic_cast<CityRemoveMilitiaSession*>(player->getActiveSession(SessionFacadeType::CITYMILITIA));
+               ManagedReference<CityRemoveMilitiaSession*> session = player->getActiveSession(SessionFacadeType::CITYMILITIA).castTo<CityRemoveMilitiaSession*>();
 
                if (session == NULL)
                        return;
index 4e5dd26..726e6c6 100644 (file)
@@ -19,7 +19,7 @@ public:
        }
 
        void run(CreatureObject* player, SuiBox* suiBox, bool cancelPressed, Vector<UnicodeString>* args) {
-               ManagedReference<CitySpecializationSession*> session = dynamic_cast<CitySpecializationSession*>(player->getActiveSession(SessionFacadeType::CITYSPEC));
+               ManagedReference<CitySpecializationSession*> session = player->getActiveSession(SessionFacadeType::CITYSPEC).castTo<CitySpecializationSession*>();
 
                if (session == NULL)
                        return;
index 3f3b44f..21f5c9c 100644 (file)
@@ -19,7 +19,7 @@ public:
        }
 
        void run(CreatureObject* player, SuiBox* suiBox, bool cancelPressed, Vector<UnicodeString>* args) {
-               ManagedReference<CitySpecializationSession*> session = dynamic_cast<CitySpecializationSession*>(player->getActiveSession(SessionFacadeType::CITYSPEC));
+               ManagedReference<CitySpecializationSession*> session = player->getActiveSession(SessionFacadeType::CITYSPEC).castTo<CitySpecializationSession*>();
 
                if (session == NULL)
                        return;
index bb272a5..f8e0748 100644 (file)
@@ -19,7 +19,7 @@ public:
        }
 
        void run(CreatureObject* player, SuiBox* suiBox, bool cancelPressed, Vector<UnicodeString>* args) {
-               ManagedReference<CityTreasuryWithdrawalSession*> session = dynamic_cast<CityTreasuryWithdrawalSession*>(player->getActiveSession(SessionFacadeType::CITYWITHDRAW));
+               ManagedReference<CityTreasuryWithdrawalSession*> session = player->getActiveSession(SessionFacadeType::CITYWITHDRAW).castTo<CityTreasuryWithdrawalSession*>();
 
                if (session == NULL)
                        return;
index 15b8ee4..3df1bf5 100644 (file)
@@ -19,7 +19,7 @@ public:
        }
 
        void run(CreatureObject* player, SuiBox* suiBox, bool cancelPressed, Vector<UnicodeString>* args) {
-               ManagedReference<CityTreasuryWithdrawalSession*> session = dynamic_cast<CityTreasuryWithdrawalSession*>(player->getActiveSession(SessionFacadeType::CITYWITHDRAW));
+               ManagedReference<CityTreasuryWithdrawalSession*> session = player->getActiveSession(SessionFacadeType::CITYWITHDRAW).castTo<CityTreasuryWithdrawalSession*>();
 
                if (session == NULL)
                        return;
index 7ec4f63..5801e96 100644 (file)
@@ -18,7 +18,7 @@ public:
        }
 
        void run(CreatureObject* player, SuiBox* sui, bool cancelPressed, Vector<UnicodeString>* args) {
-               ManagedReference<DestroyStructureSession*> session = dynamic_cast<DestroyStructureSession*>(player->getActiveSession(SessionFacadeType::DESTROYSTRUCTURE));
+               ManagedReference<DestroyStructureSession*> session = player->getActiveSession(SessionFacadeType::DESTROYSTRUCTURE).castTo<DestroyStructureSession*>();
 
                if (session == NULL)
                        return;
index f423ba0..ccfa1e7 100644 (file)
@@ -17,7 +17,7 @@ public:
        }
 
        void run(CreatureObject* player, SuiBox* sui, bool cancelPressed, Vector<UnicodeString>* args) {
-               ManagedReference<DestroyStructureSession*> session = dynamic_cast<DestroyStructureSession*>(player->getActiveSession(SessionFacadeType::DESTROYSTRUCTURE));
+               ManagedReference<DestroyStructureSession*> session = player->getActiveSession(SessionFacadeType::DESTROYSTRUCTURE).castTo<DestroyStructureSession*>();
 
                if (session == NULL)
                        return;
index 6c25054..51255cc 100644 (file)
@@ -24,7 +24,7 @@ public:
 
                ManagedReference<SceneObject*> obj = sui->getUsingObject();
                ManagedReference<StructureSetAccessFeeSession*> session =
-                               cast<StructureSetAccessFeeSession*>(creature->getActiveSession(SessionFacadeType::SETSTRUCTUREACCESSFEE));
+                               creature->getActiveSession(SessionFacadeType::SETSTRUCTUREACCESSFEE).castTo<StructureSetAccessFeeSession*>();
 
                if (session == NULL)
                        return;
index d3c5630..b52d41e 100644 (file)
@@ -24,7 +24,7 @@ public:
 
                ManagedReference<SceneObject*> obj = sui->getUsingObject();
                ManagedReference<StructureSetAccessFeeSession*> session =
-                               cast<StructureSetAccessFeeSession*>(creature->getActiveSession(SessionFacadeType::SETSTRUCTUREACCESSFEE));
+                               creature->getActiveSession(SessionFacadeType::SETSTRUCTUREACCESSFEE).castTo<StructureSetAccessFeeSession*>();
 
                if (session == NULL)
                        return;
index eef44ee..42879a2 100644 (file)
@@ -267,7 +267,7 @@ void CityRegionImplementation::notifyEnter(SceneObject* object) {
 
 void CityRegionImplementation::notifyExit(SceneObject* object) {
        //pre: no 2 different city regions should ever overlap, only 2 Regions of the same city region
-       ManagedReference<Region*> activeRegion = cast<Region*>(object->getActiveRegion());
+       ManagedReference<Region*> activeRegion = object->getActiveRegion().castTo<Region*>();
 
        if (activeRegion != NULL) {
                ManagedReference<CityRegion*> city = activeRegion->getCityRegion();
index 0a6b323..b3fbbca 100644 (file)
@@ -942,7 +942,7 @@ PendingTasksMap* SceneObject::getPendingTasks() {
                return _implementation->getPendingTasks();
 }
 
-Task* SceneObject::getPendingTask(const String& name) {
+Reference<Task* > SceneObject::getPendingTask(const String& name) {
        SceneObjectImplementation* _implementation = static_cast<SceneObjectImplementation*>(_getImplementationForRead());
        if (_implementation == NULL) {
                throw ObjectNotLocalException(this);
@@ -1009,7 +1009,7 @@ int SceneObject::getCountableObjectsRecursive() {
                return _implementation->getCountableObjectsRecursive();
 }
 
-Facade* SceneObject::getActiveSession(unsigned int type) {
+Reference<Facade* > SceneObject::getActiveSession(unsigned int type) {
        SceneObjectImplementation* _implementation = static_cast<SceneObjectImplementation*>(_getImplementationForRead());
        if (_implementation == NULL) {
                if (!deployed)
@@ -1246,7 +1246,7 @@ int SceneObject::getActiveAreasSize() {
                return _implementation->getActiveAreasSize();
 }
 
-ActiveArea* SceneObject::getActiveRegion() {
+Reference<ActiveArea* > SceneObject::getActiveRegion() {
        SceneObjectImplementation* _implementation = static_cast<SceneObjectImplementation*>(_getImplementationForRead());
        if (_implementation == NULL) {
                if (!deployed)
@@ -4269,7 +4269,7 @@ PendingTasksMap* SceneObjectImplementation::getPendingTasks() {
        return pendingTasks;
 }
 
-Task* SceneObjectImplementation::getPendingTask(const String& name) {
+Reference<Task* > SceneObjectImplementation::getPendingTask(const String& name) {
        // server/zone/objects/scene/SceneObject.idl():                 }
 {
        Locker _locker((&containerLock));
@@ -4293,7 +4293,7 @@ bool SceneObjectImplementation::containsPendingTask(const String& name) {
 }
 }
 
-Facade* SceneObjectImplementation::getActiveSession(unsigned int type) {
+Reference<Facade* > SceneObjectImplementation::getActiveSession(unsigned int type) {
        // server/zone/objects/scene/SceneObject.idl():                 return objectActiveSessions.get(type);
        return (&objectActiveSessions)->get(type);
 }
@@ -4383,7 +4383,7 @@ int SceneObjectImplementation::getActiveAreasSize() {
        return (&activeAreas)->size();
 }
 
-ActiveArea* SceneObjectImplementation::getActiveRegion() {
+Reference<ActiveArea* > SceneObjectImplementation::getActiveRegion() {
        // server/zone/objects/scene/SceneObject.idl():                 }
 {
        Locker _locker((&containerLock));
@@ -6705,7 +6705,7 @@ int SceneObjectAdapter::getCountableObjectsRecursive() {
        return (static_cast<SceneObject*>(stub))->getCountableObjectsRecursive();
 }
 
-Facade* SceneObjectAdapter::getActiveSession(unsigned int type) {
+Reference<Facade* > SceneObjectAdapter::getActiveSession(unsigned int type) {
        return (static_cast<SceneObject*>(stub))->getActiveSession(type);
 }
 
@@ -6765,7 +6765,7 @@ int SceneObjectAdapter::getActiveAreasSize() {
        return (static_cast<SceneObject*>(stub))->getActiveAreasSize();
 }
 
-ActiveArea* SceneObjectAdapter::getActiveRegion() {
+Reference<ActiveArea* > SceneObjectAdapter::getActiveRegion() {
        return (static_cast<SceneObject*>(stub))->getActiveRegion();
 }
 
index 8af1fae..b49d9ac 100644 (file)
@@ -400,7 +400,7 @@ public:
 
        PendingTasksMap* getPendingTasks();
 
-       Task* getPendingTask(const String& name);
+       Reference<Task* > getPendingTask(const String& name);
 
        bool containsPendingTask(const String& name);
 
@@ -410,7 +410,7 @@ public:
 
        int getCountableObjectsRecursive();
 
-       Facade* getActiveSession(unsigned int type);
+       Reference<Facade* > getActiveSession(unsigned int type);
 
        void addActiveSession(unsigned int type, Facade* session);
 
@@ -446,7 +446,7 @@ public:
 
        int getActiveAreasSize();
 
-       ActiveArea* getActiveRegion();
+       Reference<ActiveArea* > getActiveRegion();
 
        ManagedWeakReference<CityRegion* > getCityRegion();
 
@@ -1078,7 +1078,7 @@ public:
 
        PendingTasksMap* getPendingTasks();
 
-       Task* getPendingTask(const String& name);
+       Reference<Task* > getPendingTask(const String& name);
 
        bool containsPendingTask(const String& name);
 
@@ -1088,7 +1088,7 @@ public:
 
        virtual int getCountableObjectsRecursive();
 
-       Facade* getActiveSession(unsigned int type);
+       Reference<Facade* > getActiveSession(unsigned int type);
 
        void addActiveSession(unsigned int type, Facade* session);
 
@@ -1124,7 +1124,7 @@ public:
 
        int getActiveAreasSize();
 
-       ActiveArea* getActiveRegion();
+       Reference<ActiveArea* > getActiveRegion();
 
        virtual ManagedWeakReference<CityRegion* > getCityRegion();
 
@@ -1675,7 +1675,7 @@ public:
 
        int getCountableObjectsRecursive();
 
-       Facade* getActiveSession(unsigned int type);
+       Reference<Facade* > getActiveSession(unsigned int type);
 
        void addActiveSession(unsigned int type, Facade* session);
 
@@ -1705,7 +1705,7 @@ public:
 
        int getActiveAreasSize();
 
-       ActiveArea* getActiveRegion();
+       Reference<ActiveArea* > getActiveRegion();
 
        Zone* getZone();
 
index dc5c0d0..512a33f 100644 (file)
@@ -773,6 +773,7 @@ class SceneObject extends QuadTreeEntry implements Logger {
         */
        @local
        @read
+       @reference
        public Task getPendingTask(final string name) {
                synchronized (containerLock) {
                        if (pendingTasks == null)
@@ -803,6 +804,7 @@ class SceneObject extends QuadTreeEntry implements Logger {
         * Returns a Facade session
         */
        @read
+       @reference
        public Facade getActiveSession(unsigned int type) {
                return objectActiveSessions.get(type);
        }
@@ -911,6 +913,7 @@ class SceneObject extends QuadTreeEntry implements Logger {
        }
        
        @read
+       @reference
        public ActiveArea getActiveRegion() {
                synchronized (containerLock) {
                        for (int i = 0; i < activeAreas.size(); i++) {
index c43326d..d75bbbd 100644 (file)
@@ -163,7 +163,7 @@ void CraftingToolImplementation::fillAttributeList(AttributeListMessage* alm,
        alm->insertAttribute("craft_tool_status", status);
 
 
-       Reference<CraftingSession*> session = cast<CraftingSession*>(object->getActiveSession(SessionFacadeType::CRAFTING));
+       Reference<CraftingSession*> session = object->getActiveSession(SessionFacadeType::CRAFTING).castTo<CraftingSession*>();
        if(session == NULL && getParent() != NULL) {
                disperseItems();
        }
index b8e0a8e..4bf10bc 100644 (file)
@@ -102,7 +102,7 @@ int SurveyToolImplementation::handleObjectMenuSelect(CreatureObject* player, byt
 
                        Locker locker(_this.get());
 
-                       ManagedReference<SurveySession*> session = cast<SurveySession*>(player->getActiveSession(SessionFacadeType::SURVEY));
+                       ManagedReference<SurveySession*> session = player->getActiveSession(SessionFacadeType::SURVEY).castTo<SurveySession*>();
                        if(session == NULL) {
                                session = new SurveySession(player);
                                session->initializeSession(_this.get());
index 55b8cec..5433822 100644 (file)
@@ -126,16 +126,7 @@ void TargaBitmap::readObject(ObjectInputStream* stream) {
 
        for (int i = header.width - 1; i >= 0; --i) {
                for (int j = 0; j < header.height; ++j) {
-                       switch (header.datatypecode) {
-                       case 3:
-                               pixelData[i * header.width + j]->read(stream, read);
-                               break;
-                       case 2:
-                               pixelData[i * header.width + j]->read(stream, read);
-                               break;
-                       default:
-                               break;
-                       }
+                       pixelData[i * header.width + j]->read(stream, read);
                }
        }
 }
index 1eeb8ec..0c8abd1 100644 (file)
@@ -45,14 +45,14 @@ public:
        void run() {
                ManagedReference<CreatureObject*> player = cast<CreatureObject*>( client->getPlayer().get().get());
 
-               Reference<CraftingSession*> session = cast<CraftingSession*>(player->getActiveSession(SessionFacadeType::CRAFTING));
+               Reference<CraftingSession*> session = player->getActiveSession(SessionFacadeType::CRAFTING).castTo<CraftingSession*>();
 
                if(session == NULL) {
                        warning("Trying to add an ingredient when no session exists");
                        return;
                }
 
-               ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(player->getActiveSession(SessionFacadeType::TRADE));
+               ManagedReference<TradeSession*> tradeContainer = player->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
                if (tradeContainer != NULL) {
                        server->getZoneServer()->getPlayerManager()->handleAbortTradeMessage(player);
index 21ad0f1..4a11ad2 100644 (file)
@@ -67,7 +67,7 @@ public:
        void run() {
                ManagedReference<CreatureObject*> player = static_cast<CreatureObject*>(client->getPlayer().get().get());
 
-               Reference<CraftingSession*> session = cast<CraftingSession*>(player->getActiveSession(SessionFacadeType::CRAFTING));
+               Reference<CraftingSession*> session = player->getActiveSession(SessionFacadeType::CRAFTING).castTo<CraftingSession*>();
 
                if(session == NULL) {
                        warning("Trying to customize when no session exists");
index 73de62a..f0a3592 100644 (file)
@@ -54,14 +54,14 @@ public:
        void run() {
                ManagedReference<CreatureObject*> player = static_cast<CreatureObject*>(client->getPlayer().get().get());
 
-               Reference<CraftingSession*> session = cast<CraftingSession*>(player->getActiveSession(SessionFacadeType::CRAFTING));
+               Reference<CraftingSession*> session = player->getActiveSession(SessionFacadeType::CRAFTING).castTo<CraftingSession*>();
 
                if(session == NULL) {
                        warning("Trying to experiment when no session exists");
                        return;
                }
 
-               ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(player->getActiveSession(SessionFacadeType::TRADE));
+               ManagedReference<TradeSession*> tradeContainer = player->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
                if (tradeContainer != NULL) {
                        server->getZoneServer()->getPlayerManager()->handleAbortTradeMessage(player);
index b5a575a..f32a3bb 100644 (file)
@@ -45,14 +45,14 @@ public:
                if (player == NULL)
                        return;
 
-               Reference<CraftingSession*> session = cast<CraftingSession*>(player->getActiveSession(SessionFacadeType::CRAFTING));
+               Reference<CraftingSession*> session = player->getActiveSession(SessionFacadeType::CRAFTING).castTo<CraftingSession*>();
 
                if(session == NULL) {
                        warning("Trying to add an ingredient when no session exists");
                        return;
                }
 
-               ManagedReference<TradeSession*> tradeContainer = dynamic_cast<TradeSession*>(player->getActiveSession(SessionFacadeType::TRADE));
+               ManagedReference<TradeSession*> tradeContainer = player->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
                if (tradeContainer != NULL) {
                        server->getZoneServer()->getPlayerManager()->handleAbortTradeMessage(player);
index bd98f90..a66ab2d 100644 (file)
@@ -46,7 +46,7 @@ public:
                CreatureObject* targetPlayer = cast<CreatureObject*>( targetObject.get());
                PlayerObject* ghost = player->getPlayerObject();
 
-               ManagedReference<TradeSession*> playerTradeContainer = dynamic_cast<TradeSession*>(player->getActiveSession(SessionFacadeType::TRADE));
+               ManagedReference<TradeSession*> playerTradeContainer = player->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
                if (player->isInCombat() || (playerTradeContainer != NULL && playerTradeContainer->getTradeTargetPlayer() == targetToTrade))
                        return;
@@ -62,7 +62,7 @@ public:
 
                PlayerObject* targetGhost = targetPlayer->getPlayerObject();
 
-               ManagedReference<TradeSession*> targetTradeContainer = dynamic_cast<TradeSession*>(targetPlayer->getActiveSession(SessionFacadeType::TRADE));
+               ManagedReference<TradeSession*> targetTradeContainer = targetPlayer->getActiveSession(SessionFacadeType::TRADE).castTo<TradeSession*>();
 
                if (targetTradeContainer != NULL && targetTradeContainer->getTradeTargetPlayer() == player->getObjectID()) {
                        BeginTradeMessage* msg = new BeginTradeMessage(targetPlayer->getObjectID());
index 19940d6..3839432 100644 (file)
@@ -219,7 +219,7 @@ public:
                        screenToSave = NULL;
                }
 
-               ConversationSession* session = cast<ConversationSession* >(player->getActiveSession(SessionFacadeType::CONVERSATION));
+               Reference<ConversationSession*> session = player->getActiveSession(SessionFacadeType::CONVERSATION).castTo<ConversationSession* >();
                if (session != NULL) {
                        session->setLastConversationScreen(screenToSave);
                }