Changeset 272 for trunk/src/game/World.h

Show
Ignore:
Timestamp:
11/22/08 00:35:41 (17 years ago)
Author:
yumileroy
Message:

Delete possessed AI only on creature delete.

Original author: gvcoman
Date: 2008-11-16 14:38:02-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/World.h

    r260 r272  
    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}; 
    5353 
    54 enum ShutdownExitCode 
    55 { 
    56     SHUTDOWN_EXIT_CODE = 0, 
    57     ERROR_EXIT_CODE    = 1, 
    58     RESTART_EXIT_CODE  = 2, 
    59 }; 
    60  
    6154/// Timers for different object refresh rates 
    6255enum WorldTimers 
     
    6962    WUPDATE_CORPSES     = 5, 
    7063    WUPDATE_EVENTS      = 6, 
    71     WUPDATE_COUNT       = 7 
     64    WUPDATE_COUNT       = 7, 
     65 
    7266}; 
    7367 
     
    112106    CONFIG_INSTANCE_IGNORE_RAID, 
    113107    CONFIG_BATTLEGROUND_CAST_DESERTER, 
    114     CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE, 
    115     CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY, 
    116108    CONFIG_INSTANCE_RESET_TIME_HOUR, 
    117109    CONFIG_INSTANCE_UNLOAD_DELAY, 
     
    152144    CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF, 
    153145    CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF, 
    154     CONFIG_DETECT_POS_COLLISION, 
    155146    CONFIG_RESTRICTED_LFG_CHANNEL, 
    156147    CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL, 
     
    326317struct CliCommandHolder 
    327318{ 
    328     typedef void Print(const char*); 
    329  
    330     char *m_command; 
    331     Print* m_print; 
    332  
    333     CliCommandHolder(const char *command, Print* zprint) 
    334         : m_print(zprint) 
    335     { 
    336         size_t len = strlen(command)+1; 
    337         m_command = new char[len]; 
    338         memcpy(m_command, command, len); 
    339     } 
    340  
    341     ~CliCommandHolder() { delete[] m_command; } 
     319        typedef void Print(const char*); 
     320 
     321        char *m_command; 
     322        Print* m_print; 
     323 
     324        CliCommandHolder(const char *command, Print* zprint) 
     325                : m_print(zprint) 
     326        { 
     327                size_t len = strlen(command)+1; 
     328                m_command = new char[len]; 
     329                memcpy(m_command, command, len); 
     330        } 
     331 
     332        ~CliCommandHolder() { delete[] m_command; } 
    342333}; 
    343334 
     
    346337{ 
    347338    public: 
     339        static volatile bool m_stopEvent; 
    348340        static volatile uint32 m_worldLoopCounter; 
    349341 
     
    353345        WorldSession* FindSession(uint32 id) const; 
    354346        void AddSession(WorldSession *s); 
     347 
    355348        bool RemoveSession(uint32 id); 
    356349        /// Get the number of current active sessions 
     
    415408        void LoadConfigSettings(bool reload = false); 
    416409 
    417         void SendWorldText(int32 string_id, ...); 
     410        void SendWorldText(int32 string_id, ...);  
    418411        void SendGlobalMessage(WorldPacket *packet, WorldSession *self = 0, uint32 team = 0); 
    419412        void SendZoneMessage(uint32 zone, WorldPacket *packet, WorldSession *self = 0, uint32 team = 0); 
     
    422415 
    423416        /// Are we in the middle of a shutdown? 
     417        uint32 GetShutdownMask() const { return m_ShutdownMask; } 
    424418        bool IsShutdowning() const { return m_ShutdownTimer > 0; } 
    425         void ShutdownServ(uint32 time, uint32 options, uint8 exitcode); 
     419        void ShutdownServ(uint32 time, uint32 options = 0); 
    426420        void ShutdownCancel(); 
    427421        void ShutdownMsg(bool show = false, Player* player = NULL); 
    428         static uint8 GetExitCode() { return m_ExitCode; } 
    429         static void StopNow(uint8 exitcode) { m_stopEvent = true; m_ExitCode = exitcode; } 
    430         static bool IsStopped() { return m_stopEvent; } 
    431422 
    432423        void Update(time_t diff); 
     
    463454        void KickAllQueued(); 
    464455        BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author); 
    465         bool RemoveBanAccount(BanMode mode, std::string nameOrIP); 
     456                bool RemoveBanAccount(BanMode mode, std::string nameOrIP); 
    466457 
    467458        void ScriptsStart(std::map<uint32, std::multimap<uint32, ScriptInfo> > const& scripts, uint32 id, Object* source, Object* target); 
     
    491482        LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const { if(m_availableDbcLocaleMask & (1 << locale)) return locale; else return m_defaultDbcLocale; } 
    492483 
    493         //used World DB version 
    494         void LoadDBVersion(); 
    495         char const* GetDBVersion() { return m_DBVersion.c_str(); } 
    496  
    497         //used Script version 
    498         void SetScriptsVersion(char const* version) { m_ScriptsVersion = version ? version : "unknown scripting library"; } 
    499         char const* GetScriptsVersion() { return m_ScriptsVersion.c_str(); } 
     484                //used World DB version 
     485                void LoadDBVersion(); 
     486                char const* GetDBVersion() { return m_DBVersion.c_str(); } 
     487 
     488                //used Script version 
     489                void SetScriptsVersion(char const* version) { m_ScriptsVersion = version ? version : "unknown scripting library"; } 
     490                char const* GetScriptsVersion() { return m_ScriptsVersion.c_str(); } 
    500491 
    501492    protected: 
     
    508499        void ResetDailyQuests(); 
    509500    private: 
    510         static volatile bool m_stopEvent; 
    511         static uint8 m_ExitCode; 
    512         uint32 m_ShutdownTimer; 
    513         uint32 m_ShutdownMask; 
    514  
    515501        time_t m_startTime; 
    516502        time_t m_gameTime; 
     
    540526        std::set<uint32> m_forbiddenMapIds; 
    541527 
     528        uint32 m_ShutdownTimer; 
     529        uint32 m_ShutdownMask; 
     530 
    542531        // for max speed access 
    543532        static float m_MaxVisibleDistanceForCreature; 
     
    557546        //Player Queue 
    558547        Queue m_QueuedPlayer; 
    559  
     548         
    560549        //sessions that are added async 
    561550        void AddSession_(WorldSession* s); 
    562551        ZThread::LockedQueue<WorldSession*, ZThread::FastMutex> addSessQueue; 
    563552 
    564         //used versions 
    565         std::string m_DBVersion; 
    566         std::string m_ScriptsVersion; 
     553                //used versions 
     554                std::string m_DBVersion; 
     555                std::string m_ScriptsVersion; 
    567556}; 
    568557