Changeset 290 for trunk

Show
Ignore:
Timestamp:
11/22/08 16:14:42 (17 years ago)
Author:
yumileroy
Message:

*Update to Mangos 6842. Source: Mangos.

Original author: megamage
Date: 2008-11-22 09:51:35-06:00

Location:
trunk/src/game
Files:
5 modified

Legend:

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

    r279 r290  
    4545#include "SpellAuras.h" 
    4646#include "Util.h" 
     47#include "WaypointManager.h" 
    4748 
    4849INSTANTIATE_SINGLETON_1(ObjectMgr); 
     
    74727473    CheckScripts(sEventScripts,ids); 
    74737474 
     7475    WaypointMgr.CheckTextsExistance(ids); 
     7476 
    74747477    for(std::set<int32>::const_iterator itr = ids.begin(); itr != ids.end(); ++itr) 
    74757478        sLog.outErrorDb( "Table `db_script_string` has unused string id  %u", *itr); 
  • trunk/src/game/Player.cpp

    r284 r290  
    10171017    CheckExploreSystem(); 
    10181018 
     1019    /*if(isCharmed()) 
     1020    { 
     1021        if(Unit *charmer = GetCharmer()) 
     1022            if(charmer->GetTypeId() == TYPEID_UNIT && ((Creature*)charmer)->AI()) 
     1023                ((Creature*)charmer)->AI()->UpdateCharmedAI(this, p_time); 
     1024    }*/ 
     1025 
    10191026    // Update items that have just a limited lifetime 
    10201027    if (now>m_Last_tick) 
     
    52675274        y = GetPositionY(); 
    52685275        z = GetPositionZ(); 
     5276 
     5277        // group update 
     5278        if(GetGroup() && (old_x != x || old_y != y)) 
     5279            SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION); 
    52695280    } 
    52705281 
     
    52735284 
    52745285    CheckExploreSystem(); 
    5275  
    5276     // group update 
    5277     if(GetGroup()) 
    5278         SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION); 
    52795286 
    52805287    return true; 
  • trunk/src/game/Unit.cpp

    r288 r290  
    96239623void Unit::SetPower(Powers power, uint32 val) 
    96249624{ 
     9625    if(GetPower(power) == val) 
     9626        return; 
     9627 
    96259628    uint32 maxPower = GetMaxPower(power); 
    96269629    if(maxPower < val) 
  • trunk/src/game/WaypointManager.cpp

    r279 r290  
    125125            be.spell            = fields[8].GetUInt32(); 
    126126 
    127             // load and store without holes in array 
    128             int j = 0; 
    129127            for(int i = 0; i < MAX_WAYPOINT_TEXT; ++i) 
    130128            { 
    131                 be.textid[j]        = fields[9+i].GetUInt32(); 
    132                 if(be.textid[j]) 
     129                be.textid[i]        = fields[9+i].GetUInt32(); 
     130                if(be.textid[i]) 
    133131                { 
    134                     if (be.textid[j] < MIN_DB_SCRIPT_STRING_ID || be.textid[j] >= MAX_DB_SCRIPT_STRING_ID) 
     132                    if (be.textid[i] < MIN_DB_SCRIPT_STRING_ID || be.textid[i] >= MAX_DB_SCRIPT_STRING_ID) 
    135133                    { 
    136                         sLog.outErrorDb( "Table `db_script_string` not have string id  %u", be.textid[j]); 
     134                        sLog.outErrorDb( "Table `db_script_string` not have string id  %u", be.textid[i]); 
    137135                        continue; 
    138136                    } 
    139  
    140                     if (!objmgr.GetTrinityStringLocale (be.textid[j])) 
    141                     { 
    142                         sLog.outErrorDb("ERROR: Waypoint path %d (point %d), have invalid text id (%i) in `textid%d, ignored.", 
    143                             id, point, be.textid[j], i+1); 
    144                         continue; 
    145                     } 
    146  
    147                     ++j;                                    // to next internal field 
    148137                } 
    149138            } 
    150             // fill array tail 
    151             for(; j < MAX_WAYPOINT_TEXT; ++j) 
    152                 be.textid[j] = 0; 
    153139 
    154140            // save memory by not storing empty behaviors 
     
    309295    } 
    310296} 
     297 
     298void WaypointManager::CheckTextsExistance(std::set<int32>& ids) 
     299{ 
     300    WaypointPathMap::iterator pmItr = m_pathMap.begin(); 
     301    for ( ; pmItr != m_pathMap.end(); ++pmItr) 
     302    { 
     303        for (int i = 0; i < pmItr->second.size(); ++i) 
     304        { 
     305            if (!pmItr->second[i].behavior) 
     306                continue; 
     307 
     308            // Now we check text existence and put all zero texts ids to the end of array 
     309 
     310            // Counting leading zeros for futher textid shift 
     311            int zeroCount = 0; 
     312            for (int j = 0; j < MAX_WAYPOINT_TEXT; ++j) 
     313            { 
     314                if (!pmItr->second[i].behavior->textid[j]) 
     315                { 
     316                    ++zeroCount; 
     317                    continue; 
     318                } 
     319                else 
     320                { 
     321                    if (!objmgr.GetMangosStringLocale(pmItr->second[i].behavior->textid[j])) 
     322                    { 
     323                        sLog.outErrorDb("ERROR: Some waypoint has textid%u with not existing %u text.", j, pmItr->second[i].behavior->textid[j]); 
     324                        pmItr->second[i].behavior->textid[j] = 0; 
     325                        ++zeroCount; 
     326                        continue; 
     327                    } 
     328                    else 
     329                        ids.erase(pmItr->second[i].behavior->textid[j]); 
     330 
     331                    // Shifting check 
     332                    if (zeroCount) 
     333                    { 
     334                        // Correct textid but some zeros leading, so move it forward. 
     335                        pmItr->second[i].behavior->textid[j-zeroCount] = pmItr->second[i].behavior->textid[j]; 
     336                        pmItr->second[i].behavior->textid[j] = 0; 
     337                    } 
     338                } 
     339            } 
     340        } 
     341    } 
     342} 
  • trunk/src/game/WaypointManager.h

    r279 r290  
    7979        void SetNodePosition(uint32 id, uint32 point, float x, float y, float z); 
    8080        void SetNodeText(uint32 id, uint32 point, const char *text_field, const char *text); 
     81        void CheckTextsExistance(std::set<int32>& ids); 
    8182 
    8283    private: