Skip to content

Instantly share code, notes, and snippets.

@Emtec
Created January 11, 2010 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Emtec/274545 to your computer and use it in GitHub Desktop.
Save Emtec/274545 to your computer and use it in GitHub Desktop.
diff --git a/src/game/World.cpp b/src/game/World.cpp
index c6e978b..0395494 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -1871,6 +1871,12 @@ void World::KickAll()
itr->second->KickPlayer();
}
+// Reset active_realm_id from account table
+void World::ResetRealmId()
+{
+ loginDatabase.PQuery("UPDATE account SET active_realmd_id=0 WHERE active_realm_id = %d", realmID);
+}
+
/// Kick (and save) all players with security level less `sec`
void World::KickAllLess(AccountTypes sec)
{
diff --git a/src/game/World.h b/src/game/World.h
index 336fabc..f7703a2 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -495,6 +495,7 @@ class World
bool IsFFAPvPRealm() { return getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP; }
void KickAll();
+ void ResetRealmId();
void KickAllLess(AccountTypes sec);
BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author);
bool RemoveBanAccount(BanMode mode, std::string nameOrIP);
diff --git a/src/mangosd/WorldRunnable.cpp b/src/mangosd/WorldRunnable.cpp
index 28c4bf8..c628e6d 100644
--- a/src/mangosd/WorldRunnable.cpp
+++ b/src/mangosd/WorldRunnable.cpp
@@ -79,6 +79,7 @@ void WorldRunnable::run()
}
sWorld.KickAll(); // save and kick all players
+ sWorld.ResetRealmId(); // reset id realm from account (active_realm_id column)
sWorld.UpdateSessions( 1 ); // real players unload required UpdateSessions call
// unload battleground templates before different singletons destroyed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment