Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv525
Modified Files:
console_unix.cpp uobject.cpp wolfpack.pro
Log Message:
Probably Fixed Linux Behaviour of Console
Index: console_unix.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console_unix.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** console_unix.cpp 12 Sep 2003 21:51:53 -0000 1.6
--- console_unix.cpp 12 Sep 2003 22:11:47 -0000 1.7
***************
*** 29,33 ****
--- 29,39 ----
// Wolfpack Homepage: http://wpdev.sf.net/
//==================================================================================
+
+ // System Includes
+ #include <sys/time.h>
#include <stdio.h>
+ #include <unistd.h>
+ #include <termios.h>
+
// Qt Includes
#include <qthread.h>
***************
*** 39,42 ****
--- 45,63 ----
using namespace std;
+ void setNonBlockingIo()
+ {
+ termios term_caps;
+
+ if( tcgetattr( STDIN_FILENO, &term_caps ) < 0 )
+ return;
+
+ term_caps.c_lflag &= ~ICANON;
+
+ if( tcsetattr( STDIN_FILENO, TCSANOW, &term_caps ) < 0 )
+ return;
+
+ setbuf( stdin, NULL );
+ }
+
class cConsoleThread : public QThread
{
***************
*** 46,58 ****
try
{
while( serverState < SHUTDOWN )
{
! char c = fgetc( stdin );
! if( c > 0 && serverState == RUNNING )
{
! Console::instance()->queueCommand( QChar( c ) );
}
else
! {
msleep( 100 );
}
--- 67,95 ----
try
{
+ setNonBlockingIo();
+
while( serverState < SHUTDOWN )
{
! // Do a select operation on the stdin handle and see
! // if there is any input waiting.
! fd_set consoleFds;
! FD_ZERO( &consoleFds );
! FD_SET( STDIN_FILENO, &consoleFds );
!
! timeval tvTimeout;
! tvTimeout.tv_sec = 0;
! tvTimeout.tv_usec = 1;
!
! if( select( 1, &consoleFds, 0, 0, &tvTimeout ) > 0 )
{
! char c = fgetc( stdin );
!
! if( c > 0 && serverState == RUNNING )
! {
! Console::instance()->queueCommand( QChar( c ) );
! }
}
else
! {
msleep( 100 );
}
Index: uobject.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/uobject.cpp,v
retrieving revision 1.113
retrieving revision 1.114
diff -C2 -d -r1.113 -r1.114
*** uobject.cpp 12 Sep 2003 15:39:55 -0000 1.113
--- uobject.cpp 12 Sep 2003 22:11:47 -0000 1.114
***************
*** 114,118 ****
void cUObject::load( char **result, UINT16 &offset )
{
! name_ = result[offset] == 0 ? QString::null : result[offset];
offset++;
serial_ = atoi(result[offset++]);
--- 114,118 ----
void cUObject::load( char **result, UINT16 &offset )
{
! name_ = ( result[offset] == 0 ) ? QString::null : QString( result[offset] );
offset++;
serial_ = atoi(result[offset++]);
***************
*** 123,127 ****
pos_.z = atoi(result[offset++]);
pos_.map = atoi(result[offset++]);
! eventList_ = result[offset] == 0 ? QString::null : result[offset];
offset++;
bindmenu_ = result[offset++];
--- 123,127 ----
pos_.z = atoi(result[offset++]);
pos_.map = atoi(result[offset++]);
! eventList_ = ( result[offset] == 0 ) ? QString::null : QString( result[offset] );
offset++;
bindmenu_ = result[offset++];
Index: wolfpack.pro
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolfpack.pro,v
retrieving revision 1.160
retrieving revision 1.161
diff -C2 -d -r1.160 -r1.161
*** wolfpack.pro 12 Sep 2003 17:30:57 -0000 1.160
--- wolfpack.pro 12 Sep 2003 22:11:47 -0000 1.161
***************
*** 28,32 ****
INCLUDEPATH += /usr/local/include/stlport lib/Python sqlite lib/Python/Include network
! LIBS += -L/usr/local/lib/mysql/lib/mysql -L/usr/local/lib -Llib/Python -L/usr/lib/mysql -ldl -lpython2.2 -lmysqlclient -lutil
# we dont use those.
QMAKE_LIBS_X11 -= -lX11 -lXext -lm
--- 28,32 ----
INCLUDEPATH += /usr/local/include/stlport lib/Python sqlite lib/Python/Include network
! LIBS += -L. -L/usr/local/lib/mysql/lib/mysql -L/usr/local/lib -Llib/Python -L/usr/lib/mysql -ldl -lpython2.3 -lmysqlclient -lutil
# we dont use those.
QMAKE_LIBS_X11 -= -lX11 -lXext -lm
|