Show
Ignore:
Timestamp:
12/29/05 20:56:37 (3 years ago)
Author:
clayasaurus
Message:

updated raknet to include more functionality

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/raknet/lineserver.d

    r25 r32  
    99// packet identifier so we know packet is a line 
    1010const ubyte PACKET_ID_LINE = 100; 
     11const ubyte PACKET_ID_NUM = 101; 
     12const ubyte PACKET_ID_NUM_REQUEST = 102;  
     13 
     14int num = 0; 
    1115 
    1216void sendLineToClients(PlayerID clientToExclude, float x1, float y1, float x2, float y2, int r, int g, int b) 
     
    2529 
    2630   raknet.server.sendBitstream(PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, 0, clientToExclude, true); 
     31 
     32   // deallocates bitstream 
     33   raknet.bitstream.end(); 
     34} 
     35 
     36void sendNumToClients(PlayerID pid, int num) 
     37{ 
     38   // allocates bitstream 
     39   raknet.bitstream.start();       
     40  
     41   // send info & packet ID 
     42   raknet.bitstream.write(PACKET_ID_NUM); 
     43   raknet.bitstream.write(num); 
     44 
     45   raknet.server.sendBitstream(PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, 0, pid, false); 
    2746 
    2847   // deallocates bitstream 
     
    5473      sendLineToClients(p.playerId, x1, y1, x2, y2, r, g, b); 
    5574   break; 
     75 
     76   // on incoming connection tell player which number it is  
     77   case ID_NEW_INCOMING_CONNECTION: 
     78      debug writefln("player ", p.playerIndex, " connected"); 
     79 
     80      sendNumToClients(p.playerId, p.playerIndex); 
     81   break;  
     82 
     83 
    5684   default: 
    5785      printf("Unhandled packet (not a problem): %i\n", cast(int)packetID);