TDME2  1.9.200
NetworkLogic.cpp
Go to the documentation of this file.
1 #include <string>
2 #include <vector>
3 
4 #include <tdme/tdme.h>
10 #include <tdme/utilities/Console.h>
11 
12 using std::string;
13 using std::vector;
14 
20 
21 NetworkLogic::NetworkLogic(Context* context, const string& id, bool handlingHIDInput): Logic(context, id, handlingHIDInput) {
22 }
23 
25  return true;
26 }
27 
29  synchedFromNetwork = true;
30 }
31 
33  if (synchedFromNetwork == true) {
34  synchedFromNetwork = false;
35  return true;
36  } else {
37  return false;
38  }
39 }
40 
42  return context->isServer();
43 }
44 
45 vector<LogicNetworkPacket>& NetworkLogic::getNetworkPackets() {
46  return networkPackets;
47 }
48 
50  if (networkPackets.size() == 50) {
51  Console::println("NetworkLogic::sendNetworkPacket(): 50 packets: Too many packets!");
52  }
53  networkPackets.push_back(packet);
54 }
vector< LogicNetworkPacket > & getNetworkPackets()
Get outgoing network packets.
void setSynchedFromNetwork()
Set that this entity has been synched from network.
void sendNetworkPacket(LogicNetworkPacket &packet)
Send network packet.
vector< LogicNetworkPacket > networkPackets
Definition: NetworkLogic.h:84
Console class.
Definition: Console.h:29