diff options
author | Stijn Buys <ingar@osirion.org> | 2013-01-01 16:16:59 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2013-01-01 16:16:59 +0000 |
commit | d3ed23de89a7c1ddbb92990eee966966ee8fbeee (patch) | |
tree | b3c48b0b8d2ca3ef847a25746b7fc0fe7505cfef /src/game/base/savegame.cc | |
parent | 614ce1267772d67825a32fb7495a049cd6498fe5 (diff) |
Turrets and cannons can only be mounted in an approriate slot.
Diffstat (limited to 'src/game/base/savegame.cc')
-rw-r--r-- | src/game/base/savegame.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/game/base/savegame.cc b/src/game/base/savegame.cc index ce08659..6d492d0 100644 --- a/src/game/base/savegame.cc +++ b/src/game/base/savegame.cc @@ -185,10 +185,13 @@ void SaveGame::load_game(core::Player *player, filesystem::IniFile & inifile) } } } else if (inifile.got_key_long("slot", l)) { + // verify item type + const Weapon *weapon = ( item->info()->type() == Weapon::infotype() ? static_cast<const Weapon *>(item->info()) : 0); + if ((l > 0) && ((size_t) l <= ship->slots()->size())) { + // verify slot type core::Slot *slot = ship->slots()->operator[]((size_t) (l - 1)); - - if (slot) { + if (slot && (slot->type() == weapon->slot_type())) { slot->set_item(item); slot->set_flag(core::Slot::Active); slot->set_flag(core::Slot::Mounted); |