Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-06-07 18:13:15 +0000
committerStijn Buys <ingar@osirion.org>2009-06-07 18:13:15 +0000
commitf33257521bf80dcef8575c4fc3ddaf4a40ff588a (patch)
tree5e3a112e814478ba3ab624e0867761654a5ea0a4 /src/game
parent5b94df1df2707b36401d91d80b92d0e4cdfd2277 (diff)
fixed a few widget order problems, changed map targetting behaviour
Diffstat (limited to 'src/game')
-rw-r--r--src/game/base/game.cc22
-rw-r--r--src/game/base/shipdealer.cc2
-rw-r--r--src/game/base/shipmodel.cc6
3 files changed, 23 insertions, 7 deletions
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index da060b9..4128af8 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -195,17 +195,27 @@ void Game::func_dock(core::Player *player, core::Entity *entity)
void Game::func_buy(core::Player *player, const std::string &args)
{
std::istringstream is(args);
+ std::string itemclass;
std::string itemtype;
- if (!(is >> itemtype)) {
- player->send("usage: buy [string] [string] buy type of item, name of item");
+
+ if (!(is >> itemclass)) {
+ player->send("usage: buy [string] [string] buy an item of a specified class and type");
return;
+ } else {
+ aux::to_label(itemclass);
+ }
+
+ if (!(is >> itemtype)) {
+ itemtype.clear();
+ } else {
+ aux::to_label(itemtype);
}
- aux::to_label(itemtype);
- if ((args.size() > 5 ) && (itemtype.compare("ship") == 0)) {
- ShipDealer::func_buy(player, args.substr(5, args.size() - 5));
+
+ if (itemclass.compare("ship") == 0) {
+ ShipDealer::func_buy(player, itemtype);
} else {
- player->send("unkown item type '" + itemtype + "'");
+ player->send("unkown item class '" + itemclass + "'");
}
return;
diff --git a/src/game/base/shipdealer.cc b/src/game/base/shipdealer.cc
index e28b922..feef432 100644
--- a/src/game/base/shipdealer.cc
+++ b/src/game/base/shipdealer.cc
@@ -88,7 +88,7 @@ void ShipDealer::func_buy(core::Player *player, const std::string &args)
helpstr.append("^N|^B");
helpstr.append((*smit).second->label());
}
- player->send("Usage: buy [^B" + helpstr + "^N]");
+ player->send("Usage: buy ship [^B" + helpstr + "^N]");
return;
}
diff --git a/src/game/base/shipmodel.cc b/src/game/base/shipmodel.cc
index b3802f7..9d905d6 100644
--- a/src/game/base/shipmodel.cc
+++ b/src/game/base/shipmodel.cc
@@ -107,6 +107,9 @@ ShipModel *ShipModel::find(ShipModel *shipmodel)
ShipModel *ShipModel::find(const std::string label)
{
+ if (!label.size())
+ return 0;
+
std::map<std::string, ShipModel *>::iterator it = registry.find(label);
if (it == registry.end())
return 0;
@@ -116,6 +119,9 @@ ShipModel *ShipModel::find(const std::string label)
ShipModel *ShipModel::search(const std::string searchname)
{
+ if (!searchname.size())
+ return 0;
+
std::string strsearchkey(aux::lowercase(searchname));
if (strsearchkey.size() < 3) {
return 0;