Changeset 260 for trunk/src/game/World.h
- Timestamp:
- 11/21/08 08:47:55 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/World.h
r229 r260 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 … … 52 52 }; 53 53 54 enum ShutdownExitCode 55 { 56 SHUTDOWN_EXIT_CODE = 0, 57 ERROR_EXIT_CODE = 1, 58 RESTART_EXIT_CODE = 2, 59 }; 60 54 61 /// Timers for different object refresh rates 55 62 enum WorldTimers … … 62 69 WUPDATE_CORPSES = 5, 63 70 WUPDATE_EVENTS = 6, 64 WUPDATE_COUNT = 7, 65 71 WUPDATE_COUNT = 7 66 72 }; 67 73 … … 106 112 CONFIG_INSTANCE_IGNORE_RAID, 107 113 CONFIG_BATTLEGROUND_CAST_DESERTER, 114 CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE, 115 CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY, 108 116 CONFIG_INSTANCE_RESET_TIME_HOUR, 109 117 CONFIG_INSTANCE_UNLOAD_DELAY, … … 144 152 CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF, 145 153 CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF, 154 CONFIG_DETECT_POS_COLLISION, 146 155 CONFIG_RESTRICTED_LFG_CHANNEL, 147 156 CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL, … … 317 326 struct CliCommandHolder 318 327 { 319 320 321 322 323 324 325 326 327 328 329 330 331 332 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; } 333 342 }; 334 343 … … 337 346 { 338 347 public: 339 static volatile bool m_stopEvent;340 348 static volatile uint32 m_worldLoopCounter; 341 349 … … 345 353 WorldSession* FindSession(uint32 id) const; 346 354 void AddSession(WorldSession *s); 347 348 355 bool RemoveSession(uint32 id); 349 356 /// Get the number of current active sessions … … 408 415 void LoadConfigSettings(bool reload = false); 409 416 410 void SendWorldText(int32 string_id, ...); 417 void SendWorldText(int32 string_id, ...); 411 418 void SendGlobalMessage(WorldPacket *packet, WorldSession *self = 0, uint32 team = 0); 412 419 void SendZoneMessage(uint32 zone, WorldPacket *packet, WorldSession *self = 0, uint32 team = 0); … … 415 422 416 423 /// Are we in the middle of a shutdown? 417 uint32 GetShutdownMask() const { return m_ShutdownMask; }418 424 bool IsShutdowning() const { return m_ShutdownTimer > 0; } 419 void ShutdownServ(uint32 time, uint32 options = 0);425 void ShutdownServ(uint32 time, uint32 options, uint8 exitcode); 420 426 void ShutdownCancel(); 421 427 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; } 422 431 423 432 void Update(time_t diff); … … 454 463 void KickAllQueued(); 455 464 BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author); 456 465 bool RemoveBanAccount(BanMode mode, std::string nameOrIP); 457 466 458 467 void ScriptsStart(std::map<uint32, std::multimap<uint32, ScriptInfo> > const& scripts, uint32 id, Object* source, Object* target); … … 482 491 LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const { if(m_availableDbcLocaleMask & (1 << locale)) return locale; else return m_defaultDbcLocale; } 483 492 484 485 486 487 488 489 490 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(); } 491 500 492 501 protected: … … 499 508 void ResetDailyQuests(); 500 509 private: 510 static volatile bool m_stopEvent; 511 static uint8 m_ExitCode; 512 uint32 m_ShutdownTimer; 513 uint32 m_ShutdownMask; 514 501 515 time_t m_startTime; 502 516 time_t m_gameTime; … … 526 540 std::set<uint32> m_forbiddenMapIds; 527 541 528 uint32 m_ShutdownTimer;529 uint32 m_ShutdownMask;530 531 542 // for max speed access 532 543 static float m_MaxVisibleDistanceForCreature; … … 546 557 //Player Queue 547 558 Queue m_QueuedPlayer; 548 559 549 560 //sessions that are added async 550 561 void AddSession_(WorldSession* s); 551 562 ZThread::LockedQueue<WorldSession*, ZThread::FastMutex> addSessQueue; 552 563 553 554 555 564 //used versions 565 std::string m_DBVersion; 566 std::string m_ScriptsVersion; 556 567 }; 557 568