diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/Makefile.am | 5 | ||||
-rw-r--r-- | src/core/entity.cc | 5 | ||||
-rw-r--r-- | src/core/entity.h | 3 | ||||
-rw-r--r-- | src/core/net.h | 1 | ||||
-rw-r--r-- | src/core/netclient.cc | 2 | ||||
-rw-r--r-- | src/core/netconnection.cc | 3 | ||||
-rw-r--r-- | src/core/netserver.cc | 22 |
7 files changed, 20 insertions, 21 deletions
diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 33b4c44..7c18362 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -3,12 +3,13 @@ INCLUDES = -I$(top_srcdir)/src libcore_la_SOURCES = application.cc commandbuffer.cc core.cc cvar.cc entity.cc \ func.cc gameconnection.cc gameinterface.cc gameserver.cc module.cc netclient.cc \ - netconnection.cc netserver.cc player.cc + netconnection.cc netserver.cc player.cc stats.cc libcore_la_LDFLAGS = -avoid-version -no-undefined libcore_la_LIBADD = $(top_builddir)/src/filesystem/libfilesystem.la \ $(top_builddir)/src/math/libmath.la $(top_builddir)/src/sys/libsys.la $(top_builddir)/src/model/libmodel.la noinst_LTLIBRARIES = libcore.la noinst_HEADERS = application.h commandbuffer.h core.h cvar.h entity.h func.h \ - gameconnection.h gameinterface.h gameserver.h module.h net.h netconnection.h player.h + gameconnection.h gameinterface.h gameserver.h module.h net.h \ + netclient.h netconnection.h netserver.cc player.h stats.h diff --git a/src/core/entity.cc b/src/core/entity.cc index d05bef2..d2fef43 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -379,13 +379,16 @@ void EntityControlable::set_roll(float roll) EntityGlobe::EntityGlobe(unsigned int flags) : Entity(flags) { - entity_texture_id = 0; + render_texture = 0; entity_shape = Sphere; } EntityGlobe::EntityGlobe(std::istream & is) : Entity(is) { + render_texture = 0; + entity_shape = Sphere; + std::string n; char c; while ( (is.get(c)) && (c != '"')); diff --git a/src/core/entity.h b/src/core/entity.h index ba86c53..1e80435 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -315,7 +315,6 @@ public: ~EntityGlobe(); virtual void serialize(std::ostream & os) const; - /*----- inspectors ------------------------------------------------ */ @@ -325,7 +324,7 @@ public: std::string entity_texture; /// client side, texture id - unsigned int entity_texture_id; + unsigned int render_texture; }; } diff --git a/src/core/net.h b/src/core/net.h index a659a7f..3c49467 100644 --- a/src/core/net.h +++ b/src/core/net.h @@ -7,7 +7,6 @@ #ifndef __INCLUDED_CORE_NET_H__ #define __INCLUDED_CORE_NET_H__ -/// this namespace contains the network subsystem namespace core { diff --git a/src/core/netclient.cc b/src/core/netclient.cc index 0c0d72a..b90f164 100644 --- a/src/core/netclient.cc +++ b/src/core/netclient.cc @@ -10,6 +10,7 @@ #include "sys/sys.h" #include "core/net.h" #include "core/application.h" +#include "core/stats.h" namespace core { @@ -145,6 +146,7 @@ void NetClient::transmit(int serverfd) } sendq.erase(0, bytes_sent); + Stats::network_bytes_sent += bytes_sent; } sendq.clear(); diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc index fd590c0..dda339c 100644 --- a/src/core/netconnection.cc +++ b/src/core/netconnection.cc @@ -11,6 +11,7 @@ #include "core/gameconnection.h" #include "core/netconnection.h" #include "core/player.h" +#include "core/stats.h" namespace core { @@ -136,6 +137,7 @@ void NetConnection::receive() memset(recvbuf, '\0', BLOCKSIZE); bytes_received = ::recv(connection_fd, recvbuf, BLOCKSIZE-1, 0); + Stats::network_bytes_received += bytes_received; connection_timeout = core::application()->time(); if (bytes_received == 0) { @@ -249,6 +251,7 @@ void NetConnection::transmit() // assert (bytes_sent <= sendbuf.size()); sendq.erase(0, bytes_sent); + Stats::network_bytes_sent += bytes_sent; } connection_keepalive = application()->time(); diff --git a/src/core/netserver.cc b/src/core/netserver.cc index ca08def..3005922 100644 --- a/src/core/netserver.cc +++ b/src/core/netserver.cc @@ -28,6 +28,7 @@ #include "core/cvar.h" #include "core/func.h" #include "core/core.h" +#include "core/stats.h" #ifdef _WIN32 typedef int socklen_t; @@ -203,7 +204,8 @@ void NetServer::receive() } else { //con_debug << "Incoming data '" << recbuf << "'"<< bytes_received << " bytes" << std::endl; } - + Stats::network_bytes_received += bytes_received; + // originator std::string client_host (inet_ntoa(client_addr.sin_addr)); unsigned int client_port = ntohs(client_addr.sin_port); @@ -284,20 +286,10 @@ void NetServer::client_initialize(NetClient *client) { std::map<unsigned int, Entity *>::iterator it; for (it=Entity::registry.begin(); it != Entity::registry.end(); it++) { netmsg.str(""); - switch ((*it).second->type()) { - case Entity::Default: - case Entity::Dynamic: - case Entity::Controlable: - netmsg << "ent "; - (*it).second->serialize(netmsg); - netmsg << "\n"; - - client->send(netmsg.str()); - - break; - default: - break; - } + netmsg << "ent "; + (*it).second->serialize(netmsg); + netmsg << "\n"; + client->send(netmsg.str()); } netmsg.str("connect\n"); client->send(netmsg.str()); |