1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-10-08 23:22:25 +02:00

Practically finished combined artifacts changes, many other fixes.

This commit is contained in:
Michał W. Urbańczyk
2011-01-28 02:11:58 +00:00
parent 092ab5a77f
commit a75a37008f
17 changed files with 419 additions and 315 deletions

View File

@@ -306,19 +306,18 @@ CCreatureSet::~CCreatureSet()
clear();
}
void CCreatureSet::setToArmy(CCreatureSet &src)
void CCreatureSet::setToArmy(CSimpleArmy &src)
{
clear();
while(src)
{
TSlots::iterator i = src.stacks.begin();
TSimpleSlots::iterator i = src.army.begin();
assert(i->second->type);
assert(i->second->valid(false));
assert(i->second->armyObj == NULL);
assert(i->second.type);
assert(i->second.count);
putStack(i->first, i->second);
src.stacks.erase(i);
putStack(i->first, new CStackInstance(i->second.type, i->second.count));
src.army.erase(i);
}
}
@@ -523,4 +522,21 @@ DLL_EXPORT std::ostream & operator<<(std::ostream & str, const CStackInstance &
str << sth.idRand;
return str;
}
void CSimpleArmy::clear()
{
army.clear();
}
CSimpleArmy::operator bool() const
{
return army.size();
}
bool CSimpleArmy::setCreature(TSlot slot, TCreature cre, TQuantity count)
{
assert(!vstd::contains(army, slot));
army[slot] = CStackBasicDescriptor(cre, count);
return true;
}