mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
MM: MM1: Change disableAttacks view casting to a game message
This commit is contained in:
parent
3a98f3acc4
commit
69a4edff7f
@ -321,12 +321,6 @@ public:
|
||||
*/
|
||||
virtual void displaySpellResult(const InfoMessage &msg) = 0;
|
||||
|
||||
/**
|
||||
* Disable the flags for allowing attacks for
|
||||
* the current character
|
||||
*/
|
||||
virtual void disableAttacks() = 0;
|
||||
|
||||
void iterateMonsters1();
|
||||
void iterateMonsters2();
|
||||
void resetDestMonster();
|
||||
|
@ -65,9 +65,7 @@ Common::String UseItem::combatUseItem(Inventory &inv, Inventory::Entry &invEntry
|
||||
msg = STRING["dialogs.character.use_combat.not_equipped"];
|
||||
}
|
||||
|
||||
Game::Combat *combat = dynamic_cast<Game::Combat *>(g_events->priorView());
|
||||
assert(combat);
|
||||
combat->disableAttacks();
|
||||
g_events->send("Combat", GameMessage("DISABLE_ATTACKS"));
|
||||
|
||||
return msg;
|
||||
}
|
||||
@ -108,10 +106,6 @@ Common::String UseItem::nonCombatUseItem(Inventory &inv, Inventory::Entry &invEn
|
||||
msg = STRING["dialogs.character.use_noncombat.not_equipped"];
|
||||
}
|
||||
|
||||
Game::Combat *combat = dynamic_cast<Game::Combat *>(g_events->priorView());
|
||||
assert(combat);
|
||||
combat->disableAttacks();
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
@ -94,6 +94,10 @@ bool Combat::msgGame(const GameMessage &msg) {
|
||||
|
||||
setMode(SPELL_RESULT);
|
||||
return true;
|
||||
|
||||
} else if (msg._name == "DISABLE_ATTACKS") {
|
||||
disableAttacks();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -230,7 +230,7 @@ public:
|
||||
* Disable the flags for allowing attacks for
|
||||
* the current character
|
||||
*/
|
||||
void disableAttacks() override;
|
||||
void disableAttacks();
|
||||
|
||||
/**
|
||||
* Called when the view is focused
|
||||
|
@ -105,6 +105,10 @@ bool Combat::msgGame(const GameMessage &msg) {
|
||||
if (g_globals->_combatParty[charNum] != g_globals->_currCharacter)
|
||||
exchangeWith(charNum);
|
||||
return true;
|
||||
|
||||
} else if (msg._name == "DISABLE_ATTACKS") {
|
||||
disableAttacks();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -243,7 +243,7 @@ public:
|
||||
* Disable the flags for allowing attacks for
|
||||
* the current character
|
||||
*/
|
||||
void disableAttacks() override;
|
||||
void disableAttacks();
|
||||
|
||||
/**
|
||||
* Called when the view is focused
|
||||
|
Loading…
Reference in New Issue
Block a user