本文整理汇总了C++中ZoneServer::isServerLoading方法的典型用法代码示例。如果您正苦于以下问题:C++ ZoneServer::isServerLoading方法的具体用法?C++ ZoneServer::isServerLoading怎么用?C++ ZoneServer::isServerLoading使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZoneServer
的用法示例。
在下文中一共展示了ZoneServer::isServerLoading方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: notifyLoadFromDatabase
void StructureObjectImplementation::notifyLoadFromDatabase() {
TangibleObjectImplementation::notifyLoadFromDatabase();
if (structurePermissionList.getOwner() != getOwnerObjectID()) {
structurePermissionList.setOwner(getOwnerObjectID());
}
if (permissionsFixed == false) {
ManagedReference<StructureObject*> structure = _this.getReferenceUnsafeStaticCast();
EXECUTE_TASK_1(structure, {
ZoneServer* zoneServer = structure_p->getZoneServer();
if (zoneServer == NULL) {
return;
}
if (zoneServer->isServerLoading()) {
this->reschedule(5000);
return;
}
Locker locker(structure_p);
structure_p->migratePermissions();
});
示例2: broadcastDestroyPrivate
void SceneObjectImplementation::broadcastDestroyPrivate(SceneObject* object, SceneObject* selfObject) {
ZoneServer* zoneServer = getZoneServer();
if (zoneServer != NULL && zoneServer->isServerLoading())
return;
if (parent.get() != NULL) {
ManagedReference<SceneObject*> grandParent = getRootParent().get();
if (grandParent != NULL) {
grandParent->broadcastDestroyPrivate(object, selfObject);
return;
} else {
return;
}
}
if (zone == NULL)
return;
SortedVector<ManagedReference<QuadTreeEntry*> > closeSceneObjects;
int maxInRangeObjectCount = 0;
if (closeobjects == NULL) {
info("Null closeobjects vector in SceneObjectImplementation::broadcastDestroyPrivate", true);
zone->getInRangeObjects(getPositionX(), getPositionY(), 256, &closeSceneObjects, true);
maxInRangeObjectCount = closeSceneObjects.size();
} else {
CloseObjectsVector* vec = (CloseObjectsVector*) closeobjects;
closeSceneObjects.removeAll(vec->size(), 10);
vec->safeCopyTo(closeSceneObjects);
maxInRangeObjectCount = closeSceneObjects.size();
}
for (int i = 0; i < maxInRangeObjectCount; ++i) {
SceneObject* scno = static_cast<SceneObject*>(closeSceneObjects.get(i).get());
ManagedReference<ZoneClientSession*> client = scno->getClient();
if (scno->isVehicleObject() || client != NULL || scno->isMount()) {
object->sendDestroyTo(scno);
}
}
}
示例3: run
void ScreenPlayTask::run() {
ZoneServer* zoneServer = ServerCore::getZoneServer();
if (zoneServer == NULL || zoneServer->isServerShuttingDown())
return;
if (zoneServer->isServerLoading()) {
schedule(10000);
return;
}
ManagedReference<SceneObject*> obj = this->obj.get();
if (obj != NULL) {
Locker locker(obj);
DirectorManager::instance()->activateEvent(this);
} else {
DirectorManager::instance()->activateEvent(this);
}
setTaskName(String("ScreenPlayTask " + screenPlay + ":" + taskKey + ":" + args).toCharArray());
}
示例4: run
void StructureMaintenanceTask::run() {
ManagedReference<StructureObject*> strongRef = structureObject.get();
if (strongRef == NULL)
return;
ZoneServer* zoneServer = strongRef->getZoneServer();
if (zoneServer != NULL && zoneServer->isServerLoading()) {
schedule(1000);
return;
}
ManagedReference<CreatureObject*> owner = strongRef->getOwnerCreatureObject();
if (owner == NULL || !owner->isPlayerCreature()) {
info("Player structure has NULL owner, destroying.", true);
StructureManager::instance()->destroyStructure(strongRef);
return;
}
ManagedReference<PlayerObject*> ghost = owner->getPlayerObject();
if (ghost == NULL) {
info("Player structure has NULL owner ghost, destroying.", true);
StructureManager::instance()->destroyStructure(strongRef);
return;
}
if (!ghost->isOwnedStructure(strongRef)) {
info("Removing orphaned structure.", true);
StructureManager::instance()->destroyStructure(strongRef);
return;
}
if (strongRef->getSurplusMaintenance() > 0) {
//Incorrect scheduling, reschedule.
Locker locker(strongRef);
strongRef->scheduleMaintenanceExpirationEvent();
return;
}
Locker _ownerLock(owner);
Locker _lock(strongRef, owner);
//Structure is out of maintenance. Start the decaying process...
strongRef->updateStructureStatus();
//Calculate one week of maintenance +- any existing maintenance/decay.
int oneWeekMaintenance = 7 * 24 * strongRef->getMaintenanceRate() - strongRef->getSurplusMaintenance();
// add city tax to the week maintenance
ManagedReference<CityRegion*> city = strongRef->getCityRegion();
if(strongRef->isBuildingObject() && city != NULL){
oneWeekMaintenance += city->getPropertyTax() / 100.0f * oneWeekMaintenance;
}
//Check if owner got money in the bank and structure not decaying.
if (owner->getBankCredits() >= oneWeekMaintenance) {
//Withdraw 1 week maintenance from owner bank account and add to the structure
//maintenance pool.
strongRef->payMaintenance(oneWeekMaintenance, owner, false);
//Send email notification to owner.
sendMailMaintenanceWithdrawnFromBank(owner, strongRef);
//Reschedule task in 1 week.
strongRef->scheduleMaintenanceExpirationEvent();
} else {
//Start decay process.
//Notify owner about decay.
sendMailDecay(owner, strongRef);
if (!strongRef->isDecayed()) {
//Reschedule task in 1 day.
reschedule(oneDayTime);
} else {
if (strongRef->isBuildingObject() && !shouldBuildingBeDestroyed(strongRef)) {
BuildingObject* building = strongRef.castTo<BuildingObject*>();
//Building is condemned since it has decayed.
sendMailCondemned(owner, strongRef);
strongRef->info("Structure decayed, it is now condemned.");
building->updateSignName(true);
} else {
strongRef->info("Structure decayed, destroying it.");
StructureManager::instance()->destroyStructure(strongRef);
}
}
}
}
示例5: broadcastMessagesPrivate
void SceneObjectImplementation::broadcastMessagesPrivate(Vector<BasePacket*>* messages, SceneObject* selfObject) {
ZoneServer* zoneServer = getZoneServer();
if (zoneServer != NULL && zoneServer->isServerLoading())
return;
if (parent.get() != NULL) {
ManagedReference<SceneObject*> grandParent = cast<SceneObject*>(getRootParent().get().get());
if (grandParent != NULL) {
grandParent->broadcastMessagesPrivate(messages, selfObject);
return;
} else {
while (!messages->isEmpty()) {
delete messages->remove(0);
}
return;
}
}
if (zone == NULL) {
while (!messages->isEmpty()) {
delete messages->remove(0);
}
return;
}
//getZone()->rlock();
//Locker zoneLocker(zone);
bool readlock = !zone->isLockedByCurrentThread();
SortedVector<ManagedReference<QuadTreeEntry*> > closeSceneObjects;
int maxInRangeObjectCount = 0;
// zone->rlock(readlock);
try {
if (closeobjects == NULL) {
info(String::valueOf(getObjectID()) + " Null closeobjects vector in SceneObjectImplementation::broadcastMessagesPrivate", true);
zone->getInRangeObjects(getPositionX(), getPositionY(), 192, &closeSceneObjects, true);
maxInRangeObjectCount = closeSceneObjects.size();
} else {
maxInRangeObjectCount = closeobjects->size();
closeSceneObjects.removeAll(maxInRangeObjectCount, 10);
//closeSceneObjects.addAll(*closeobjects);
closeobjects->safeCopyTo(closeSceneObjects);
maxInRangeObjectCount = closeSceneObjects.size();
}
} catch (Exception& e) {
}
//getZone()->runlock();
//zoneLocker.release();
// zone->runlock(readlock);
for (int i = 0; i < maxInRangeObjectCount; ++i) {
SceneObject* scno = cast<SceneObject*>(closeSceneObjects.get(i).get());
if (selfObject == scno)
continue;
ManagedReference<ZoneClientSession*> client = scno->getClient();
if (scno->isVehicleObject() || client != NULL || scno->isMount()) {
for (int j = 0; j < messages->size(); ++j) {
BasePacket* msg = messages->get(j);
scno->sendMessage(msg->clone());
}
}
}
while (!messages->isEmpty()) {
delete messages->remove(0);
}
}
示例6: broadcastMessagePrivate
void SceneObjectImplementation::broadcastMessagePrivate(BasePacket* message, SceneObject* selfObject, bool lockZone) {
ZoneServer* zoneServer = getZoneServer();
if (zoneServer != NULL && zoneServer->isServerLoading())
return;
if (parent.get() != NULL) {
ManagedReference<SceneObject*> grandParent = cast<SceneObject*>(getRootParent().get().get());
if (grandParent != NULL) {
grandParent->broadcastMessagePrivate(message, selfObject, lockZone);
return;
} else {
delete message;
return;
}
}
if (zone == NULL) {
delete message;
return;
}
//Locker zoneLocker(zone);
//getZone()->rlock(lockZone);
// bool readlock = lockZone && !zone->isLockedByCurrentThread();
SortedVector<ManagedReference<QuadTreeEntry*> >* closeSceneObjects = NULL;
SortedVector<ManagedReference<QuadTreeEntry*> >* closeNoneReference = NULL;
int maxInRangeObjectCount = 0;
bool deleteVector = true;
try {
// zone->rlock(readlock);
if (closeobjects == NULL) {
info(String::valueOf(getObjectID()) + " Null closeobjects vector in SceneObjectImplementation::broadcastMessagePrivate", true);
closeSceneObjects = new SortedVector<ManagedReference<QuadTreeEntry*> >();
zone->getInRangeObjects(getPositionX(), getPositionY(), 192, closeSceneObjects, true);
maxInRangeObjectCount = closeSceneObjects->size();
deleteVector = true;
} else {
// maxInRangeObjectCount = closeobjects->size();
//closeSceneObjects = closeobjects;
closeNoneReference = new SortedVector<ManagedReference<QuadTreeEntry*> >(maxInRangeObjectCount, 50);
/* for (int i = 0; i < closeobjects->size(); ++i) {
closeNoneReference->add(closeobjects->get(i).get());
}
*/
closeobjects->safeCopyTo(*closeNoneReference);
maxInRangeObjectCount = closeNoneReference->size();
//closeSceneObjects.removeAll(maxInRangeObjectCount, 10);
//closeSceneObjects.addAll(*closeobjects);
}
/*
for (int i = 0; i < maxInRangeObjectCount; ++i) {
SceneObject* scno = cast<SceneObject*>(closeSceneObjects->get(i).get());
if (selfObject == scno)
continue;
ManagedReference<ZoneClientSession*> client = scno->getClient();
if (client != NULL || scno->isVehicleObject()) {
scno->sendMessage(message->clone());
}
}
*/
//zone->runlock(readlock);
} catch (...) {
// zone->runlock(readlock);
delete message;
throw;
}
for (int i = 0; i < maxInRangeObjectCount; ++i) {
SceneObject* scno;
if (closeSceneObjects != NULL)
scno = cast<SceneObject*>(closeSceneObjects->get(i).get());
else
scno = cast<SceneObject*>(closeNoneReference->get(i).get());
//.........这里部分代码省略.........
示例7: broadcastDestroyPrivate
void SceneObjectImplementation::broadcastDestroyPrivate(SceneObject* object, SceneObject* selfObject) {
ZoneServer* zoneServer = getZoneServer();
if (zoneServer != NULL && zoneServer->isServerLoading())
return;
if (parent.get() != NULL) {
ManagedReference<SceneObject*> grandParent = cast<SceneObject*>(getRootParent().get().get());
if (grandParent != NULL) {
grandParent->broadcastDestroyPrivate(object, selfObject);
return;
} else {
return;
}
}
if (zone == NULL)
return;
//Locker zoneLocker(zone);
// bool readlock = !zone->isLockedByCurrentThread();
SortedVector<ManagedReference<QuadTreeEntry*> > closeSceneObjects;
int maxInRangeObjectCount = 0;
// zone->rlock(readlock);
try {
if (closeobjects == NULL) {
info("Null closeobjects vector in SceneObjectImplementation::broadcastDestroyPrivate", true);
zone->getInRangeObjects(getPositionX(), getPositionY(), 256, &closeSceneObjects, true);
maxInRangeObjectCount = closeSceneObjects.size();
} else {
CloseObjectsVector* vec = (CloseObjectsVector*) closeobjects;
closeSceneObjects.removeAll(vec->size(), 10);
// closeSceneObjects.addAll(*closeobjects);
vec->safeCopyTo(closeSceneObjects);
maxInRangeObjectCount = closeSceneObjects.size();//closeobjects->size();
}
} catch (...) {
//zone->runlock(readlock);
throw;
}
// zone->runlock(readlock);
for (int i = 0; i < maxInRangeObjectCount; ++i) {
SceneObject* scno = cast<SceneObject*>(closeSceneObjects.get(i).get());
if (selfObject == scno)
continue;
ManagedReference<ZoneClientSession*> client = scno->getClient();
if (scno->isVehicleObject() || client != NULL || scno->isMount()) {
object->sendDestroyTo(scno);
}
}
}
示例8: broadcastMessagePrivate
void SceneObjectImplementation::broadcastMessagePrivate(BasePacket* message, SceneObject* selfObject, bool lockZone) {
ZoneServer* zoneServer = getZoneServer();
if (zoneServer != NULL && zoneServer->isServerLoading())
return;
if (parent.get() != NULL) {
ManagedReference<SceneObject*> grandParent = getRootParent().get();
if (grandParent != NULL) {
grandParent->broadcastMessagePrivate(message, selfObject, lockZone);
return;
} else {
delete message;
return;
}
}
if (zone == NULL) {
delete message;
return;
}
SortedVector<ManagedReference<QuadTreeEntry*> >* closeSceneObjects = NULL;
SortedVector<ManagedReference<QuadTreeEntry*> >* closeNoneReference = NULL;
int maxInRangeObjectCount = 0;
bool deleteVector = true;
try {
if (closeobjects == NULL) {
info(String::valueOf(getObjectID()) + " Null closeobjects vector in SceneObjectImplementation::broadcastMessagePrivate", true);
closeSceneObjects = new SortedVector<ManagedReference<QuadTreeEntry*> >();
zone->getInRangeObjects(getPositionX(), getPositionY(), 192, closeSceneObjects, true);
maxInRangeObjectCount = closeSceneObjects->size();
deleteVector = true;
} else {
closeNoneReference = new SortedVector<ManagedReference<QuadTreeEntry*> >(maxInRangeObjectCount, 50);
closeobjects->safeCopyTo(*closeNoneReference);
maxInRangeObjectCount = closeNoneReference->size();
}
} catch (Exception& e) {
error(e.getMessage());
e.printStackTrace();
delete message;
throw;
} catch (...) {
delete message;
throw;
}
for (int i = 0; i < maxInRangeObjectCount; ++i) {
SceneObject* scno;
if (closeSceneObjects != NULL)
scno = static_cast<SceneObject*>(closeSceneObjects->get(i).get());
else
scno = static_cast<SceneObject*>(closeNoneReference->get(i).get());
ManagedReference<ZoneClientSession*> client = scno->getClient();
if (scno->isVehicleObject() || client != NULL || scno->isMount())
scno->sendMessage(message->clone());
}
delete message;
if (closeSceneObjects != NULL)
delete closeSceneObjects;
else
delete closeNoneReference;
}