diff options
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); |