From 599adb817e19d9be3502e501dc904c7255cd616c Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 12 May 2008 21:33:28 +0000 Subject: color and info updates --- src/core/application.cc | 7 +++++++ src/core/commandbuffer.cc | 13 ++++++------- src/core/cvar.cc | 3 ++- src/core/cvar.h | 1 + src/core/gameconnection.cc | 4 ++-- src/core/netconnection.cc | 4 ++-- 6 files changed, 20 insertions(+), 12 deletions(-) (limited to 'src/core') diff --git a/src/core/application.cc b/src/core/application.cc index 2f8cc54..79f4a28 100644 --- a/src/core/application.cc +++ b/src/core/application.cc @@ -153,6 +153,9 @@ void Application::init(int count, char **arguments) Cvar::net_timeout = Cvar::get("net_timeout", "20", Cvar::Archive); Cvar::net_timeout->set_info("[int] network timeout in seconds"); + Cvar::net_framerate = Cvar::get("net_framerate", "25", Cvar::Archive); + Cvar::net_framerate->set_info("[int] network framerate in frames/sec"); + #ifdef _WIN32 // Initialize win32 socket library WSADATA wsa_data; @@ -294,6 +297,8 @@ void Application::save_config() return; } + con_print << " writing configuration to " << filename << std::endl; + if (!Cvar::sv_dedicated->value()) ofs << "# client.cfg - osirion client configuration" << std::endl; else @@ -324,6 +329,8 @@ void Application::load_config() return; } + con_print << " reading configuration from " << filename << std::endl; + char line[MAXCMDSIZE]; while (ifs.getline(line, MAXCMDSIZE-1)) { if (line[0] && line[0] != '#' && line[0] != ';') diff --git a/src/core/commandbuffer.cc b/src/core/commandbuffer.cc index e97a00e..d1c9451 100644 --- a/src/core/commandbuffer.cc +++ b/src/core/commandbuffer.cc @@ -42,18 +42,17 @@ void func_set(std::string const &args) if (!(argstream >> varname)) return; - // we're setting a new value std::string value; - if (!(argstream >> value)) + if (!(argstream >> value)) { return; + } char c; while (argstream.get(c)) value += c; - Cvar *cvar = Cvar::set(varname.c_str(), value.c_str(), Cvar::Archive); - - con_print << cvar->name() << " " << cvar->str() << "\n"; + + con_print << " " << cvar->name() << " " << cvar->str() << "\n"; if (cvar->flags() && Cvar::Info) { localplayer()->player_dirty = true; @@ -153,7 +152,7 @@ void CommandBuffer::exec(std::string const &cmdline) } } - con_print << command << " " << cvar->str() << " ^N" << cvar->info() << "\n"; + con_print << " " << command << " " << cvar->str() << " ^N" << cvar->info() << "\n"; return; } @@ -253,7 +252,7 @@ void CommandBuffer::exec_file(std::string const & filename) return; } - con_debug << "Executing " << fn.c_str() << std::endl; + con_print << "Executing " << fn.c_str() << std::endl; char line[MAXCMDSIZE]; while (ifs.getline(line, MAXCMDSIZE-1)) { diff --git a/src/core/cvar.cc b/src/core/cvar.cc index 4571240..7593ac3 100644 --- a/src/core/cvar.cc +++ b/src/core/cvar.cc @@ -25,6 +25,7 @@ Cvar *Cvar::net_host = 0; Cvar *Cvar::net_port = 0; Cvar *Cvar::net_maxclients = 0; Cvar *Cvar::net_timeout = 0; +Cvar *Cvar::net_framerate = 0; std::map Cvar::registry; @@ -180,7 +181,7 @@ void Cvar::list() typeindicator += ' '; con_print << " " << typeindicator << - " " << (*it).first << " " << (*it).second->str() << " " << (*it).second->info() << std::endl; + " " << (*it).first << " " << (*it).second->str() << " ^N" << (*it).second->info() << std::endl; } con_print << registry.size() << " registered variables" << std::endl; } diff --git a/src/core/cvar.h b/src/core/cvar.h index e45839f..4125d3c 100644 --- a/src/core/cvar.h +++ b/src/core/cvar.h @@ -117,6 +117,7 @@ public: static Cvar *net_port; // network port static Cvar *net_maxclients;// maximum number of connected clients static Cvar *net_timeout; // network timeout in seconds + static Cvar *net_framerate; // client network send framerate private: std::string cvar_name; std::string cvar_info; diff --git a/src/core/gameconnection.cc b/src/core/gameconnection.cc index e77a3d8..1d022c5 100644 --- a/src/core/gameconnection.cc +++ b/src/core/gameconnection.cc @@ -97,8 +97,8 @@ void GameConnection::frame(float seconds) connection_frametime += seconds; float f = 0; - if (core::Cvar::sv_framerate->value()) { - f = 0.5f / core::Cvar::sv_framerate->value(); + if (core::Cvar::net_framerate->value()) { + f = 0.5f / core::Cvar::net_framerate->value(); if (connection_frametime < f) { return; } diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc index 55480d2..2bcd6dc 100644 --- a/src/core/netconnection.cc +++ b/src/core/netconnection.cc @@ -141,7 +141,7 @@ void NetConnection::receive() connection_timeout = core::application()->time(); if (bytes_received == 0) { - con_print << "Disconnected."; + con_print << "^BDisconnected."; abort(); return; } else if (bytes_received < 0) { @@ -296,7 +296,7 @@ void NetConnection::parse_incoming_message(const std::string & message) } else if (command == "connect") { connection_state = Connected; - con_print << "Connected." << std::endl; + con_print << "^BConnected." << std::endl; return; } else if (command == "disconnect") { -- cgit v1.2.3