diff --git a/Global.h b/Global.h index 73b5e4bbc..32610cd3b 100644 --- a/Global.h +++ b/Global.h @@ -331,7 +331,8 @@ namespace vstd { assert(r.size()); index %= r.size(); - auto itr = std::begin(r); + // auto itr = std::begin(r); //not available in gcc-4.5 + auto itr = r.begin(); std::advance(itr, index); return *itr; } diff --git a/lib/BattleState.cpp b/lib/BattleState.cpp index a37ebd10d..f156f84c1 100644 --- a/lib/BattleState.cpp +++ b/lib/BattleState.cpp @@ -2597,7 +2597,7 @@ shared_ptr BattleInfo::getObstacleOnTile(BattleHex tile) cons if(vstd::contains(obs->getAffectedTiles(), tile)) return obs; - return NULL; + return shared_ptr(); } const CStack * BattleInfo::getStackIf(boost::function pred) const diff --git a/lib/CGameState.cpp b/lib/CGameState.cpp index 092338c76..cf6bff293 100644 --- a/lib/CGameState.cpp +++ b/lib/CGameState.cpp @@ -592,7 +592,7 @@ std::pair CGameState::pickObject (CGObjectInstance *obj) //golem factory is not in list of cregens but can be placed as random object static const int factoryCreatures[] = {32, 33, 116, 117}; - std::vector factory(std::begin(factoryCreatures), std::end(factoryCreatures)); + std::vector factory(factoryCreatures, factoryCreatures + ARRAY_COUNT(factoryCreatures)); if (vstd::contains(factory, cid)) result = std::pair(20, 1); diff --git a/lib/CObjectHandler.cpp b/lib/CObjectHandler.cpp index 38cc8af3b..f5e6ee8ee 100644 --- a/lib/CObjectHandler.cpp +++ b/lib/CObjectHandler.cpp @@ -2360,7 +2360,7 @@ void CGTownInstance::recreateBuildingsBonuses() bool CGTownInstance::addBonusIfBuilt(int building, int type, int val, int subtype /*= -1*/) { - return addBonusIfBuilt(building, type, val, NULL, subtype); + return addBonusIfBuilt(building, type, val, TPropagatorPtr(), subtype); } bool CGTownInstance::addBonusIfBuilt(int building, int type, int val, TPropagatorPtr prop, int subtype /*= -1*/) diff --git a/lib/CObstacleInstance.cpp b/lib/CObstacleInstance.cpp index 726963c04..4a040b9e0 100644 --- a/lib/CObstacleInstance.cpp +++ b/lib/CObstacleInstance.cpp @@ -134,5 +134,5 @@ std::vector MoatObstacle::getAffectedTiles() const { //rrr... need initializer lists static const BattleHex moatHexes[] = {11, 28, 44, 61, 77, 111, 129, 146, 164, 181}; - return std::vector(std::begin(moatHexes), std::end(moatHexes)); + return std::vector(moatHexes, moatHexes + ARRAY_COUNT(moatHexes)); } \ No newline at end of file diff --git a/lib/IGameCallback.cpp b/lib/IGameCallback.cpp index 6e212e6e3..7eb151504 100644 --- a/lib/IGameCallback.cpp +++ b/lib/IGameCallback.cpp @@ -416,7 +416,7 @@ const CGHeroInstance * CBattleInfoCallback::battleGetFightingHero(ui8 side) cons shared_ptr CBattleInfoCallback::battleGetObstacleOnPos(BattleHex tile, bool onlyBlocking /*= true*/) { if(!gs->curB) - return NULL; + return shared_ptr(); BOOST_FOREACH(auto &obs, battleGetAllObstacles()) { @@ -426,7 +426,7 @@ shared_ptr CBattleInfoCallback::battleGetObstacleOnPos( return obs; } } - return NULL; + return shared_ptr(); } int CBattleInfoCallback::battleGetMoatDmg() diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 6da4e8451..35a71b446 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -999,7 +999,7 @@ int CGameHandler::moveStack(int stack, BattleHex dest) { // send one package with the creature path information - shared_ptr obstacle = NULL; //obstacle that interrupted movement + shared_ptr obstacle; //obstacle that interrupted movement std::vector tiles; int tilesToMove = std::max((int)(path.first.size() - creSpeed), 0); int v = path.first.size()-1; @@ -1036,7 +1036,7 @@ startWalking: //if stack didn't die in explosion, continue movement if(!obstacle->stopsMovement() && curStack->alive()) { - obstacle = NULL; + obstacle.reset(); tiles.clear(); v--; goto startWalking; //TODO it's so evil