Jelajahi Sumber

Fixes shadowing for private variables (#7531)

* Fixes #7508.
* Follow C++ convention for private variable declaration.
Thanks to @Lemongrass3110 and @idk-whoami!
Aleos 2 tahun lalu
induk
melakukan
7323800838
2 mengubah file dengan 16 tambahan dan 16 penghapusan
  1. 8 8
      src/common/core.cpp
  2. 8 8
      src/common/core.hpp

+ 8 - 8
src/common/core.cpp

@@ -377,12 +377,12 @@ int Core::start( int argc, char **argv ){
 	}
 
 	// If initialization did not trigger shutdown
-	if( this->status != e_core_status::STOPPING ){
+	if( this->m_status != e_core_status::STOPPING ){
 		this->set_status( e_core_status::SERVER_INITIALIZED );
 
 		this->set_status( e_core_status::RUNNING );
 #ifndef MINICORE
-		if( !this->run_once ){
+		if( !this->m_run_once ){
 			// Main runtime cycle
 			while( this->get_status() == e_core_status::RUNNING ){
 				t_tick next = do_timer( gettick_nocache() );
@@ -445,15 +445,15 @@ void Core::finalize(){
 }
 
 void Core::set_status( e_core_status status ){
-	this->status = status;
+	this->m_status = status;
 }
 
 e_core_status Core::get_status(){
-	return this->status;
+	return this->m_status;
 }
 
 e_core_type Core::get_type(){
-	return this->type;
+	return this->m_type;
 }
 
 bool Core::is_running(){
@@ -461,17 +461,17 @@ bool Core::is_running(){
 }
 
 void Core::set_run_once( bool run_once ){
-	this->run_once = run_once;
+	this->m_run_once = run_once;
 }
 
 void Core::signal_crash(){
 	this->set_status( e_core_status::STOPPING );
 
-	if( this->crashed ){
+	if( this->m_crashed ){
 		ShowFatalError( "Received another crash signal, while trying to handle the last crash!\n" );
 	}else{
 		ShowFatalError( "Received a crash signal, trying to handle it as good as possible!\n" );
-		this->crashed = true;
+		this->m_crashed = true;
 		this->handle_crash();
 	}
 

+ 8 - 8
src/common/core.hpp

@@ -59,10 +59,10 @@ namespace rathena{
 
 		class Core{
 			private:
-				e_core_status status;
-				e_core_type type;
-				bool run_once;
-				bool crashed;
+				e_core_status m_status;
+				e_core_type m_type;
+				bool m_run_once;
+				bool m_crashed;
 
 			protected:
 				virtual bool initialize( int argc, char* argv[] );
@@ -74,10 +74,10 @@ namespace rathena{
 
 			public:
 				Core( e_core_type type ){
-					this->status = e_core_status::NOT_STARTED;
-					this->run_once = false;
-					this->crashed = false;
-					this->type = type;
+					this->m_status = e_core_status::NOT_STARTED;
+					this->m_run_once = false;
+					this->m_crashed = false;
+					this->m_type = type;
 				}
 
 				e_core_status get_status();