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

Show
Ignore:
Timestamp:
11/21/08 08:47:55 (17 years ago)
Author:
yumileroy
Message:

*DB script table stucture change. Source Mangos. Also fix some bugs. Hopefully this rev will make program usable again.

Original author: megamage
Date: 2008-11-20 10:43:20-06:00

Files:
1 modified

Legend:

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

    r229 r260  
    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 
     54enum ShutdownExitCode 
     55{ 
     56    SHUTDOWN_EXIT_CODE = 0, 
     57    ERROR_EXIT_CODE    = 1, 
     58    RESTART_EXIT_CODE  = 2, 
     59}; 
     60 
    5461/// Timers for different object refresh rates 
    5562enum WorldTimers 
     
    6269    WUPDATE_CORPSES     = 5, 
    6370    WUPDATE_EVENTS      = 6, 
    64     WUPDATE_COUNT       = 7, 
    65  
     71    WUPDATE_COUNT       = 7 
    6672}; 
    6773 
     
    106112    CONFIG_INSTANCE_IGNORE_RAID, 
    107113    CONFIG_BATTLEGROUND_CAST_DESERTER, 
     114    CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE, 
     115    CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY, 
    108116    CONFIG_INSTANCE_RESET_TIME_HOUR, 
    109117    CONFIG_INSTANCE_UNLOAD_DELAY, 
     
    144152    CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF, 
    145153    CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF, 
     154    CONFIG_DETECT_POS_COLLISION, 
    146155    CONFIG_RESTRICTED_LFG_CHANNEL, 
    147156    CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL, 
     
    317326struct CliCommandHolder 
    318327{ 
    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; } 
     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; } 
    333342}; 
    334343 
     
    337346{ 
    338347    public: 
    339         static volatile bool m_stopEvent; 
    340348        static volatile uint32 m_worldLoopCounter; 
    341349 
     
    345353        WorldSession* FindSession(uint32 id) const; 
    346354        void AddSession(WorldSession *s); 
    347  
    348355        bool RemoveSession(uint32 id); 
    349356        /// Get the number of current active sessions 
     
    408415        void LoadConfigSettings(bool reload = false); 
    409416 
    410         void SendWorldText(int32 string_id, ...);  
     417        void SendWorldText(int32 string_id, ...); 
    411418        void SendGlobalMessage(WorldPacket *packet, WorldSession *self = 0, uint32 team = 0); 
    412419        void SendZoneMessage(uint32 zone, WorldPacket *packet, WorldSession *self = 0, uint32 team = 0); 
     
    415422 
    416423        /// Are we in the middle of a shutdown? 
    417         uint32 GetShutdownMask() const { return m_ShutdownMask; } 
    418424        bool IsShutdowning() const { return m_ShutdownTimer > 0; } 
    419         void ShutdownServ(uint32 time, uint32 options = 0); 
     425        void ShutdownServ(uint32 time, uint32 options, uint8 exitcode); 
    420426        void ShutdownCancel(); 
    421427        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; } 
    422431 
    423432        void Update(time_t diff); 
     
    454463        void KickAllQueued(); 
    455464        BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author); 
    456                 bool RemoveBanAccount(BanMode mode, std::string nameOrIP); 
     465        bool RemoveBanAccount(BanMode mode, std::string nameOrIP); 
    457466 
    458467        void ScriptsStart(std::map<uint32, std::multimap<uint32, ScriptInfo> > const& scripts, uint32 id, Object* source, Object* target); 
     
    482491        LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const { if(m_availableDbcLocaleMask & (1 << locale)) return locale; else return m_defaultDbcLocale; } 
    483492 
    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(); } 
     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(); } 
    491500 
    492501    protected: 
     
    499508        void ResetDailyQuests(); 
    500509    private: 
     510        static volatile bool m_stopEvent; 
     511        static uint8 m_ExitCode; 
     512        uint32 m_ShutdownTimer; 
     513        uint32 m_ShutdownMask; 
     514 
    501515        time_t m_startTime; 
    502516        time_t m_gameTime; 
     
    526540        std::set<uint32> m_forbiddenMapIds; 
    527541 
    528         uint32 m_ShutdownTimer; 
    529         uint32 m_ShutdownMask; 
    530  
    531542        // for max speed access 
    532543        static float m_MaxVisibleDistanceForCreature; 
     
    546557        //Player Queue 
    547558        Queue m_QueuedPlayer; 
    548          
     559 
    549560        //sessions that are added async 
    550561        void AddSession_(WorldSession* s); 
    551562        ZThread::LockedQueue<WorldSession*, ZThread::FastMutex> addSessQueue; 
    552563 
    553                 //used versions 
    554                 std::string m_DBVersion; 
    555                 std::string m_ScriptsVersion; 
     564        //used versions 
     565        std::string m_DBVersion; 
     566        std::string m_ScriptsVersion; 
    556567}; 
    557568