Changeset 126

Show
Ignore:
Timestamp:
11/19/08 13:38:32 (17 years ago)
Author:
yumileroy
Message:

[svn] * Fixed startup error flood if creature model id is 0
* Fixed totems using proper model ids broken after recent change
* Set pet grid activity state to that of caster upon summoning
* Fix a possible crash in ObjectAccessor?
note to self: don't commit anything without 3 days testing. ever. after this one ofc.

Original author: w12x
Date: 2008-10-27 15:28:04-05:00

Location:
trunk/src/game
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/ObjectAccessor.cpp

    r120 r126  
    534534        std::set<WorldObject *> activeobjects(i_activeobjects); 
    535535 
    536         std::set<WorldObject *>::const_iterator itr; 
    537         for(itr = activeobjects.begin(); itr != activeobjects.end(); ++itr) 
    538         { 
    539             (*itr)->GetMap()->resetMarkedCells(); 
     536        std::set<WorldObject *>::iterator itr, next; 
     537        for(itr = activeobjects.begin(); itr != activeobjects.end(); itr = next) 
     538        { 
     539            next = itr; 
     540            ++next; 
     541            if((*itr)->IsInWorld()) 
     542                (*itr)->GetMap()->resetMarkedCells(); 
     543            else 
     544                activeobjects.erase(itr); 
    540545        } 
    541546 
  • trunk/src/game/ObjectMgr.cpp

    r123 r126  
    712712 
    713713        // check model ids, supplying and sending non-existent ids to the client might crash them 
    714         if(!sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid1)) 
     714        if(cInfo->Modelid1 && !sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid1)) 
    715715        { 
    716716            sLog.outErrorDb("Creature (Entry: %u) has non-existing modelId_A (%u), setting it to 0", cInfo->Entry, cInfo->Modelid1); 
    717717            const_cast<CreatureInfo*>(cInfo)->Modelid1 = 0; 
    718718        } 
    719         if(!sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid2)) 
     719        if(cInfo->Modelid2 && !sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid2)) 
    720720        { 
    721721            sLog.outErrorDb("Creature (Entry: %u) has non-existing modelId_A2 (%u), setting it to 0", cInfo->Entry, cInfo->Modelid2); 
    722722            const_cast<CreatureInfo*>(cInfo)->Modelid2 = 0; 
    723723        } 
    724         if(!sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid3)) 
     724        if(cInfo->Modelid3 && !sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid3)) 
    725725        { 
    726726            sLog.outErrorDb("Creature (Entry: %u) has non-existing modelId_H (%u), setting it to 0", cInfo->Entry, cInfo->Modelid3); 
    727727            const_cast<CreatureInfo*>(cInfo)->Modelid3 = 0; 
    728728        } 
    729         if(!sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid4)) 
     729        if(cInfo->Modelid4 && !sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid4)) 
    730730        { 
    731731            sLog.outErrorDb("Creature (Entry: %u) has non-existing modelId_H2 (%u), setting it to 0", cInfo->Entry, cInfo->Modelid4); 
  • trunk/src/game/Pet.h

    r120 r126  
    123123        void AddToWorld(); 
    124124        void RemoveFromWorld(); 
    125         // always active 
    126         void setActive() {} 
    127125 
    128126        PetType getPetType() const { return m_petType; } 
  • trunk/src/game/Player.h

    r120 r126  
    904904        void RemoveFromWorld(); 
    905905        // always active 
    906         void setActive() {} 
     906        void setActive(bool) {} 
    907907 
    908908        bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options = 0); 
  • trunk/src/game/SpellEffects.cpp

    r122 r126  
    31093109    uint32 level = m_caster->getLevel(); 
    31103110    Pet* spawnCreature = new Pet(SUMMON_PET); 
     3111    spawnCreature->setActive(m_caster->isActive()); 
    31113112 
    31123113    if(spawnCreature->LoadPetFromDB(m_caster,pet_entry)) 
     
    35443545    { 
    35453546        Pet* spawnCreature = new Pet(GUARDIAN_PET); 
     3547        spawnCreature->setActive(m_caster->isActive()); 
    35463548 
    35473549        Map *map = m_caster->GetMap(); 
     
    39383940 
    39393941    Pet* NewSummon = new Pet; 
     3942    NewSummon->setActive(m_caster->isActive()); 
    39403943 
    39413944    // petentry==0 for hunter "call pet" (current pet summoned if any) 
  • trunk/src/game/Totem.cpp

    r123 r126  
    6060    if (owner->GetTypeId()==TYPEID_PLAYER && cinfo) 
    6161    { 
    62         if (uint32 modelid = cinfo->GetRandomValidModelId())  
     62        uint32 modelid = 0; 
     63        if(((Player*)owner)->GetTeam() == HORDE) 
     64        { 
     65            if(cinfo->Modelid3) 
     66                modelid = cinfo->Modelid3; 
     67            else if(cinfo->Modelid4) 
     68                modelid = cinfo->Modelid4; 
     69        } 
     70        else 
     71        { 
     72            if(cinfo->Modelid1) 
     73                modelid = cinfo->Modelid1; 
     74            else if(cinfo->Modelid2) 
     75                modelid = cinfo->Modelid2; 
     76        } 
     77        if (modelid) 
    6378            SetDisplayId(modelid); 
    6479        else 
    65         { 
    66             sLog.outErrorDb("No displayid found for the totem with the entry %u! Can't summon it!", GetEntry()); 
    67             return; 
    68         } 
     80            sLog.outErrorDb("Totem::Summon: Missing modelid information for entry %u, team %u, totem will use default values.",GetEntry(),((Player*)owner)->GetTeam()); 
    6981    } 
    7082