From e5aada2bf01e51753829215c0a3035aa8bd8135a Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 5 Jul 2008 10:17:39 +0000 Subject: ncurses updates, refactored say --- src/core/application.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/core/application.cc') diff --git a/src/core/application.cc b/src/core/application.cc index cd6d278..f8c563c 100644 --- a/src/core/application.cc +++ b/src/core/application.cc @@ -59,6 +59,17 @@ void func_disconnect(std::string const &args) application()->disconnect(); } +void func_say(std::string const &args) +{ + if (connection()) { + connection()->say(args); + } else if (server()) { + server()->say(localplayer(), args); + } else { + con_print << "Not connected." << std::endl; + } +} + // --------------- signal_handler ----------------------------------- #ifndef _WIN32 @@ -207,6 +218,9 @@ void Application::init(int count, char **arguments) func = Func::add("disconnect", func_disconnect); func->set_info("leave the current game"); + + func = Func::add("say",func_say); + func->set_info("say [text] say something on the public chat"); } void Application::shutdown() @@ -224,6 +238,7 @@ void Application::shutdown() save_config(); // remove our engine functions + Func::remove("say"); Func::remove("help"); Func::remove("quit"); -- cgit v1.2.3