/[cvs]/rabit/RaBit's Rapid Racers/UserControl_RemotePlayerSock.ctl
ViewVC logotype

Contents of /rabit/RaBit's Rapid Racers/UserControl_RemotePlayerSock.ctl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Tue Mar 12 21:23:10 2002 UTC (22 years, 9 months ago) by cvsrabit
Branch point for: NFO, MAIN
Initial revision

1 VERSION 5.00
2 Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
3 Begin VB.UserControl UserControl_RemotePlayerSock
4 CanGetFocus = 0 'False
5 ClientHeight = 885
6 ClientLeft = 0
7 ClientTop = 0
8 ClientWidth = 1170
9 ClipControls = 0 'False
10 InvisibleAtRuntime= -1 'True
11 ScaleHeight = 885
12 ScaleWidth = 1170
13 Windowless = -1 'True
14 Begin MSWinsockLib.Winsock Winsock_Link
15 Left = 0
16 Top = 0
17 _ExtentX = 741
18 _ExtentY = 741
19 _Version = 393216
20 End
21 End
22 Attribute VB_Name = "UserControl_RemotePlayerSock"
23 Attribute VB_GlobalNameSpace = False
24 Attribute VB_Creatable = True
25 Attribute VB_PredeclaredId = False
26 Attribute VB_Exposed = False
27 Public Event ConnectionClosed(lPlayerKey As Long)
28
29 Public lPlayerKey As Long
30
31 Private strDataBuffer As String
32 '
33
34 Public Sub AcceptRequest(lRequestID As Long)
35
36 Winsock_Link.Close
37 Winsock_Link.Accept lRequestID
38
39 End Sub
40
41 Private Sub Winsock_Link_Close()
42
43 RaiseEvent ConnectionClosed(lPlayerKey)
44
45 'Unload Me
46
47 End Sub
48
49 Private Sub Winsock_Link_DataArrival(ByVal bytesTotal As Long)
50
51 Dim strRecievedData As String
52 Dim lCRLFPos As Long
53
54 Winsock_Link.GetData strRecievedData
55
56 strDataBuffer = strDataBuffer + strRecievedData
57
58 lCRLFPos = InStr(1, strDataBuffer, vbCrLf)
59
60 If lCRLFPos > 0 Then
61
62 strRecievedData = Left(strDataBuffer, lCRLFPos - 1)
63 strDataBuffer = Mid(strDataBuffer, lCRLFPos + 2)
64
65 ParseData strRecievedData
66
67 End If
68
69 End Sub
70
71 Private Sub ParseData(strData As String)
72
73 Select Case Left(strData, 2)
74
75 Case "cf"
76
77 clGame.Col_clPlayers("p" & lPlayerKey).lPlayerControlFlags = Val(Mid(strData, 4))
78
79 End Select
80
81 ' Debug.Print clGame.Col_clPlayers("p" & lPlayerKey).lPlayerControlFlags
82
83 End Sub
84
85 Public Function SendData(strData As String) As Boolean
86
87 If Winsock_Link.State = sckConnected Then
88
89 Winsock_Link.SendData strData
90
91 SendData = True
92
93 End If
94
95 End Function

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed