From 8898ad9b25fca6afe2374d293a981db02a83d7e9 Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Thu, 31 May 2012 14:46:27 +0000 Subject: Committing the documentation to svn to have it accessible online --- Doc/doxygen/html/_net_msg_8cpp_source.html | 206 +++++++++++++++++++++++++++++ 1 file changed, 206 insertions(+) create mode 100644 Doc/doxygen/html/_net_msg_8cpp_source.html (limited to 'Doc/doxygen/html/_net_msg_8cpp_source.html') diff --git a/Doc/doxygen/html/_net_msg_8cpp_source.html b/Doc/doxygen/html/_net_msg_8cpp_source.html new file mode 100644 index 0000000..cc0247d --- /dev/null +++ b/Doc/doxygen/html/_net_msg_8cpp_source.html @@ -0,0 +1,206 @@ + + + + + +Starshatter_Open: D:/SRC/StarshatterSVN/NetEx/NetMsg.cpp Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Starshatter_Open +
+
Open source Starshatter engine
+
+
+ + + + + +
+
+ +
+
+
+ +
+ + + + +
+ +
+ +
+
+
NetMsg.cpp
+
+
+Go to the documentation of this file.
1 /* Project nGenEx
+
2  Destroyer Studios LLC
+
3  Copyright © 1997-2004. All Rights Reserved.
+
4 
+
5  SUBSYSTEM: NetEx.lib
+
6  FILE: NetMsg.cpp
+
7  AUTHOR: John DiCamillo
+
8 
+
9 
+
10  OVERVIEW
+
11  ========
+
12  User level network message
+
13 */
+
14 
+
15 
+
16 #include "MemDebug.h"
+
17 #include <windows.h>
+
18 #include "NetMsg.h"
+
19 
+
20 // +-------------------------------------------------------------------+
+
21 
+
22 static DWORD net_msg_sequence = 1;
+
23 
+
24 // +-------------------------------------------------------------------+
+
25 
+
26 NetMsg::NetMsg(DWORD nid, void* d, int l, BYTE f)
+
27  : msgid(net_msg_sequence++), netid(nid), len(l), flags(f)
+
28 {
+
29  data = new(__FILE__,__LINE__) BYTE[len];
+
30 
+
31  if (data) {
+
32  CopyMemory(data, d, len);
+
33 
+
34  if (len < MAX_SIZE)
+
35  data[1] = len;
+
36  else
+
37  data[1] = 0;
+
38  }
+
39  else {
+
40  len = 0;
+
41  }
+
42 }
+
43 
+
44 // +-------------------------------------------------------------------+
+
45 
+
46 NetMsg::NetMsg(DWORD nid, BYTE type, const char* text, int l, BYTE f)
+
47  : msgid(net_msg_sequence++), netid(nid), len(2+l), flags(f)
+
48 {
+
49  data = new(__FILE__,__LINE__) BYTE[len];
+
50 
+
51  if (data) {
+
52  data[0] = type;
+
53 
+
54  if (len < MAX_SIZE)
+
55  data[1] = len;
+
56  else
+
57  data[1] = 0;
+
58 
+
59  if (len > 2)
+
60  CopyMemory(data+2, text, len-2);
+
61  }
+
62  else {
+
63  len = 0;
+
64  }
+
65 }
+
66 
+
67 // +-------------------------------------------------------------------+
+
68 
+ +
70 {
+
71  delete [] data;
+
72 }
+
73 
+
74 // +-------------------------------------------------------------------+
+
75 
+
76 int NetMsg::operator < (const NetMsg& m) const
+
77 {
+
78  if (data[0] == MULTIPART && m.data[0] == MULTIPART) {
+
79  NetMsgMultipart* p1 = (NetMsgMultipart*) data;
+
80  NetMsgMultipart* p2 = (NetMsgMultipart*) m.data;
+
81 
+
82  if (p1->msgid == p2->msgid)
+
83  return p1->partno < p2->partno;
+
84 
+
85  return p1->msgid < p2->msgid;
+
86  }
+
87 
+
88  return msgid < m.msgid;
+
89 }
+
+
+ + + + -- cgit v1.1