diff options
author | Stijn Buys <ingar@osirion.org> | 2008-05-24 12:49:33 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-05-24 12:49:33 +0000 |
commit | 1af2280ebabbd41c8b77747b6834fefbde0f0e80 (patch) | |
tree | b7501865a383b6789ed755261eb9e1467dd73cd7 /src/game | |
parent | 1b8c92e759adf6605803d86931d349a06f963554 (diff) |
Hail
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/game.cc | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/game/game.cc b/src/game/game.cc index ea72ce0..79c9040 100644 --- a/src/game/game.cc +++ b/src/game/game.cc @@ -99,16 +99,31 @@ void func_buy(core::Player *player, std::string const &args) core::server()->broadcast("^B" + player->name() + " ^Bpurchased " + aux::article(shipmodel->name())); player->player_dirty = true; } else { - core::server()->send(player, "Usage: buy <" + helpstr + "^N>"); + core::server()->send(player, "Usage: buy [" + helpstr + "^N]"); } } /// a player sends standard hails void func_hail(core::Player *player, std::string const &args) { - core::server()->send(player, "You broadcast a standard standard hail."); - core::server()->broadcast("^B" + player->name() + " ^Bbroadcasts a standard hail!", player); - core::server()->broadcast_sound("com/hail"); + std::string target; + std::istringstream is(args); + if (!(is >> target)) { + core::server()->send(player, "Usage: hail [player]"); + return; + } + + core::Player *targetplayer = core::server()->find_player(target); + if (!targetplayer) { + core::server()->send(player, "Player " + target + "^N not found."); + return; + } + + core::server()->send(player, "^BYou hail " + targetplayer->name() + "^B."); + core::server()->send_sound(player, "com/hail"); + + core::server()->send(targetplayer, "^B" + player->name() + "^B hails you!"); + core::server()->send_sound(targetplayer, "com/hail"); } /*----- Game ------------------------------------------------------ */ |