1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Added a way to obtain ID of newly added Stack

This commit is contained in:
AlexVinS 2014-11-25 12:26:32 +03:00
parent aa31625774
commit f2bf3d7f7b
5 changed files with 10 additions and 6 deletions

View File

@ -72,9 +72,9 @@ public:
struct LevelInfo
{
std::string description; //descriptions of spell for skill level
si32 cost; //per skill level: 0 - none, 1 - basic, etc
si32 power; //per skill level: 0 - none, 1 - basic, etc
si32 AIValue; //AI values: per skill level: 0 - none, 1 - basic, etc
si32 cost;
si32 power;
si32 AIValue;
bool smartTarget;
bool clearTarget;

View File

@ -1578,6 +1578,9 @@ struct BattleStackAdded : public CPackForClient //3017
int amount;
int pos;
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)
{

View File

@ -1590,6 +1590,7 @@ DLL_LINKAGE void BattleStacksRemoved::applyGs( CGameState *gs )
DLL_LINKAGE void BattleStackAdded::applyGs(CGameState *gs)
{
newStackID = 0;
if (!BattleHex(pos).isValid())
{
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->stacks.push_back(addedStack); //the stack is not "SUMMONED", it is permanent
newStackID = addedStack->ID;
}
DLL_LINKAGE void BattleSetStackProperty::applyGs(CGameState *gs)

View File

@ -69,8 +69,6 @@ public:
bool battleCast(const SpellCastContext & context) const override;
};
class WallMechanics: public DefaultSpellMechanics
{
public:

View File

@ -4353,7 +4353,7 @@ void CGameHandler::handleSpellCasting( SpellID spellID, int spellLvl, BattleHex
sendAndApply (&bsa);
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.val = 0;
ssp.absolute = 1;