mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-23 00:28:08 +02:00
second part of c++11 update. gcc 4.5 and VS 2010 are no longer supported
- BOOST_FOREACH -> for - replaced several boost classes with std (e.g. unordered) - removed gcc-4.5 workarounds - ran clang c++11 migration tool to detect some cases: - - pointer initialized with "0" to nullptr - - replace for with iterators with range-based for - - use auto in some situations (type name specified twice, avoid long iterators type names)
This commit is contained in:
@ -21,14 +21,14 @@ Res::ResourceSet::ResourceSet()
|
||||
Res::ResourceSet::ResourceSet(const JsonNode & node)
|
||||
{
|
||||
reserve(GameConstants::RESOURCE_QUANTITY);
|
||||
BOOST_FOREACH(std::string name, GameConstants::RESOURCE_NAMES)
|
||||
for(std::string name : GameConstants::RESOURCE_NAMES)
|
||||
push_back(node[name].Float());
|
||||
}
|
||||
|
||||
bool Res::ResourceSet::nonZero() const
|
||||
{
|
||||
for(int i = 0; i < size(); i++)
|
||||
if(at(i))
|
||||
for(auto & elem : *this)
|
||||
if(elem)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -36,8 +36,8 @@ bool Res::ResourceSet::nonZero() const
|
||||
|
||||
void Res::ResourceSet::amax(const TResourceCap &val)
|
||||
{
|
||||
for(int i = 0; i < size(); i++)
|
||||
::vstd::amax(at(i), val);
|
||||
for(auto & elem : *this)
|
||||
::vstd::amax(elem, val);
|
||||
}
|
||||
|
||||
bool Res::ResourceSet::canBeAfforded(const ResourceSet &res) const
|
||||
|
Reference in New Issue
Block a user