Instructions Jenkins Doxygen

[Fixed] clone activation request now verifies that a location is 75/1075/2
authorIvojedi <ivojedi@swgemu.com>
Wed, 6 Nov 2013 19:44:43 +0000 (11:44 -0800)
committerIvojedi <ivojedi@swgemu.com>
Wed, 6 Nov 2013 20:05:40 +0000 (12:05 -0800)
actually a valid cloning facility before offering it as closest facility

Change-Id: I1cd17d881a947e4c6821fe208f7076c7246e14ec

MMOCoreORB/src/server/zone/managers/player/PlayerManagerImplementation.cpp

index 57163c4..1cde9fc 100644 (file)
@@ -715,41 +715,46 @@ void PlayerManagerImplementation::sendActivateCloneRequest(CreatureObject* playe
        String closestName = "None";
        ManagedReference<CityRegion*> cr = closestCloning->getCityRegion();
        unsigned long long playerID = player->getObjectID();
+       CloningBuildingObjectTemplate* cbot = cast<CloningBuildingObjectTemplate*>(closestCloning->getObjectTemplate());
 
-       if (cr != NULL) {
-               //Check if player is city banned where the closest facility is
-               if (cr->isBanned(playerID)) {
-                       int distance = 50000;
-                       for (int j = 0; j < locations.size(); j++) {
-                               ManagedReference<SceneObject*> location = locations.get(j);
+       //Check if player is city banned where the closest facility is or if it's not a valid cloner
+       if ((cr != NULL && cr->isBanned(playerID)) || cbot == NULL) {
+               int distance = 50000;
+               for (int j = 0; j < locations.size(); j++) {
+                       ManagedReference<SceneObject*> location = locations.get(j);
 
-                               if (location == NULL)
-                                       continue;
+                       if (location == NULL)
+                               continue;
 
-                               cr = location->getCityRegion();
-                               String name;
+                       cbot = cast<CloningBuildingObjectTemplate*>(location->getObjectTemplate());
 
-                               if (cr != NULL) {
-                                       if (cr->isBanned(playerID))
-                                               continue;
+                       if (cbot == NULL)
+                               continue;
 
-                                       name = cr->getRegionName();
-                               } else {
-                                       name = location->getDisplayedName();
-                               }
+                       cr = location->getCityRegion();
+                       String name;
 
-                               if (location->getDistanceTo(player) < distance) {
-                                       distance = location->getDistanceTo(player);
-                                       closestName = name;
-                                       closestCloning = location;
-                               }
+                       if (cr != NULL) {
+                               if (cr->isBanned(playerID))
+                                       continue;
+
+                               name = cr->getRegionName();
+                       } else {
+                               name = location->getDisplayedName();
+                       }
+
+                       if (location->getDistanceTo(player) < distance) {
+                               distance = location->getDistanceTo(player);
+                               closestName = name;
+                               closestCloning = location;
                        }
-               } else {
-                       closestName = cr->getRegionName();
                }
 
        } else {
-               closestName = closestCloning->getDisplayedName();
+               if (cr != NULL)
+                       closestName = cr->getRegionName();
+               else
+                       closestName = closestCloning->getDisplayedName();
        }
 
        StringBuffer promptText;