From ea930108da9a877a467ed1a7fa3e754b84b9aa05 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 8 Jan 2011 03:12:15 +0300 Subject: [PATCH] [10983] Config option for disable progress bar show at server startup. Make happy nervouse ppl by some secs startup speedup. --- src/mangosd/Main.cpp | 4 ++++ src/mangosd/mangosd.conf.dist.in | 6 ++++++ src/shared/ProgressBar.cpp | 16 ++++++++++++++-- src/shared/ProgressBar.h | 28 ++++++++++++++++------------ src/shared/revision_nr.h | 2 +- 5 files changed, 41 insertions(+), 15 deletions(-) diff --git a/src/mangosd/Main.cpp b/src/mangosd/Main.cpp index dfdd654f0..b41292991 100644 --- a/src/mangosd/Main.cpp +++ b/src/mangosd/Main.cpp @@ -23,6 +23,7 @@ #include "Common.h" #include "Database/DatabaseEnv.h" #include "Config/Config.h" +#include "ProgressBar.h" #include "Log.h" #include "Master.h" #include "SystemConfig.h" @@ -174,6 +175,9 @@ extern int main(int argc, char **argv) DETAIL_LOG("Using ACE: %s", ACE_VERSION); + ///- Set progress bars show mode + barGoLink::SetOutputState(sConfig.GetBoolDefault("ShowProgressBars", true)); + ///- and run the 'Master' /// \todo Why do we need this 'Master'? Can't all of this be in the Main as for Realmd? return sMaster.Run(); diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index 4e0e6dfc5..9a9c5f090 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -699,6 +699,11 @@ LogColors = "" # Default: 1 (true) # 0 (false) # +# ShowProgressBars +# Control show progress bars for load steps at server startup +# Default: 1 (true) +# 0 (false) +# # WaitAtStartupError # After startup error report wait or some time before continue (and possible close console window) # -1 (wait until press) @@ -772,6 +777,7 @@ PetUnsummonAtMount = 1 ClientCacheVersion = 0 Event.Announce = 0 BeepAtStart = 1 +ShowProgressBars = 1 WaitAtStartupError = 0 Motd = "Welcome to the Massive Network Game Object Server." diff --git a/src/shared/ProgressBar.cpp b/src/shared/ProgressBar.cpp index 965db2f1d..8ac6c26c7 100644 --- a/src/shared/ProgressBar.cpp +++ b/src/shared/ProgressBar.cpp @@ -20,6 +20,8 @@ #include "ProgressBar.h" +bool barGoLink::m_showOutput = true; + char const* const barGoLink::empty = " "; #ifdef _WIN32 char const* const barGoLink::full = "\x3D"; @@ -29,16 +31,23 @@ char const* const barGoLink::full = "*"; barGoLink::~barGoLink() { + if (!m_showOutput) + return; + printf( "\n" ); fflush(stdout); } -barGoLink::barGoLink( int row_count ) +barGoLink::barGoLink(int row_count) { rec_no = 0; rec_pos = 0; indic_len = 50; num_rec = row_count; + + if (!m_showOutput) + return; + #ifdef _WIN32 printf( "\x3D" ); #else @@ -53,8 +62,11 @@ barGoLink::barGoLink( int row_count ) fflush(stdout); } -void barGoLink::step( void ) +void barGoLink::step() { + if (!m_showOutput) + return; + int i, n; if ( num_rec == 0 ) return; diff --git a/src/shared/ProgressBar.h b/src/shared/ProgressBar.h index 05748e088..eb3768d87 100644 --- a/src/shared/ProgressBar.h +++ b/src/shared/ProgressBar.h @@ -22,18 +22,22 @@ class MANGOS_DLL_SPEC barGoLink { - static char const * const empty; - static char const * const full; - - int rec_no; - int rec_pos; - int num_rec; - int indic_len; - - public: - - void step( void ); - barGoLink( int ); + public: // constructors + barGoLink(int row_count); ~barGoLink(); + + public: // modifiers + void step( void ); + + static void SetOutputState(bool on) { m_showOutput = on; } + private: + static bool m_showOutput; // not recommended change with existed active bar + static char const * const empty; + static char const * const full; + + int rec_no; + int rec_pos; + int num_rec; + int indic_len; }; #endif diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1111151f5..b63ce0c3a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10982" + #define REVISION_NR "10983" #endif // __REVISION_NR_H__