Changeset 272 for trunk/src/game/World.h
- Timestamp:
- 11/22/08 00:35:41 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/World.h
r260 r272 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. 13 * 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 ShutdownExitCode55 {56 SHUTDOWN_EXIT_CODE = 0,57 ERROR_EXIT_CODE = 1,58 RESTART_EXIT_CODE = 2,59 };60 61 54 /// Timers for different object refresh rates 62 55 enum WorldTimers … … 69 62 WUPDATE_CORPSES = 5, 70 63 WUPDATE_EVENTS = 6, 71 WUPDATE_COUNT = 7 64 WUPDATE_COUNT = 7, 65 72 66 }; 73 67 … … 112 106 CONFIG_INSTANCE_IGNORE_RAID, 113 107 CONFIG_BATTLEGROUND_CAST_DESERTER, 114 CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE,115 CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY,116 108 CONFIG_INSTANCE_RESET_TIME_HOUR, 117 109 CONFIG_INSTANCE_UNLOAD_DELAY, … … 152 144 CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF, 153 145 CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF, 154 CONFIG_DETECT_POS_COLLISION,155 146 CONFIG_RESTRICTED_LFG_CHANNEL, 156 147 CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL, … … 326 317 struct CliCommandHolder 327 318 { 328 329 330 331 332 333 334 335 336 337 338 339 340 341 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; } 342 333 }; 343 334 … … 346 337 { 347 338 public: 339 static volatile bool m_stopEvent; 348 340 static volatile uint32 m_worldLoopCounter; 349 341 … … 353 345 WorldSession* FindSession(uint32 id) const; 354 346 void AddSession(WorldSession *s); 347 355 348 bool RemoveSession(uint32 id); 356 349 /// Get the number of current active sessions … … 415 408 void LoadConfigSettings(bool reload = false); 416 409 417 void SendWorldText(int32 string_id, ...); 410 void SendWorldText(int32 string_id, ...); 418 411 void SendGlobalMessage(WorldPacket *packet, WorldSession *self = 0, uint32 team = 0); 419 412 void SendZoneMessage(uint32 zone, WorldPacket *packet, WorldSession *self = 0, uint32 team = 0); … … 422 415 423 416 /// Are we in the middle of a shutdown? 417 uint32 GetShutdownMask() const { return m_ShutdownMask; } 424 418 bool IsShutdowning() const { return m_ShutdownTimer > 0; } 425 void ShutdownServ(uint32 time, uint32 options , uint8 exitcode);419 void ShutdownServ(uint32 time, uint32 options = 0); 426 420 void ShutdownCancel(); 427 421 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; }431 422 432 423 void Update(time_t diff); … … 463 454 void KickAllQueued(); 464 455 BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author); 465 456 bool RemoveBanAccount(BanMode mode, std::string nameOrIP); 466 457 467 458 void ScriptsStart(std::map<uint32, std::multimap<uint32, ScriptInfo> > const& scripts, uint32 id, Object* source, Object* target); … … 491 482 LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const { if(m_availableDbcLocaleMask & (1 << locale)) return locale; else return m_defaultDbcLocale; } 492 483 493 494 495 496 497 498 499 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(); } 500 491 501 492 protected: … … 508 499 void ResetDailyQuests(); 509 500 private: 510 static volatile bool m_stopEvent;511 static uint8 m_ExitCode;512 uint32 m_ShutdownTimer;513 uint32 m_ShutdownMask;514 515 501 time_t m_startTime; 516 502 time_t m_gameTime; … … 540 526 std::set<uint32> m_forbiddenMapIds; 541 527 528 uint32 m_ShutdownTimer; 529 uint32 m_ShutdownMask; 530 542 531 // for max speed access 543 532 static float m_MaxVisibleDistanceForCreature; … … 557 546 //Player Queue 558 547 Queue m_QueuedPlayer; 559 548 560 549 //sessions that are added async 561 550 void AddSession_(WorldSession* s); 562 551 ZThread::LockedQueue<WorldSession*, ZThread::FastMutex> addSessQueue; 563 552 564 565 566 553 //used versions 554 std::string m_DBVersion; 555 std::string m_ScriptsVersion; 567 556 }; 568 557