mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
- gcc 4.5 / boost 1.46 compilation fixes
- configure will accept CXXFLAGS parameter correctly - boost version check in ERMParser - to skip compilation with old boost
This commit is contained in:
parent
c6d0814062
commit
407acce4c6
@ -232,29 +232,37 @@ void CBattleLogic::MakeStatistics(int currentCreatureId)
|
||||
{
|
||||
m_bEnemyDominates = false;
|
||||
}
|
||||
|
||||
//boost compile hack
|
||||
typedef int const std::pair<int, int>::* IntPtr;
|
||||
typedef int const SCreatureCasualties::* CreaPtr;
|
||||
typedef SCreatureCasualties const std::pair<int, SCreatureCasualties>::* CreaPairPtr;
|
||||
|
||||
// sort max damage
|
||||
std::sort(m_statMaxDamage.begin(), m_statMaxDamage.end(),
|
||||
bind(&creature_stat::value_type::second, _1) > bind(&creature_stat::value_type::second, _2));
|
||||
bind((IntPtr)&creature_stat::value_type::second, _1) > bind((IntPtr)&creature_stat::value_type::second, _2));
|
||||
// sort min damage
|
||||
std::sort(m_statMinDamage.begin(), m_statMinDamage.end(),
|
||||
bind(&creature_stat::value_type::second, _1) > bind(&creature_stat::value_type::second, _2));
|
||||
bind((IntPtr)&creature_stat::value_type::second, _1) > bind((IntPtr)&creature_stat::value_type::second, _2));
|
||||
// sort max speed
|
||||
std::sort(m_statMaxSpeed.begin(), m_statMaxSpeed.end(),
|
||||
bind(&creature_stat::value_type::second, _1) > bind(&creature_stat::value_type::second, _2));
|
||||
bind((IntPtr)&creature_stat::value_type::second, _1) > bind((IntPtr)&creature_stat::value_type::second, _2));
|
||||
// sort distance
|
||||
std::sort(m_statDistance.begin(), m_statDistance.end(),
|
||||
bind(&creature_stat::value_type::second, _1) < bind(&creature_stat::value_type::second, _2));
|
||||
bind((IntPtr)&creature_stat::value_type::second, _1) < bind((IntPtr)&creature_stat::value_type::second, _2));
|
||||
// sort distance from shooters
|
||||
std::sort(m_statDistanceFromShooters.begin(), m_statDistanceFromShooters.end(),
|
||||
bind(&creature_stat::value_type::second, _1) < bind(&creature_stat::value_type::second, _2));
|
||||
bind((IntPtr)&creature_stat::value_type::second, _1) < bind((IntPtr)&creature_stat::value_type::second, _2));
|
||||
// sort hit points
|
||||
std::sort(m_statHitPoints.begin(), m_statHitPoints.end(),
|
||||
bind(&creature_stat::value_type::second, _1) > bind(&creature_stat::value_type::second, _2));
|
||||
bind((IntPtr)&creature_stat::value_type::second, _1) > bind((IntPtr)&creature_stat::value_type::second, _2));
|
||||
// sort casualties
|
||||
std::sort(m_statCasualties.begin(), m_statCasualties.end(),
|
||||
bind(&creature_stat_casualties::value_type::second_type::damage_max, bind(&creature_stat_casualties::value_type::second, _1))
|
||||
bind((CreaPtr)&creature_stat_casualties::value_type::second_type::damage_max,
|
||||
bind((CreaPairPtr)&creature_stat_casualties::value_type::second, _1))
|
||||
>
|
||||
bind(&creature_stat_casualties::value_type::second_type::damage_max, bind(&creature_stat_casualties::value_type::second, _2)));
|
||||
bind((CreaPtr)&creature_stat_casualties::value_type::second_type::damage_max,
|
||||
bind((CreaPairPtr)&creature_stat_casualties::value_type::second, _2)));
|
||||
}
|
||||
|
||||
BattleAction CBattleLogic::MakeDecision(int stackID)
|
||||
|
@ -207,7 +207,7 @@ static CApplier<CBaseForPGApply> *applier = NULL;
|
||||
|
||||
CMenuScreen::CMenuScreen( EState which )
|
||||
{
|
||||
OBJ_CONSTRUCTION;//FIXME: Memory leak in buttons? Images on them definitely were not freed after game start
|
||||
OBJ_CONSTRUCTION;
|
||||
bgAd = NULL;
|
||||
|
||||
switch(which)
|
||||
@ -220,7 +220,7 @@ CMenuScreen::CMenuScreen( EState which )
|
||||
bind(&CMenuScreen::moveTo, this, ref(CGP->scrs[loadGame])), 532, 132, "ZMENULG.DEF", SDLK_l);
|
||||
buttons[2] = new AdventureMapButton("", CGI->generaltexth->zelp[5].second, 0, 524, 251, "ZMENUHS.DEF", SDLK_h); // Highscore
|
||||
buttons[3] = new AdventureMapButton("", CGI->generaltexth->zelp[6].second, 0 /*cb*/, 557, 359, "ZMENUCR.DEF", SDLK_c); // Credits
|
||||
boost::function<void()> confWindow = bind(CInfoWindow::showYesNoDialog, ref(CGI->generaltexth->allTexts[69]), (const std::vector<SComponent*>*)0, do_quit, 0, false, 1);
|
||||
boost::function<void()> confWindow = bind(CInfoWindow::showYesNoDialog, boost::ref(CGI->generaltexth->allTexts[69]), (const std::vector<SComponent*>*)0, do_quit, 0, false, 1);
|
||||
buttons[4] = new AdventureMapButton("", CGI->generaltexth->zelp[7].second, confWindow, 586, 468, "ZMENUQT.DEF", SDLK_ESCAPE); // Exit
|
||||
}
|
||||
break;
|
||||
|
@ -909,12 +909,12 @@ unsigned char CMapHandler::getHeroFrameNum(unsigned char dir, bool isMoving) con
|
||||
{
|
||||
if(isMoving)
|
||||
{
|
||||
static const unsigned char frame [] = {-1, 10, 5, 6, 7, 8, 9, 12, 11};
|
||||
static const unsigned char frame [] = {0xff, 10, 5, 6, 7, 8, 9, 12, 11};
|
||||
return frame[dir];
|
||||
}
|
||||
else //if(isMoving)
|
||||
{
|
||||
static const unsigned char frame [] = {-1, 13, 0, 1, 2, 3, 4, 15, 14};
|
||||
static const unsigned char frame [] = {0xff, 13, 0, 1, 2, 3, 4, 15, 14};
|
||||
return frame[dir];
|
||||
}
|
||||
}
|
||||
|
2
configure
vendored
2
configure
vendored
@ -14497,7 +14497,7 @@ else
|
||||
fi
|
||||
|
||||
if test "x$GXX" = "xyes" -a "x$enable_debug" = "xyes" ; then
|
||||
CXXFLAGS="-O0 -ggdb"
|
||||
CXXFLAGS="$CXXFLAGS -O0 -ggdb"
|
||||
fi
|
||||
|
||||
if test "x$GXX" = "xyes" ; then
|
||||
|
@ -25,7 +25,7 @@ AC_ARG_ENABLE(debug,
|
||||
fi],
|
||||
[ enable_debug="yes" ])
|
||||
if test "x$GXX" = "xyes" -a "x$enable_debug" = "xyes" ; then
|
||||
CXXFLAGS="-O0 -ggdb"
|
||||
CXXFLAGS="$CXXFLAGS -O0 -ggdb"
|
||||
fi
|
||||
|
||||
if test "x$GXX" = "xyes" ; then
|
||||
|
@ -1,4 +1,9 @@
|
||||
#include "ERMParser.h"
|
||||
#include <boost/version.hpp>
|
||||
//To make compilation with older boost versions possible
|
||||
//Don't know exact version - 1.46 works while 1.42 not
|
||||
#if BOOST_VERSION >= 104600
|
||||
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/spirit/include/phoenix_core.hpp>
|
||||
@ -873,3 +878,9 @@ void ERMParser::repairEncoding( char * str, int len ) const
|
||||
if(str[g] & 0x80)
|
||||
str[g] = '|';
|
||||
}
|
||||
#else
|
||||
|
||||
ERMParser::ERMParser(std::string file){}
|
||||
void ERMParser::parseFile(){}
|
||||
|
||||
#endif
|
||||
|
@ -57,9 +57,9 @@ DLL_EXPORT void initDLL(CConsoleHandler *Console, std::ostream *Logfile)
|
||||
|
||||
using namespace boost::filesystem;
|
||||
//parser checking
|
||||
if(!exists("./Data/s/"))
|
||||
if(!exists(DATA_DIR "/Data/s/"))
|
||||
{
|
||||
tlog3 << "Warning: Folder ./Data/s/ doesn't exist!\n";
|
||||
tlog3 << "Warning: Folder " DATA_DIR "/Data/s/ doesn't exist!\n";
|
||||
return;
|
||||
}
|
||||
directory_iterator enddir;
|
||||
|
Loading…
Reference in New Issue
Block a user