From d3ed23de89a7c1ddbb92990eee966966ee8fbeee Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 1 Jan 2013 16:16:59 +0000 Subject: Turrets and cannons can only be mounted in an approriate slot. --- src/game/base/savegame.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/game/base/savegame.cc') 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(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); -- cgit v1.2.3