Changeset 32 for trunk/raknet/lineserver.d
- Timestamp:
- 12/29/05 20:56:37 (3 years ago)
- Files:
-
- trunk/raknet/lineserver.d (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/raknet/lineserver.d
r25 r32 9 9 // packet identifier so we know packet is a line 10 10 const ubyte PACKET_ID_LINE = 100; 11 const ubyte PACKET_ID_NUM = 101; 12 const ubyte PACKET_ID_NUM_REQUEST = 102; 13 14 int num = 0; 11 15 12 16 void sendLineToClients(PlayerID clientToExclude, float x1, float y1, float x2, float y2, int r, int g, int b) … … 25 29 26 30 raknet.server.sendBitstream(PacketPriority.HIGH_PRIORITY, PacketReliability.RELIABLE_ORDERED, 0, clientToExclude, true); 31 32 // deallocates bitstream 33 raknet.bitstream.end(); 34 } 35 36 void 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); 27 46 28 47 // deallocates bitstream … … 54 73 sendLineToClients(p.playerId, x1, y1, x2, y2, r, g, b); 55 74 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 56 84 default: 57 85 printf("Unhandled packet (not a problem): %i\n", cast(int)packetID);
