diff options
author | Stijn Buys <ingar@osirion.org> | 2008-11-08 16:51:28 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-11-08 16:51:28 +0000 |
commit | 6cd1a38f1d3a0a45846d63a75475400372af1277 (patch) | |
tree | 35bc79e34fe727fc387103a183f80b203c6dfa12 /src/game/base | |
parent | 731dfb8f3ca9c34e4160021cb221c3056c00dbf9 (diff) |
moved message functions into Player class
Diffstat (limited to 'src/game/base')
-rw-r--r-- | src/game/base/base.cc | 27 | ||||
-rw-r--r-- | src/game/base/ship.cc | 18 |
2 files changed, 25 insertions, 20 deletions
diff --git a/src/game/base/base.cc b/src/game/base/base.cc index dfde132..7fa5299 100644 --- a/src/game/base/base.cc +++ b/src/game/base/base.cc @@ -59,7 +59,7 @@ void Base::func_join(core::Player *player, std::string const &args) ship->entity_location.assign(dock->location() + (dock->axis().forward() * dock->radius()*2.0f)); ship->entity_axis.assign(dock->axis()); */ - core::server()->send_sound(player, "game/buy-ship"); + player->sound("game/buy-ship"); std::string message("^B"); message.append(player->name()); @@ -128,34 +128,39 @@ void Base::func_buy(core::Player *player, std::string const &args) player->set_control(ship); core::server()->broadcast("^B" + player->name() + " ^Bpurchased " + aux::article(shipmodel->name())); - core::server()->send_sound(player, "game/buy-ship"); + player->sound("game/buy-ship"); } else { - core::server()->send(player, "Usage: buy [^B" + helpstr + "^N]"); + player->send("Usage: buy [^B" + helpstr + "^N]"); } } // a player sends standard hails void Base::func_hail(core::Player *player, std::string const &args) { + if (player->mute()) { + player->send("^BYou have been muted."); + return; + } + std::string target; std::istringstream is(args); if (!(is >> target)) { - core::server()->send(player, "Usage: hail [player]"); + player->send("Usage: hail [player]"); return; } core::Player *targetplayer = core::server()->find_player(target); if (!targetplayer) { - core::server()->send(player, "^BPlayer " + target + "^B not found."); + player->send("^BPlayer " + target + "^B not found."); return; } - core::server()->send(player, "^BYou hail " + targetplayer->name() + "^B."); - core::server()->send_sound(player, "com/hail"); + player->send("^BYou hail " + targetplayer->name() + "^B."); + player->sound("com/hail"); - core::server()->send(targetplayer, "^B" + player->name() + "^B hails you!"); - core::server()->send_sound(targetplayer, "com/hail"); + targetplayer->send("^B" + player->name() + "^B hails you!"); + targetplayer->send("com/hail"); } // a player actives the hyperspace jump drive on his ship @@ -196,14 +201,14 @@ void Base::func_dock(core::Player *player,core::Entity *entity) return; if (math::distance(entity->location(), player->control()->location()) > 2.0f * entity->radius()) { - core::server()->send(player, "^B" + entity->name() + " is out of range!"); + player->send("^B" + entity->name() + " is out of range!"); return; } player->control()->location().assign(entity->location()); player->control()->set_eventstate(core::Entity::Docked); player->set_view(entity); - core::server()->send(player, "^BDocking at " + entity->name() + "^B..."); + player->send("^BDocking at " + entity->name() + "^B..."); } // launch request diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index 20f37c8..c7a5eda 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -105,23 +105,23 @@ void Ship::jump(std::string const &args) helpstr.append(zone->label()); } - core::server()->send(owner(), "Usage: jump [^B" + helpstr + "^N]"); + owner()->send("Usage: jump [^B" + helpstr + "^N]"); return; } aux::to_lowercase(target); jumptargetzone = core::Zone::find_zone(target); if (!jumptargetzone) { - core::server()->send(owner(), "Unknown system '" + target + '\''); + owner()->send("Unknown system '" + target + '\''); return; } if (jumptargetzone == zone()) { - core::server()->send(owner(), "Already in the " + jumptargetzone->name() + '.'); + owner()->send("Already in the " + jumptargetzone->name() + '.'); return; } - core::server()->send(owner(), "Jumping to the " + jumptargetzone->name()); + owner()->send("Jumping to the " + jumptargetzone->name()); set_zone(jumptargetzone); if (owner()->control() == (EntityControlable*) this) owner()->set_zone(jumptargetzone); @@ -134,14 +134,14 @@ void Ship::jump(std::string const &args) } else { if (!jumpdrive() && !Base::g_devel->value()) { - core::server()->send(owner(), "This ship is not equiped with a hyperspace drive!"); + owner()->send("This ship is not equiped with a hyperspace drive!"); return; } else if (entity_eventstate == core::Entity::Jump) { return; } else if (entity_eventstate == core::Entity::JumpInitiate) { - core::server()->send(owner(), "Jump aborted, hyperspace drive deactivated."); + owner()->send("Jump aborted, hyperspace drive deactivated."); ship_jumpdrive_timer = 0; entity_timer = 0; entity_eventstate = core::Entity::Normal; @@ -183,14 +183,14 @@ JumpPoint * Ship::find_closest_jumppoint() if (jumppoint && jumppoint->target()) { if (Base::g_jumppointrange->value() < d) { - core::server()->send(owner(), "Jumppoint out of range!"); + owner()->send("Jumppoint out of range!"); return 0; } else { - core::server()->send(owner(), "Jumping to the " + jumppoint->target()->zone()->name()); + owner()->send("Jumping to the " + jumppoint->target()->zone()->name()); return jumppoint; } } else { - core::server()->send(owner(), "No jumppoints found!"); + owner()->send("No jumppoints found!"); return 0; } |