1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-17 01:32:21 +02:00

* creature ID refactoring

* double week creatures are configurable now
This commit is contained in:
mateuszb
2013-02-07 17:34:50 +00:00
parent ed3d35554e
commit f1c78e3260
52 changed files with 420 additions and 345 deletions

View File

@ -36,7 +36,7 @@ const CStack * BattleInfo::getNextStack() const
return NULL;
}
int BattleInfo::getAvaliableHex(TCreature creID, bool attackerOwned, int initialPos) const
int BattleInfo::getAvaliableHex(CreatureID::CreatureID creID, bool attackerOwned, int initialPos) const
{
bool twoHex = VLC->creh->creatures[creID]->isDoubleWide();
//bool flying = VLC->creh->creatures[creID]->isFlying();
@ -512,22 +512,22 @@ BattleInfo * BattleInfo::setupBattle( int3 tile, ETerrainType::ETerrainType terr
if(!creatureBank)
{
//Checks if hero has artifact and create appropriate stack
auto handleWarMachine= [&](int side, ArtifactPosition::ArtifactPosition artslot, int cretype, int hex)
auto handleWarMachine= [&](int side, ArtifactPosition::ArtifactPosition artslot, CreatureID::CreatureID cretype, BattleHex hex)
{
if(heroes[side] && heroes[side]->getArt(artslot))
stacks.push_back(curB->generateNewStack(CStackBasicDescriptor(cretype, 1), !side, 255, hex));
};
handleWarMachine(0, ArtifactPosition::MACH1, 146, 52); //ballista
handleWarMachine(0, ArtifactPosition::MACH2, 148, 18); //ammo cart
handleWarMachine(0, ArtifactPosition::MACH3, 147, 154);//first aid tent
handleWarMachine(0, ArtifactPosition::MACH1, CreatureID::BALLISTA, 52);
handleWarMachine(0, ArtifactPosition::MACH2, CreatureID::AMMO_CART, 18);
handleWarMachine(0, ArtifactPosition::MACH3, CreatureID::FIRST_AID_TENT, 154);
if(town && town->hasFort())
handleWarMachine(0, ArtifactPosition::MACH4, 145, 120);//catapult
handleWarMachine(0, ArtifactPosition::MACH4, CreatureID::CATAPULT, 120);
if(!town) //defending hero shouldn't receive ballista (bug #551)
handleWarMachine(1, ArtifactPosition::MACH1, 146, 66); //ballista
handleWarMachine(1, ArtifactPosition::MACH2, 148, 32); //ammo cart
handleWarMachine(1, ArtifactPosition::MACH3, 147, 168); //first aid tent
handleWarMachine(1, ArtifactPosition::MACH1, CreatureID::BALLISTA, 66);
handleWarMachine(1, ArtifactPosition::MACH2, CreatureID::AMMO_CART, 32);
handleWarMachine(1, ArtifactPosition::MACH3, CreatureID::FIRST_AID_TENT, 168);
}
//war machines added
@ -572,15 +572,15 @@ BattleInfo * BattleInfo::setupBattle( int3 tile, ETerrainType::ETerrainType terr
if (curB->siege == CGTownInstance::CITADEL || curB->siege == CGTownInstance::CASTLE)
{
// keep tower
CStack * stack = curB->generateNewStack(CStackBasicDescriptor(149, 1), false, 255, -2);
CStack * stack = curB->generateNewStack(CStackBasicDescriptor(CreatureID::ARROW_TOWERS, 1), false, 255, -2);
stacks.push_back(stack);
if (curB->siege == CGTownInstance::CASTLE)
{
// lower tower + upper tower
CStack * stack = curB->generateNewStack(CStackBasicDescriptor(149, 1), false, 255, -4);
CStack * stack = curB->generateNewStack(CStackBasicDescriptor(CreatureID::ARROW_TOWERS, 1), false, 255, -4);
stacks.push_back(stack);
stack = curB->generateNewStack(CStackBasicDescriptor(149, 1), false, 255, -3);
stack = curB->generateNewStack(CStackBasicDescriptor(CreatureID::ARROW_TOWERS, 1), false, 255, -3);
stacks.push_back(stack);
}