Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/console.cc20
-rw-r--r--src/server/console.h8
-rw-r--r--src/server/server.cc13
3 files changed, 21 insertions, 20 deletions
diff --git a/src/server/console.cc b/src/server/console.cc
index ab03c58..9fdad4f 100644
--- a/src/server/console.cc
+++ b/src/server/console.cc
@@ -104,7 +104,7 @@ Console::~Console()
void Console::dump()
{
// dump console content
- for (Text::iterator it = log().begin(); it != log().end(); it++) {
+ for (Queue::iterator it = log().begin(); it != log().end(); it++) {
sys::ConsoleInterface::print((*it));
}
}
@@ -200,8 +200,8 @@ void Console::draw_status()
if (core::game()) {
attroff(A_BOLD);
color_set(2, NULL);
- int minutes = (int) floorf(core::game()->serverframetime() / 60.0f);
- int seconds = (int) floorf( core::game()->serverframetime() - (float) minutes* 60.0f);
+ int minutes = (int) floorf(core::game()->time() / 60.0f);
+ int seconds = (int) floorf( core::game()->time() - (float) minutes* 60.0f);
std::stringstream status;
status << "time " << std::setfill(' ') << std::setw(3) << minutes << ":" << std::setfill('0') << std::setw(2) << seconds;
mvaddnstr(0, 2, status.str().c_str(), status.str().size());
@@ -215,7 +215,7 @@ void Console::draw_text()
if ((w < 3) || (h < 3))
return;
- Text lines;
+ Queue lines;
int height = stdwin->_maxy - 1;
int width = stdwin->_maxx - 1;
@@ -223,7 +223,7 @@ void Console::draw_text()
int current_line = 0;
// parse console text, wrap long lines
- for (Text::iterator it = log().begin(); it != log().end() && current_line < bottom; it++) {
+ for (Queue::iterator it = log().begin(); it != log().end() && current_line < bottom; it++) {
if (current_line >= bottom - height) {
std::string linedata(*it);
linedata += '\n';
@@ -314,7 +314,7 @@ void Console::draw_text()
color_set(0, NULL);
attroff(A_BOLD);
- for (Text::reverse_iterator rit = lines.rbegin(); (y > 0) && (rit != lines.rend()); ++rit) {
+ for (Queue::reverse_iterator rit = lines.rbegin(); (y > 0) && (rit != lines.rend()); ++rit) {
const char *c = (*rit).c_str();
int x = 0;
@@ -360,10 +360,10 @@ void Console::draw()
console_updated = false;
}
-void Console::frame(float seconds)
+void Console::frame()
{
const size_t scroll_offset = 3;
- Text::reverse_iterator upit;
+ History::reverse_iterator upit;
if (!console_initialized)
return;
@@ -467,9 +467,9 @@ void Console::frame(float seconds)
if (input_updated) {
draw_input();
}
- if (roundf(core::game()->serverframetime()) != prev_time) {
+ if (roundf(core::application()->time()) != prev_time) {
draw_status();
- prev_time = roundf(core::game()->serverframetime());
+ prev_time = roundf(core::application()->time());
input_updated = true;
}
if (input_updated) {
diff --git a/src/server/console.h b/src/server/console.h
index 59d65d9..13db3fc 100644
--- a/src/server/console.h
+++ b/src/server/console.h
@@ -25,7 +25,7 @@ public:
/// resize the console
virtual void resize();
/// run one console frame
- void frame(float seconds);
+ void frame();
protected:
/// draw the ncurses console
@@ -44,12 +44,14 @@ protected:
virtual void print(const std::string & text);
private:
+ typedef std::deque<std::string> History;
+
/// set ncurses drawing color
void set_color(const char *color_code);
// input history
- Text history;
- Text::reverse_iterator history_pos;
+ History history;
+ History::reverse_iterator history_pos;
size_t input_pos;
size_t console_scroll;
diff --git a/src/server/server.cc b/src/server/server.cc
index f08ca6c..a4424a0 100644
--- a/src/server/server.cc
+++ b/src/server/server.cc
@@ -58,7 +58,8 @@ void Server::init(int count, char **arguments)
{
con_print << "^BInitializing server..." << std::endl;
- core::Cvar::sv_private = core::Cvar::set("sv_dedicated", "1", core::Cvar::ReadOnly);
+ core::Cvar::set("sv_dedicated", "1", core::Cvar::ReadOnly);
+
core::Application::init(count, arguments);
Console::init();
@@ -78,15 +79,13 @@ void Server::run()
server_framerate = 1.0f / core::Cvar::sv_framerate->value();
core::Timer timer;
- float elapsed = 0;
+ timer.mark();
- while(connected()) {
- timer.mark();
- frame(elapsed);
+ while(connected()) {
+ frame(timer.timestamp());
#ifdef HAVE_CURSES
- console()->frame(elapsed);
+ console()->frame();
#endif
- elapsed = timer.elapsed();
}
}