Changeset 237 for trunk

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

[svn] DynamicObject? should only be visible for caster if it is not in distance. However, I do not think this will fix the bug that dynamic object update freezes the server.

Original author: megamage
Date: 2008-11-15 11:56:59-06:00

Location:
trunk/src
Files:
7 modified

Legend:

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

    r233 r237  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    7171    } 
    7272 
    73     SetUInt32Value( OBJECT_FIELD_ENTRY, spellId ); 
     73    SetEntry(spellId); 
    7474    SetFloatValue( OBJECT_FIELD_SCALE_X, 1 ); 
    7575    SetUInt64Value( DYNAMICOBJECT_CASTER, caster->GetGUID() ); 
     
    154154bool DynamicObject::isVisibleForInState(Player const* u, bool inVisibleList) const 
    155155{ 
    156     return IsInWorld() && u->IsInWorld() /*&& IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f))*/; 
     156    return IsInWorld() && u->IsInWorld()  
     157        && (IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f)) 
     158        || GetCasterGUID() == u->GetGUID()); 
    157159} 
  • trunk/src/game/ObjectAccessor.cpp

    r233 r237  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    613613            (cell_min.y_coord <= p.y_coord && p.y_coord <= cell_max.y_coord) ) 
    614614            return true; 
    615  
    616615    } 
    617616 
  • trunk/src/trinitycore/CliRunnable.cpp

    r112 r237  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    5252    printf(temp_buf); 
    5353#else 
    54         printf(str); 
     54    printf(str); 
    5555#endif 
    5656} 
     
    119119    } 
    120120 
    121         return true; 
     121    return true; 
    122122} 
    123123 
     
    127127        return false; 
    128128 
    129         char *character_name_str = strtok((char*)args," "); 
     129    char *character_name_str = strtok((char*)args," "); 
    130130    if(!character_name_str) 
    131                 return false; 
     131        return false; 
    132132 
    133133    std::string character_name = character_name_str; 
    134134    if(!normalizePlayerName(character_name)) 
    135                 return false; 
     135        return false; 
    136136 
    137137    uint64 character_guid; 
    138138    uint32 account_id; 
    139139 
    140         Player *player = objmgr.GetPlayer(character_name.c_str()); 
     140    Player *player = objmgr.GetPlayer(character_name.c_str()); 
    141141    if(player) 
    142142    { 
     
    158158    } 
    159159 
    160         std::string account_name; 
     160    std::string account_name; 
    161161    accmgr.GetName (account_id,account_name); 
    162162 
    163     Player::DeleteFromDB(character_guid, account_id, true);  
     163    Player::DeleteFromDB(character_guid, account_id, true); 
    164164    PSendSysMessage(LANG_CHARACTER_DELETED,character_name.c_str(),GUID_LOPART(character_guid),account_name.c_str(), account_id); 
    165165    return true; 
     
    171171    SendSysMessage(LANG_COMMAND_EXIT); 
    172172    World::m_stopEvent = true; 
    173         return true; 
     173    return true; 
    174174} 
    175175 
     
    228228    char *szPassword = strtok(NULL, " "); 
    229229    if(!szAcc || !szPassword) 
    230                 return false; 
     230        return false; 
    231231 
    232232    // normilized in accmgr.CreateAccount 
     
    257257            return false; 
    258258    } 
    259          
    260         return true; 
     259 
     260    return true; 
    261261} 
    262262 
     
    269269    char *NewLevel = strtok((char*)args, " "); 
    270270    if (!NewLevel) 
    271                 return false; 
     271        return false; 
    272272 
    273273    sLog.SetLogLevel(NewLevel); 
    274         return true; 
     274    return true; 
    275275} 
    276276 
     
    326326            for(int x=0;command_str[x];x++) 
    327327                if(command_str[x]=='\r'||command_str[x]=='\n') 
    328                                 { 
    329                                         command_str[x]=0; 
    330                                         break; 
    331                                 } 
    332  
    333                         if(!*command_str) 
     328            { 
     329                command_str[x]=0; 
     330                break; 
     331            } 
     332 
     333 
     334            if(!*command_str) 
    334335            { 
    335336                printf("TC>"); 
     
    347348        } 
    348349        else if (feof(stdin)) 
     350        { 
    349351            World::m_stopEvent = true; 
     352        } 
    350353    } 
    351354 
  • trunk/src/trinitycore/Main.cpp

    r102 r237  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    138138        return 1; 
    139139    } 
    140  
    141140    sLog.outString("Using configuration file %s.", cfg_file); 
    142141     
  • trunk/src/trinitycore/Master.cpp

    r149 r237  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    8484            //DEBUG_LOG("anti-freeze: time=%u, counters=[%u; %u]",curtime,Master::m_masterLoopCounter,World::m_worldLoopCounter); 
    8585 
    86             // There is no Master anymore  
    87             // TODO: clear the rest of the code  
     86            // There is no Master anymore 
     87            // TODO: clear the rest of the code 
    8888//            // normal work 
    8989//            if(m_loops != Master::m_masterLoopCounter) 
     
    9292//                m_loops = Master::m_masterLoopCounter; 
    9393//            } 
    94 //            // possible freeze  
     94//            // possible freeze 
    9595//            else if(getMSTimeDiff(m_lastchange,curtime) > _delaytime) 
    9696//            { 
     
    105105                w_loops = World::m_worldLoopCounter; 
    106106            } 
    107             // possible freeze  
     107            // possible freeze 
    108108            else if(getMSTimeDiff(w_lastchange,curtime) > _delaytime) 
    109109            { 
     
    251251        ZThread::Thread td1(new CliRunnable); 
    252252    } 
    253      
     253 
    254254    ZThread::Thread td2(new RARunnable); 
    255255 
     
    329329 
    330330    sWorldSocketMgr->Wait (); 
    331      
     331 
    332332    // set server offline 
    333333    loginDatabase.PExecute("UPDATE realmlist SET color = 2 WHERE id = '%d'",realmID); 
     
    340340    t.wait(); 
    341341    td2.wait (); 
    342      
     342 
    343343    ///- Clean database before leaving 
    344344    clearOnlineAccounts(); 
     
    460460    sWorld.LoadDBVersion(); 
    461461 
    462         sLog.outString("Using %s", sWorld.GetDBVersion()); 
     462    sLog.outString("Using %s", sWorld.GetDBVersion()); 
    463463    return true; 
    464464} 
     
    472472        "UPDATE account SET online = 0 WHERE online > 0 " 
    473473        "AND id IN (SELECT acctid FROM realmcharacters WHERE realmid = '%d')",realmID); 
    474      
     474 
    475475 
    476476    CharacterDatabase.Execute("UPDATE characters SET online = 0"); 
  • trunk/src/trinitycore/RASocket.cpp

    r149 r237  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    198198 
    199199                    QueryResult *check = loginDatabase.PQuery( 
    200                                                 "SELECT 1 FROM account WHERE username = '%s' AND sha_pass_hash=SHA1(CONCAT(username,':','%s'))", 
    201                                                 login.c_str(), pw.c_str()); 
     200                        "SELECT 1 FROM account WHERE username = '%s' AND sha_pass_hash=SHA1(CONCAT(username,':','%s'))", 
     201                        login.c_str(), pw.c_str()); 
    202202 
    203203                    if(check) 
     
    245245    #ifdef RA_CRYPT 
    246246 
    247         char *megabuffer=strdup(szText); 
     247    char *megabuffer=strdup(szText); 
    248248    unsigned int sz=strlen(megabuffer); 
    249249    Encrypt(megabuffer,sz); 
    250         send(r,megabuffer,sz,0); 
     250    send(r,megabuffer,sz,0); 
    251251    delete [] megabuffer; 
    252      
    253         #else 
     252 
     253    #else 
    254254 
    255255    unsigned int sz=strlen(szText); 
  • trunk/src/trinitycore/WorldRunnable.cpp

    r102 r237  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    7878    sWorld.KickAll();                                       // save and kick all players 
    7979    sWorld.UpdateSessions( 1 );                             // real players unload required UpdateSessions call 
    80      
     80 
    8181    sWorldSocketMgr->StopNetwork(); 
    8282