mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-23 00:28:08 +02:00
Added a way to obtain ID of newly added Stack
This commit is contained in:
@ -72,9 +72,9 @@ public:
|
|||||||
struct LevelInfo
|
struct LevelInfo
|
||||||
{
|
{
|
||||||
std::string description; //descriptions of spell for skill level
|
std::string description; //descriptions of spell for skill level
|
||||||
si32 cost; //per skill level: 0 - none, 1 - basic, etc
|
si32 cost;
|
||||||
si32 power; //per skill level: 0 - none, 1 - basic, etc
|
si32 power;
|
||||||
si32 AIValue; //AI values: per skill level: 0 - none, 1 - basic, etc
|
si32 AIValue;
|
||||||
|
|
||||||
bool smartTarget;
|
bool smartTarget;
|
||||||
bool clearTarget;
|
bool clearTarget;
|
||||||
|
@ -1579,6 +1579,9 @@ struct BattleStackAdded : public CPackForClient //3017
|
|||||||
int pos;
|
int pos;
|
||||||
int summoned; //if true, remove it afterwards
|
int summoned; //if true, remove it afterwards
|
||||||
|
|
||||||
|
///Actual stack ID, set on apply, do not serialize
|
||||||
|
int newStackID;
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
h & attacker & creID & amount & pos & summoned;
|
h & attacker & creID & amount & pos & summoned;
|
||||||
|
@ -1590,6 +1590,7 @@ DLL_LINKAGE void BattleStacksRemoved::applyGs( CGameState *gs )
|
|||||||
|
|
||||||
DLL_LINKAGE void BattleStackAdded::applyGs(CGameState *gs)
|
DLL_LINKAGE void BattleStackAdded::applyGs(CGameState *gs)
|
||||||
{
|
{
|
||||||
|
newStackID = 0;
|
||||||
if (!BattleHex(pos).isValid())
|
if (!BattleHex(pos).isValid())
|
||||||
{
|
{
|
||||||
logNetwork->warnStream() << "No place found for new stack!";
|
logNetwork->warnStream() << "No place found for new stack!";
|
||||||
@ -1603,6 +1604,8 @@ DLL_LINKAGE void BattleStackAdded::applyGs(CGameState *gs)
|
|||||||
|
|
||||||
gs->curB->localInitStack(addedStack);
|
gs->curB->localInitStack(addedStack);
|
||||||
gs->curB->stacks.push_back(addedStack); //the stack is not "SUMMONED", it is permanent
|
gs->curB->stacks.push_back(addedStack); //the stack is not "SUMMONED", it is permanent
|
||||||
|
|
||||||
|
newStackID = addedStack->ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
DLL_LINKAGE void BattleSetStackProperty::applyGs(CGameState *gs)
|
DLL_LINKAGE void BattleSetStackProperty::applyGs(CGameState *gs)
|
||||||
|
@ -69,8 +69,6 @@ public:
|
|||||||
bool battleCast(const SpellCastContext & context) const override;
|
bool battleCast(const SpellCastContext & context) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class WallMechanics: public DefaultSpellMechanics
|
class WallMechanics: public DefaultSpellMechanics
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -4353,7 +4353,7 @@ void CGameHandler::handleSpellCasting( SpellID spellID, int spellLvl, BattleHex
|
|||||||
sendAndApply (&bsa);
|
sendAndApply (&bsa);
|
||||||
|
|
||||||
BattleSetStackProperty ssp;
|
BattleSetStackProperty ssp;
|
||||||
ssp.stackID = gs->curB->stacks.back()->ID; //how to get recent stack?
|
ssp.stackID = bsa.newStackID;
|
||||||
ssp.which = BattleSetStackProperty::CLONED; //using enum values
|
ssp.which = BattleSetStackProperty::CLONED; //using enum values
|
||||||
ssp.val = 0;
|
ssp.val = 0;
|
||||||
ssp.absolute = 1;
|
ssp.absolute = 1;
|
||||||
|
Reference in New Issue
Block a user