mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-20 20:23:03 +02:00
gcc 4.5 compatibility fixes. Mostly due to lack of fully finctional nullptr class
This commit is contained in:
parent
6a88604937
commit
6737c270c9
2
Global.h
2
Global.h
@ -575,7 +575,7 @@ namespace vstd
|
||||
if(c.size())
|
||||
return c.back();
|
||||
else
|
||||
return nullptr;
|
||||
return typename Container::value_type();
|
||||
}
|
||||
|
||||
template <typename Container>
|
||||
|
@ -670,7 +670,7 @@ void processCommand(const std::string &message)
|
||||
|
||||
for (size_t i=0; i<cde->ourImages.size(); i++)
|
||||
{
|
||||
std::string filename = outPath + outName + '/' + boost::lexical_cast<std::string>(i);
|
||||
std::string filename = outPath + outName + '/' + boost::lexical_cast<std::string>(i) + ".bmp";
|
||||
SDL_SaveBMP(cde->ourImages[i].bitmap, filename.c_str());
|
||||
}
|
||||
}
|
||||
|
@ -750,7 +750,7 @@ void CArtifactInstance::removeFrom(ArtifactLocation al)
|
||||
|
||||
bool CArtifactInstance::canBeDisassembled() const
|
||||
{
|
||||
return artType->constituents != nullptr;
|
||||
return bool(artType->constituents);
|
||||
}
|
||||
|
||||
std::vector<const CArtifact *> CArtifactInstance::assemblyPossibilities(const CArtifactSet *h) const
|
||||
|
@ -327,9 +327,9 @@ CTerrainViewPatternConfig::CTerrainViewPatternConfig()
|
||||
// Read pattern data
|
||||
const JsonVector & data = ptrnNode["data"].Vector();
|
||||
assert(data.size() == 9);
|
||||
for(int i = 0; i < data.size(); ++i)
|
||||
for(int j = 0; j < data.size(); ++j)
|
||||
{
|
||||
std::string cell = data[i].String();
|
||||
std::string cell = data[j].String();
|
||||
boost::algorithm::erase_all(cell, " ");
|
||||
std::vector<std::string> rules;
|
||||
boost::split(rules, cell, boost::is_any_of(","));
|
||||
@ -344,7 +344,7 @@ CTerrainViewPatternConfig::CTerrainViewPatternConfig()
|
||||
{
|
||||
rule.points = boost::lexical_cast<int>(ruleParts[1]);
|
||||
}
|
||||
pattern.data[i].push_back(rule);
|
||||
pattern.data[j].push_back(rule);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,8 @@ public:
|
||||
void addOperation(unique_ptr<CMapOperation> && operation); /// Client code does not need to call this method.
|
||||
|
||||
private:
|
||||
typedef std::list<unique_ptr<CMapOperation> > TStack;
|
||||
// FIXME: switch back to unique_ptr once gcc 4.5 is abandoned
|
||||
typedef std::list<shared_ptr<CMapOperation> > TStack;
|
||||
|
||||
void doOperation(TStack & fromStack, TStack & toStack, bool doUndo);
|
||||
const CMapOperation * peek(const TStack & stack) const;
|
||||
|
@ -685,7 +685,7 @@ CArtifactInstance * CMapLoaderH3M::createArtifact(int aid, int spellID /*= -1*/)
|
||||
map->addNewArtifactInstance(a);
|
||||
|
||||
//TODO make it nicer
|
||||
if(a->artType && a->artType->constituents != nullptr)
|
||||
if(a->artType && (!!a->artType->constituents))
|
||||
{
|
||||
CCombinedArtifactInstance * comb = dynamic_cast<CCombinedArtifactInstance *>(a);
|
||||
BOOST_FOREACH(CCombinedArtifactInstance::ConstituentInfo & ci, comb->constituentsInfo)
|
||||
|
@ -432,7 +432,7 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance *hero1, const CGHer
|
||||
if(bq->bi == gs->curB)
|
||||
return bq;
|
||||
}
|
||||
return nullptr;
|
||||
return shared_ptr<CBattleQuery>();
|
||||
};
|
||||
|
||||
auto battleQuery = findBattleQuery();
|
||||
@ -1710,7 +1710,7 @@ bool CGameHandler::moveHero( ObjectInstanceID hid, int3 dst, ui8 teleporting, Pl
|
||||
tmh.result = result;
|
||||
sendAndApply(&tmh);
|
||||
|
||||
if(lookForGuards == CHECK_FOR_GUARDS && isInTheMap(guardPos))
|
||||
if(lookForGuards == CHECK_FOR_GUARDS && this->isInTheMap(guardPos))
|
||||
{
|
||||
tmh.attackedFrom = guardPos;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user