void CampTerminalMenuComponent::disbandCamp(SceneObject* sceneObject,
		CreatureObject* player) const {

	Terminal* terminal = cast<Terminal*>(sceneObject);
	if(terminal == NULL) {
		error("Terminal is null in disbandCamp");
		return;
	}

	if (!player->isInRange(terminal, 16)) {
		return;
	}

	StructureObject* camp = cast<StructureObject*>(terminal->getControlledObject());
	if(camp == NULL) {
		error("Camp is null in disbandCamp");
		return;
	}

	if (camp->getZone() == NULL)
		return;

	PlayerObject* ghost = player->getPlayerObject();

	if (ghost == NULL) {
		return;
	}

	if (!ghost->isOwnedStructure(camp)) {
		return;
	}

	if(player->isSitting()) {
		player->setPosture(CreaturePosture::UPRIGHT, true);
	}

	// Find Camp Area
	SortedVector<ManagedReference<ActiveArea* > >* areas = camp->getActiveAreas();
	ManagedReference<ActiveArea*> area = NULL;
	for(int i = 0; i < areas->size(); ++i) {
		area = areas->get(i);
		if(area->isCampArea()) {
			break;
		}
		area == NULL;
	}

	CampSiteActiveArea* campArea = cast<CampSiteActiveArea*>(area.get());
	if(campArea != NULL && campArea->despawnCamp())
		return;

	StructureManager::instance()->destroyStructure(camp);

	if(campArea != NULL) {
		campArea->destroyObjectFromWorld(true);
		campArea->destroyObjectFromDatabase(true);
	}
}
void DroidMaintenanceModuleDataComponent::getStructureList(Vector<ManagedReference<StructureObject* > >* list,ZoneServer* srv, uint32 planet) {
	for (int i = 0; i < assignedStructures.size(); i++) {
		uint64 objectId = assignedStructures.elementAt(i);
		ManagedReference<SceneObject*> obj = srv->getObject(objectId);
		if( obj != NULL && obj->isStructureObject() ){
			StructureObject* structureObject = cast<StructureObject*>(obj.get());
			if( structureObject != NULL ){
				// is it on this planet?
				if (structureObject->getZone()->getZoneCRC() == planet) {
					list->add(structureObject);
				} else {
					if (moduleRating >= 12) // ratign 12 min for interplanetary
						list->add(structureObject);
				}
			}
		}
	}
}
bool DroidMaintenanceModuleDataComponent::isValidStructure(uint64 objectID){

	ManagedReference<DroidObject*> droid = getDroidObject();
	if( droid == NULL ) {
		return false;
	}

	ManagedReference<SceneObject*> obj = droid->getZoneServer()->getObject(objectID);
	if( obj == NULL ) {
		return false;
	}

	if( !obj->isStructureObject() ) {
		return false;
	}
	// we need to check for more than structure we need to check for factories and harvestors as well.
	StructureObject* structureObject = cast<StructureObject*>(obj.get());
	if( structureObject == NULL ) {
		return false;
	}

	ManagedWeakReference< CreatureObject*> linkedCreature = droid->getLinkedCreature();
	if( linkedCreature == NULL ) {
		return false;
	}

	if( !structureObject->isOnAdminList( linkedCreature.get() ) ) {
		return false;
	}

	if( structureObject->getZone() == NULL ) {
		return false;
	}

	// All checks passed
	return true;

}