|
From: Audoux <au...@us...> - 2001-01-02 23:24:41
|
Update of /cvsroot/attal/src/common
In directory usw-pr-cvs1:/tmp/cvs-serv30830
Modified Files:
attalSocket.h attalSocket.cpp
Log Message:
add method for managing connection and initialization
add method for building's owner
Index: attalSocket.h
===================================================================
RCS file: /cvsroot/attal/src/common/attalSocket.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** attalSocket.h 2001/01/02 19:19:08 1.13
--- attalSocket.h 2001/01/02 23:24:36 1.14
***************
*** 33,37 ****
// include files for QT
#include <qsocket.h>
! // application specific includes
#include "common/genericCell.h"
#include "common/genericFightCell.h"
--- 33,38 ----
// include files for QT
#include <qsocket.h>
! // application specific include
! #include "common/player.h"
#include "common/genericCell.h"
#include "common/genericFightCell.h"
***************
*** 66,69 ****
--- 67,76 ----
};
+ enum CLASS_CONNECT {
+ C_CONN_OK,
+ C_CONN_NAME,
+ C_CONN_PLAYER
+ };
+
enum CLASS_QR {
C_QR_NONE
***************
*** 92,96 ****
enum CLASS_BUILD {
! C_BUILD_NEW
};
--- 99,104 ----
enum CLASS_BUILD {
! C_BUILD_NEW,
! C_BUILD_OWNER
};
***************
*** 133,137 ****
void sendMessage( QString msg );
! void sendConnection( bool onoff, QString msg );
void sendEndGame() { send2Arg( SO_GAME, C_GAME_END ); }
void sendBegGame() { send2Arg( SO_GAME, C_GAME_BEG ); }
--- 141,152 ----
void sendMessage( QString msg );
!
! void sendConnectionOk() {
! send2Arg( SO_CONNECT, C_CONN_OK );
! }
! void sendConnectionName( QString name ) {}
!
! void sendConnectionPlayer( Player * player ) {}
!
void sendEndGame() { send2Arg( SO_GAME, C_GAME_END ); }
void sendBegGame() { send2Arg( SO_GAME, C_GAME_BEG ); }
***************
*** 227,230 ****
--- 242,248 ----
void sendNewBuild( GenericBuilding * build ) {
send6Arg( SO_MODIF, C_MOD_BUILD, C_BUILD_NEW, build->getCell()->getRow(), build->getCell()->getCol(), build->getType() );
+ }
+ void sendBuildingOwner( GenericBuilding * build, Player * player ) {
+ send6Arg( SO_MODIF, C_MOD_BUILD, C_BUILD_OWNER, build->getCell()->getRow(), build->getCell()->getCol(), player->getNum() );
}
Index: attalSocket.cpp
===================================================================
RCS file: /cvsroot/attal/src/common/attalSocket.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** attalSocket.cpp 2000/12/28 10:55:44 1.9
--- attalSocket.cpp 2001/01/02 23:24:36 1.10
***************
*** 123,126 ****
--- 123,127 ----
}
+
void AttalSocket::sendAskNone( QString msg )
{
***************
*** 138,158 ****
- /*!
-
- */
-
- void AttalSocket::sendConnection( bool onoff, QString msg )
- {
- char buf[50];
- buf[0] = SO_CONNECT;
- buf[1] = (char)onoff;
- buf[2] = QMIN( msg.length(), 46 );
- /// XXX: we suppose small messages for the moment
- for( uint i=0; i< QMIN( msg.length(), 46 ); i++ ) {
- buf[3+i] = msg[i].latin1();
- }
- buf[QMIN( msg.length(), 46 )+3] = 0;
- QSocket::writeBlock( buf, 50 );
- }
void AttalSocket::sendFighter( GenericFightUnit * units[MAX_UNIT] )
--- 139,142 ----
|