From b7d62e90a7a0e4e404623af0c646495a3dd3fd2b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 31 May 2011 13:17:14 +0000 Subject: Removed a forced recalculateLocalAabb for compound shapes, semi-colon in chat messages doesn't truncate the chat text any more, changed chat prompt to "Command:" if the first character is a slash, small misc cleanups --- src/client/chat.cc | 15 +++++++++++++-- src/client/chat.h | 5 +++++ src/client/client.h | 5 +++++ src/core/application.h | 1 + src/core/entity.cc | 4 ---- src/core/gameserver.cc | 6 +++--- src/core/netserver.cc | 3 +++ src/dedicated/console.cc | 2 +- 8 files changed, 31 insertions(+), 10 deletions(-) (limited to 'src') 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 (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 << ":" -- cgit v1.2.3