mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-15 20:03:15 +02:00
Change vcmiarmy handling a bit
This commit is contained in:
@@ -7116,19 +7116,15 @@ void CGameHandler::handleCheatCode(std::string & cheat, PlayerColor player, cons
|
|||||||
|
|
||||||
std::string creatureIdentifier = words[1];
|
std::string creatureIdentifier = words[1];
|
||||||
|
|
||||||
auto creature = vstd::tryFindIf(VLC->creh->objects,
|
boost::optional<int32_t> creatureId = VLC->modh->identifiers.getIdentifier(CModHandler::scopeGame(), "creature", creatureIdentifier, false);
|
||||||
[creatureIdentifier](auto x)
|
|
||||||
{
|
|
||||||
std::string identifier = x->getJsonKey();
|
|
||||||
boost::to_lower(identifier);
|
|
||||||
return identifier == creatureIdentifier;
|
|
||||||
});
|
|
||||||
|
|
||||||
if(creature.is_initialized())
|
if(creatureId.is_initialized())
|
||||||
{
|
{
|
||||||
|
const CCreature * creature = VLC->creh->objects.at(creatureId.get());
|
||||||
|
|
||||||
for (int i = 0; i < GameConstants::ARMY_SIZE; i++)
|
for (int i = 0; i < GameConstants::ARMY_SIZE; i++)
|
||||||
if (!hero->hasStackAtSlot(SlotID(i)))
|
if (!hero->hasStackAtSlot(SlotID(i)))
|
||||||
insertNewStack(StackLocation(hero, SlotID(i)), creature->get(), 5 * std::pow(10, i));
|
insertNewStack(StackLocation(hero, SlotID(i)), creature, 5 * std::pow(10, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (cheat == "vcminoldor" || cheat == "vcmimachines")
|
else if (cheat == "vcminoldor" || cheat == "vcmimachines")
|
||||||
|
Reference in New Issue
Block a user