Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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();