Changeset 3194

Show
Ignore:
Timestamp:
03/03/2010 01:37:14 PM (6 months ago)
Author:
jackpoz
Message:

MODIFIED: Added some more notifications when an invalid faction is assigned to Units And GameObjects?. This fixes some crashes related to invalid factions, too.
MODIFIED: Some code cleanup.

Location:
trunk/src/arcemu-world
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/arcemu-world/Creature.cpp

    r3193 r3194  
    12941294        m_aiInterface->timed_emotes = objmgr.GetTimedEmoteList(spawn->id); 
    12951295 
    1296         m_faction = dbcFactionTemplate.LookupEntryForced(spawn->factionid); 
    1297         if(m_faction) 
    1298         { 
    1299                 m_factionDBC = dbcFaction.LookupEntry(m_faction->Faction); 
    1300                 // not a neutral creature 
    1301                 if(!(m_factionDBC->RepListId == -1 && m_faction->HostileMask == 0 && m_faction->FriendlyMask == 0)) 
    1302                 { 
    1303                         GetAIInterface()->m_canCallForHelp = true; 
    1304                 } 
     1296        // not a neutral creature 
     1297        if(!(m_factionDBC->RepListId == -1 && m_faction->HostileMask == 0 && m_faction->FriendlyMask == 0)) 
     1298        { 
     1299                GetAIInterface()->m_canCallForHelp = true; 
    13051300        } 
    13061301 
     
    15251520        m_position.ChangeCoords( x, y, z, o ); 
    15261521        m_spawnLocation.ChangeCoords(x, y, z, o); 
    1527         m_faction = dbcFactionTemplate.LookupEntryForced(proto->Faction); 
    1528  
    1529         if(m_faction) 
    1530         { 
    1531                 m_factionDBC = dbcFaction.LookupEntry(m_faction->Faction); 
    1532                 // not a neutral creature 
    1533                 if(!(m_factionDBC->RepListId == -1 && m_faction->HostileMask == 0 && m_faction->FriendlyMask == 0)) 
    1534                 { 
    1535                         GetAIInterface()->m_canCallForHelp = true; 
    1536                 } 
     1522 
     1523        // not a neutral creature 
     1524        if(!(m_factionDBC->RepListId == -1 && m_faction->HostileMask == 0 && m_faction->FriendlyMask == 0)) 
     1525        { 
     1526                GetAIInterface()->m_canCallForHelp = true; 
    15371527        } 
    15381528 
  • trunk/src/arcemu-world/GameObject.cpp

    r3174 r3194  
    457457        { 
    458458                SetFaction(spawn->faction); 
    459                 m_faction = dbcFactionTemplate.LookupEntryForced(spawn->faction); 
    460                 if(m_faction) 
    461                         m_factionDBC = dbcFaction.LookupEntry(m_faction->Faction); 
    462459        } 
    463460        SetScale( spawn->scale); 
  • trunk/src/arcemu-world/GameObject.h

    r3171 r3194  
    330330        float GetParentRotation( uint8 rot ) { return GetFloatValue(GAMEOBJECT_PARENTROTATION+rot); } 
    331331 
    332         void SetFaction( uint32 id ) { SetUInt32Value(GAMEOBJECT_FACTION, id); } 
     332        void SetFaction( uint32 id )  
     333        {  
     334                SetUInt32Value(GAMEOBJECT_FACTION, id);  
     335                _setFaction(); 
     336        } 
    333337        uint32 GetFaction() { return GetUInt32Value(GAMEOBJECT_FACTION); } 
    334338 
  • trunk/src/arcemu-world/Object.cpp

    r3186 r3194  
    15511551                factT = dbcFactionTemplate.LookupEntryForced(TO_UNIT(this)->GetFaction()); 
    15521552                if( !factT ) 
    1553                         sLog.outDetail("Unit does not have a valid faction. It will make him act stupid in world. Don't blame us, blame yourself for not checking :P, faction %u set to entry %u",TO_UNIT(this)->GetFaction(),GetEntry() ); 
     1553                        sLog.outError("Unit does not have a valid faction. It will make him act stupid in world. Don't blame us, blame yourself for not checking :P, faction %u set to entry %u",TO_UNIT(this)->GetFaction(),GetEntry() ); 
    15541554        } 
    15551555        else 
     
    15581558                factT = dbcFactionTemplate.LookupEntryForced(static_cast<GameObject*>(this)->GetFaction()); 
    15591559                if( !factT ) 
    1560                         sLog.outDetail("Game Object does not have a valid faction. It will make him act stupid in world. Don't blame us, blame yourself for not checking :P, faction %u set to entry %u",static_cast<GameObject*>(this)->GetFaction(),GetEntry() ); 
     1560                        sLog.outError("Game Object does not have a valid faction. It will make him act stupid in world. Don't blame us, blame yourself for not checking :P, faction %u set to entry %u",static_cast<GameObject*>(this)->GetFaction(),GetEntry() ); 
    15611561        } 
    15621562 
  • trunk/src/arcemu-world/SpellEffects.cpp

    r3185 r3194  
    41874187                        p->SetFaction(proto->Faction ); 
    41884188                } 
    4189  
    4190                 p->m_faction = dbcFactionTemplate.LookupEntryForced(proto->Faction); 
    4191                 if(p->m_faction) 
    4192                         p->m_factionDBC = dbcFaction.LookupEntry(p->m_faction->Faction); 
    41934189                p->PushToWorld(u_caster->GetMapMgr()); 
    41944190                //make sure they will be desummoned (roxor)