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>2013-01-06 21:07:18 +0000
committerStijn Buys <ingar@osirion.org>2013-01-06 21:07:18 +0000
commitc92839e5205f008a226ed82d5388e0c858ca7291 (patch)
treebeab7e3d5e5d022715460629ac9882cc1b9d6e3c /src/game
parentfdbfbbaf4fdee153fd087cba65305b0756550bbb (diff)
Corrected an issue where weapons obtained through 'give' are not mountable.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/base/game.cc44
1 files changed, 26 insertions, 18 deletions
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index b115d70..7f2fb40 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -516,24 +516,32 @@ void Game::func_give(core::Player *player, const std::string &args)
core::Item *item = 0;
- if ( (weapon->subtype() == Weapon::Ammo) || (weapon->subtype() == Weapon::Mine)) {
- item = player->control()->inventory()->find(weapon);
- if (!item) {
- item = new core::Item(weapon);
- item->set_flag(core::Item::Unrestricted);
- player->control()->inventory()->add(item);
- } else {
- assert(item->info() == weapon);
- }
- item->inc_amount(amount);
- } else {
- for (int n = 0; n < amount; n++) {
- item = new core::Item(weapon);
- item->set_flag(core::Item::Unique);
- item->set_flag(core::Item::Unrestricted);
- item->set_amount(1);
- player->control()->inventory()->add(item);
- }
+ switch (weapon->subtype()) {
+
+ case Weapon::Ammo:
+ case Weapon::Mine:
+ item = player->control()->inventory()->find(weapon);
+ if (!item) {
+ item = new core::Item(weapon);
+ item->set_flag(core::Item::Unrestricted);
+ player->control()->inventory()->add(item);
+ } else {
+ assert(item->info() == weapon);
+ }
+ item->inc_amount(amount);
+ break;
+
+ case Weapon::Cannon:
+ case Weapon::Turret:
+ for (int n = 0; n < amount; n++) {
+ item = new core::Item(weapon);
+ item->set_flag(core::Item::Unique);
+ item->set_flag(core::Item::Mountable);
+ item->set_flag(core::Item::Unrestricted);
+ item->set_amount(1);
+ player->control()->inventory()->add(item);
+ }
+ break;
}
player->control()->inventory()->set_dirty();