Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv13059
Modified Files:
basechar.h wolfpack.pro
Added Files:
console_unix.cpp
Removed Files:
console_linux.cpp
Log Message:
Renamed
--- NEW FILE: console_unix.cpp ---
//==================================================================================
//
// Wolfpack Emu (WP)
// UO Server Emulation Program
//
// Copyright 1997, 98 by Marcus Rating (Cironian)
// Copyright 2001-2003 by holders identified in authors.txt
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Palace - Suite 330, Boston, MA 02111-1307, USA.
//
// * In addition to that license, if you are running this program or modified
// * versions of it on a public system you HAVE TO make the complete source of
// * the version used by you available or provide people with a location to
// * download it.
//
//
//
// Wolfpack Homepage: http://wpdev.sf.net/
//==================================================================================
#include "console.h"
class cConsoleThread : public QThread
{
protected:
virtual void run()
{
try
{
while( serverState < SHUTDOWN )
{
char c = getch();
if( c > 0 && serverState == RUNNING )
{
Console::instance()->handleCommand( QChar( c ) );
}
else
{
Sleep( 100 );
}
}
}
// If there is any error: Quit.
// It's better to have no console input
// than a deadlocking server.
catch( ... )
{
}
}
};
cConsoleThread *thread = 0;
void cConsole::start()
{
thread = new cConsoleThread;
thread->start();
}
void cConsole::poll()
{
// Normally we would check if there is a command in the command queue and execute it
}
void cConsole::stop()
{
thread->wait();
delete thread;
}
void cConsole::setConsoleTitle( const QString& data )
{
#if defined(Q_OS_WIN32)
SetConsoleTitle( data.latin1() );
#endif
}
//=========================================================================================
// Change the console Color
void cConsole::ChangeColor( WPC_ColorKeys Color )
{
#if defined(Q_OS_UNIX)
QString cb = "\e[0m";
switch( Color )
{
case WPC_GREEN: cb = "\e[1;32m";
break;
case WPC_RED: cb = "\e[1;31m";
break;
case WPC_YELLOW:cb = "\e[1;33m";
break;
case WPC_NORMAL:cb = "\e[0m";
break;
case WPC_WHITE: cb = "\e[1;37m";
break;
default: cb = "\e[0m";
}
send( cb );
#elif defined(Q_OS_WIN32)
HANDLE ConsoleHandle = GetStdHandle( STD_OUTPUT_HANDLE );
UI16 ColorKey = FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE;
switch( Color )
{
case WPC_GREEN:
ColorKey = FOREGROUND_GREEN | FOREGROUND_INTENSITY;
break;
case WPC_RED:
ColorKey = FOREGROUND_RED | FOREGROUND_INTENSITY;
break;
case WPC_YELLOW:
ColorKey = FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY;
break;
case WPC_NORMAL:
ColorKey = FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE;
break;
case WPC_WHITE:
ColorKey = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY;
break;
default:
break;
}
SetConsoleTextAttribute( ConsoleHandle, ColorKey );
#endif
}
//========================================================================================
// Send a message to the console
void cConsole::send(const QString &sMessage)
{
if( outputstrm != NULL )
{
(*outputstrm) << sMessage.latin1();
flush( *outputstrm );
}
if( sMessage.contains( "\n" ) )
{
#if defined(Q_OS_UNIX) && 0
sMessage.replace("\e[0m", "");
sMessage.replace("\e[1;32m", "");
sMessage.replace("\e[1;31m", "");
sMessage.replace("\e[1;33m", "");
sMessage.replace("\e[1;37m", "");
#endif
incompleteLine_.append( sMessage ); // Split by \n
QStringList lines = QStringList::split( "\n", incompleteLine_, true );
// Insert all except the last element
for( int i = 0; i < lines.count()-1; ++i )
linebuffer_.push_back( lines[i] );
incompleteLine_ = lines[ lines.count() - 1 ];
}
else
{
incompleteLine_.append( sMessage );
}
}
void cConsole::setAttributes( bool bold, bool italic, unsigned char r, unsigned char g, unsigned char b, unsigned char size )
{
}
Index: basechar.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basechar.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** basechar.h 8 Sep 2003 10:58:46 -0000 1.31
--- basechar.h 9 Sep 2003 20:56:53 -0000 1.32
***************
*** 45,48 ****
--- 45,49 ----
#include "TmpEff.h"
#include "territories.h"
+ #include "log.h"
class cUOTxTooltipList;
Index: wolfpack.pro
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolfpack.pro,v
retrieving revision 1.155
retrieving revision 1.156
diff -C2 -d -r1.155 -r1.156
*** wolfpack.pro 9 Sep 2003 03:24:16 -0000 1.155
--- wolfpack.pro 9 Sep 2003 20:56:54 -0000 1.156
***************
*** 23,27 ****
CONFIG += warn_off
linux {
! QMAKE_CXXFLAGS -= -O3
QMAKE_CXXFLAGS += -march=athlon-xp -O3 -pipe -fomit-frame-pointer -falign-functions=16 -falign-labels=8 -falign-loops=8 -falign-jumps=8 -fsched-spec-load -frerun-loop-opt -finline-limit=800 -funroll-loops -fprefetch-loop-arrays -ffast-math -mfpmath=sse -msse -m3dnow -fschedule-insns2 -fexpensive-optimizations -fmove-all-movables -fdelete-null-pointer-checks
--- 23,27 ----
CONFIG += warn_off
linux {
! QMAKE_CXXFLAGS -= -O2
QMAKE_CXXFLAGS += -march=athlon-xp -O3 -pipe -fomit-frame-pointer -falign-functions=16 -falign-labels=8 -falign-loops=8 -falign-jumps=8 -fsched-spec-load -frerun-loop-opt -finline-limit=800 -funroll-loops -fprefetch-loop-arrays -ffast-math -mfpmath=sse -msse -m3dnow -fschedule-insns2 -fexpensive-optimizations -fmove-all-movables -fdelete-null-pointer-checks
***************
*** 172,176 ****
spawnregions.cpp \
srvparams.cpp \
- storage.cpp \
targetactions.cpp \
targetrequests.cpp \
--- 172,175 ----
--- console_linux.cpp DELETED ---
|