Exemple #1
0
void CellFactory::handleObjectReady(Object* object,DispatchClient* client)
{
    InLoadingContainer* ilc = _getObject(object->getParentId());

    if (! ilc) {//Crashbug fix: http://paste.swganh.org/viewp.php?id=20100627114151-8f7df7f74013af71c0d0b00bc240770d
        LOG(warning) << "Could not locate InLoadingContainer for object parent id [" << object->getParentId() << "]";
        return;
    }

    CellObject*			cell = dynamic_cast<CellObject*>(ilc->mObject);

    gWorldManager->addObject(object,true);


    switch(object->getType())
    {
    case ObjType_NPC:
    case ObjType_Creature:
    {
        CreatureObject* creature = dynamic_cast<CreatureObject*>(object);

        if(creature->getCreoGroup() == CreoGroup_Shuttle)
            gWorldManager->addShuttle(dynamic_cast<Shuttle*>(creature));
    }
    break;

    case ObjType_Tangible:
    {
        PlayerStructureTerminal* terminal = dynamic_cast<PlayerStructureTerminal*>(object);
        if(terminal)
        {
            terminal->setStructure(cell->getParentId());
        }
    }
    break;

    case ObjType_Building:
    case ObjType_Cell:
    case ObjType_DraftSchematic:
    case ObjType_Structure:
    case ObjType_Intangible:
    case ObjType_Lair:
    case ObjType_Mission:
    case ObjType_None:
    case ObjType_NonPersistant:
    case ObjType_Player:
    case ObjType_Region:

    case ObjType_Waypoint:
    default:
        break;
    }

	auto permissions_objects_ = gObjectManager->GetPermissionsMap();
			
	object->SetPermissions(permissions_objects_.find(swganh::object::DEFAULT_PERMISSION)->second.get());//CREATURE_PERMISSION

	gObjectManager->LoadSlotsForObject(object);
	cell->InitializeObject(object);
	cell->incLoad();

	//LOG(info) << "cellFactory::handleObjectReady -> cell load stuff" << object->getId() << "for " << cell->getId();
	//LOG(info) << "loadcount : " << cell->getLoadCount() << " : count : " << cell->getLoad();

	if(cell->getLoadCount() == cell->getLoad())
    {
		//LOG(info) << "cellFactory::handleObjectReady -> cell done " << cell->getId();

        if(!(_removeFromObjectLoadMap(cell->getId())))
            LOG(warning) << "Failed removing object from loadmap";

        ilc->mOfCallback->handleObjectReady(cell,ilc->mClient);

        mILCPool.free(ilc);
    }
}
Exemple #2
0
void CellFactory::handleObjectReady(Object* object,DispatchClient* client)
{
    InLoadingContainer* ilc = _getObject(object->getParentId());

    if (! ilc) {//Crashbug fix: http://paste.swganh.org/viewp.php?id=20100627114151-8f7df7f74013af71c0d0b00bc240770d
        gLogger->log(LogManager::WARNING,"CellFactory::handleObjectReady could not locate ILC for objectParentId:%I64u",object->getParentId());
        return;
    }

    CellObject*			cell = dynamic_cast<CellObject*>(ilc->mObject);

    gWorldManager->addObject(object,true);

    switch(object->getType())
    {
    case ObjType_NPC:
    case ObjType_Creature:
    {
        CreatureObject* creature = dynamic_cast<CreatureObject*>(object);

        if(creature->getCreoGroup() == CreoGroup_Shuttle)
            gWorldManager->addShuttle(dynamic_cast<Shuttle*>(creature));
    }
    break;

    case ObjType_Tangible:
    {
        PlayerStructureTerminal* terminal = dynamic_cast<PlayerStructureTerminal*>(object);
        if(terminal)
        {
            terminal->setStructure(cell->getParentId());
        }
    }
    break;

    case ObjType_Building:
    case ObjType_Cell:
    case ObjType_DraftSchematic:
    case ObjType_Structure:
    case ObjType_Intangible:
    case ObjType_Lair:
    case ObjType_Mission:
    case ObjType_None:
    case ObjType_NonPersistant:
    case ObjType_Player:
    case ObjType_Region:

    case ObjType_Waypoint:
    default:
        break;
    }

    cell->addObjectSecure(object);

    if(cell->getLoadCount() == cell->getObjects()->size())
    {
        if(!(_removeFromObjectLoadMap(cell->getId())))
            gLogger->log(LogManager::DEBUG,"CellFactory: Failed removing object from loadmap");

        ilc->mOfCallback->handleObjectReady(cell,ilc->mClient);

        mILCPool.free(ilc);
    }
}