diff options
-rw-r--r-- | src/client/chat.cc | 15 | ||||
-rw-r--r-- | src/client/chat.h | 5 | ||||
-rw-r--r-- | src/client/client.h | 5 | ||||
-rw-r--r-- | src/core/application.h | 1 | ||||
-rw-r--r-- | src/core/entity.cc | 4 | ||||
-rw-r--r-- | src/core/gameserver.cc | 6 | ||||
-rw-r--r-- | src/core/netserver.cc | 3 | ||||
-rw-r--r-- | src/dedicated/console.cc | 2 |
8 files changed, 31 insertions, 10 deletions
diff --git a/src/client/chat.cc b/src/client/chat.cc index bdce6d8..cf995cb 100644 --- a/src/client/chat.cc +++ b/src/client/chat.cc @@ -34,7 +34,7 @@ Chat::Chat(ui::Widget *parent) : ui::Window(parent) chat_input = new ui::InputBox(this); chat_input->set_border(false); - chat_input->set_prompt("^BSay^F:^B "); + set_prompt(); chat_input->set_focus(); set_background(true); @@ -117,7 +117,8 @@ bool Chat::on_keypress(const int key, const unsigned int modifier) core::cmd() << &chat_input->text().c_str()[1] << std::endl; } else { // FIXME semi-column ; truncates the command - core::cmd() << "say " << chat_input->text() << std::endl; + //core::cmd() << "say " << chat_input->text() << std::endl; + client()->say(chat_input->text()); } (*history.rbegin()) = chat_input->text(); @@ -165,12 +166,22 @@ bool Chat::on_keypress(const int key, const unsigned int modifier) return false; } +void Chat::set_prompt() +{ + if (chat_input->text().size() && chat_input->text()[0] == '/') { + chat_input->set_prompt("^BCommand^F:^B "); + } else { + chat_input->set_prompt("^BSay^F:^B "); + } +} + void Chat::draw() { if (!chat_small && (chat_playerlist_timestamp != core::game()->playerlist_timestamp())) { update_player_list(); } + set_prompt(); ui::Window::draw(); } diff --git a/src/client/chat.h b/src/client/chat.h index 0972400..fa50e87 100644 --- a/src/client/chat.h +++ b/src/client/chat.h @@ -43,6 +43,11 @@ protected: virtual void resize(); virtual bool on_keypress(const int key, const unsigned int modifier); + + /** + * @brief set the chatbox prompt to 'say:' or 'command:' depending on the current input text. + */ + void set_prompt(); private: diff --git a/src/client/client.h b/src/client/client.h index 85562a1..ddc6dd5 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -73,6 +73,11 @@ public: return client_testmodelview; } + /// local client seds a chat message + inline void say(std::string const &text) { + func_say(text); + } + protected: /// run a client frame virtual void frame(); diff --git a/src/core/application.h b/src/core/application.h index cdaef67..3f71b4c 100644 --- a/src/core/application.h +++ b/src/core/application.h @@ -124,6 +124,7 @@ private: static Application *application_instance; +protected: /*-- engine functions --*/ static void func_help(std::string const &args); diff --git a/src/core/entity.cc b/src/core/entity.cc index 6ce94a7..84f4de0 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -492,7 +492,6 @@ void Entity::frame(const unsigned long elapsed) { if (entity_collision_child_shapes.size() > 0) { btCompoundShape *compoundshape = static_cast<btCompoundShape *> (entity_collision_shape); - bool recalculate = false; const float modelscale = radius() / model()->radius(); for (int n = 0; n < compoundshape->getNumChildShapes(); n++) { @@ -524,9 +523,6 @@ void Entity::frame(const unsigned long elapsed) compoundshape->updateChildTransform(n, child_transform); } } - - if (recalculate) - compoundshape->recalculateLocalAabb(); } } } diff --git a/src/core/gameserver.cc b/src/core/gameserver.cc index 58367e5..b4b3322 100644 --- a/src/core/gameserver.cc +++ b/src/core/gameserver.cc @@ -52,7 +52,7 @@ void func_time(std::string const &args) << std::setw(2) << hour << ":" << std::setw(2) << min << ":" << std::setw(2) << sec << " " - << std::setw(2) << " "; + << std::setw(2) << " "; // uptime float uptime = core::game()->time(); @@ -68,9 +68,9 @@ void func_time(std::string const &args) const int uptime_seconds = (int) floorf(uptime); - con_print << " Uptime: "; + con_print << "Uptime: "; if (uptime_days > 0) { - con_print << uptime_days << " " << aux::plural("day", uptime_days); + con_print << uptime_days << " " << aux::plural("day", uptime_days) << " "; } con_print << std::setfill('0') << std::setw(2) << uptime_hours << ":" << std::setfill('0') << std::setw(2) << uptime_minutes << ":" diff --git a/src/core/netserver.cc b/src/core/netserver.cc index d9a5bed..37adfc1 100644 --- a/src/core/netserver.cc +++ b/src/core/netserver.cc @@ -713,6 +713,9 @@ void NetServer::parse_incoming_message(NetClient *client, const std::string & me send_message(client, "info", message); send_disconnect(client); } + + // TODO add player uid to connect message + return; } else if (command.compare("pif") == 0) { diff --git a/src/dedicated/console.cc b/src/dedicated/console.cc index 10fe261..2481f58 100644 --- a/src/dedicated/console.cc +++ b/src/dedicated/console.cc @@ -237,7 +237,7 @@ void Console::draw_status() status << "uptime "; if (uptime_days > 0) { - status << uptime_days << " " << aux::plural("day", uptime_days); + status << uptime_days << " " << aux::plural("day", uptime_days) << " "; } status << std::setfill('0') << std::setw(2) << uptime_hours << ":" << std::setfill('0') << std::setw(2) << uptime_minutes << ":" |