2727#else
2828 #include < termios.h>
2929 #include < unistd.h>
30-
31- // This is probably safer than changing MTAPlatform.h against compatibility issues
32- #undef Print
33- #define Print printf
3430#endif
3531
3632// Define libraries
@@ -47,6 +43,7 @@ bool g_bNoCrashHandler = false;
4743 bool g_bDaemonized = false ;
4844 WINDOW* m_wndMenu = NULL ;
4945 WINDOW* m_wndInput = NULL ;
46+ bool IsCursesActive ( void ) { return m_wndInput != NULL ; }
5047#endif
5148
5249#ifdef WIN32
@@ -120,7 +117,7 @@ void CServerImpl::Printf ( const char* szFormat, ... )
120117#ifdef WIN32
121118 vprintf ( szFormat, ap );
122119#else
123- if (!g_bNoCurses )
120+ if ( IsCursesActive () )
124121 vwprintw ( stdscr, szFormat, ap );
125122 else
126123 vprintf ( szFormat, ap );
@@ -308,7 +305,7 @@ int CServerImpl::Run ( int iArgumentCount, char* szArguments [] )
308305
309306 // Welcome text
310307 if ( !g_bSilent )
311- Print ( " MTA:BLUE Server for MTA:SA\r\n\r \n " );
308+ Print ( " MTA:BLUE Server for MTA:SA\n \n " );
312309
313310 // Load the network DLL
314311 if ( m_NetworkLibrary.Load ( PathJoin ( m_strServerPath, SERVER_BIN_PATH, szNetworkLibName ) ) )
@@ -322,10 +319,10 @@ int CServerImpl::Run ( int iArgumentCount, char* szArguments [] )
322319 ulong ulNetModuleVersion = 0 ;
323320 if ( pfnCheckCompatibility )
324321 pfnCheckCompatibility ( 1 , &ulNetModuleVersion );
325- Print ( " Network module not compatible! (Expected 0x%x, got 0x%x)\n\r " , MTA_DM_SERVER_NET_MODULE_VERSION, (uint)ulNetModuleVersion );
326- Print ( " Press Q to shut down the server!\n\r " );
327- Print ( " \n\r\n\r\n\r (If this is a custom build,\n\r " );
328- Print ( " check MTASA_VERSION_TYPE in version.h is set correctly)\n\r " );
322+ Print ( " Network module not compatible! (Expected 0x%x, got 0x%x)\n " , MTA_DM_SERVER_NET_MODULE_VERSION, (uint)ulNetModuleVersion );
323+ Print ( " Press Q to shut down the server!\n " );
324+ Print ( " \n\n\n (If this is a custom build,\n " );
325+ Print ( " check MTASA_VERSION_TYPE in version.h is set correctly)\n " );
329326 WaitForKey ( ' q' );
330327 DestroyWindow ( );
331328 return ERROR_NETWORK_LIBRARY_FAILED;
@@ -991,7 +988,7 @@ void CServerImpl::DestroyWindow ( void )
991988
992989void WaitForKey ( int iKey )
993990{
994- if ( !g_bSilent )
991+ if ( !g_bSilent && !g_bNoCurses )
995992 {
996993 for ( ;; )
997994 {
@@ -1006,3 +1003,24 @@ void WaitForKey ( int iKey )
10061003 }
10071004 }
10081005}
1006+
1007+ // Always print these messages
1008+ void Print ( const char * szFormat, ... )
1009+ {
1010+ va_list ap;
1011+ va_start ( ap, szFormat );
1012+
1013+ SString str;
1014+ str.vFormat ( szFormat, ap );
1015+
1016+ #ifdef WIN32
1017+ printf ( " %s" , *str );
1018+ #else
1019+ if ( IsCursesActive () )
1020+ printw ( " %s" , *str );
1021+ else
1022+ printf ( " %s" , *str );
1023+ #endif
1024+
1025+ va_end ( ap );
1026+ }
0 commit comments