From: <tz...@us...> - 2006-05-21 07:22:49
|
Revision: 1827 Author: tzlaine Date: 2006-05-21 00:22:41 -0700 (Sun, 21 May 2006) ViewCVS: http://svn.sourceforge.net/freeorion?rev=1827&view=rev Log Message: ----------- Brought the project up to date a bit, by changing the code to work with the latest version of GraphViz and the much stricter gcc 4.1. Also changes all calls to env.Append() in the SCons files to env.AppendUnique(). Modified Paths: -------------- trunk/FreeOrion/SConstruct trunk/FreeOrion/UI/TechTreeWnd.cpp trunk/FreeOrion/build_config.py trunk/FreeOrion/build_support.py trunk/FreeOrion/universe/ValueRefParser.cpp Modified: trunk/FreeOrion/SConstruct =================================================================== --- trunk/FreeOrion/SConstruct 2006-03-23 05:20:46 UTC (rev 1826) +++ trunk/FreeOrion/SConstruct 2006-05-21 07:22:41 UTC (rev 1827) @@ -203,7 +203,7 @@ else: if OptionValue('boost_signals_namespace', env): signals_namespace = OptionValue('boost_signals_namespace', env) - env.Append(CPPDEFINES = [ + env.AppendUnique(CPPDEFINES = [ ('BOOST_SIGNALS_NAMESPACE', signals_namespace), ('signals', signals_namespace) ]) @@ -219,14 +219,14 @@ if str(Platform()) == 'posix': if env['multithreaded']: if conf.CheckCHeader('pthread.h') and conf.CheckLib('pthread', 'pthread_create', autoadd = 0): - env.Append(CCFLAGS = ' -pthread') - env.Append(LINKFLAGS = ' -pthread') + env.AppendUnique(CCFLAGS = ' -pthread') + env.AppendUnique(LINKFLAGS = ' -pthread') else: Exit(1) # GL and GLU if str(Platform()) == 'win32': - env.Append(LIBS = [ + env.AppendUnique(LIBS = [ 'opengl32.lib', 'glu32.lib' ]) @@ -266,7 +266,7 @@ if not conf.CheckLib('freetype', 'FT_Init_FreeType'): Exit(1) else: - env.Append(LIBS = [ft_win32_lib_name]) + env.AppendUnique(LIBS = [ft_win32_lib_name]) # DevIL (aka IL) AppendPackagePaths('devil', env) @@ -325,30 +325,26 @@ if not conf.CheckLib('fmod-' + fmod_version, 'FSOUND_GetVersion', header = '#include <fmod.h>'): Exit(1) else: - env.Append(LIBS = [fmod_win32_lib_name]) + env.AppendUnique(LIBS = [fmod_win32_lib_name]) # GraphViz AppendPackagePaths('graphviz', env) if pkg_config: - if conf.CheckPkg('graphviz', graphviz_pkgconfig_version): - env.ParseConfig('pkg-config --cflags --libs graphviz') - elif conf.CheckPkg('libdotneato', graphviz_pkgconfig_version): - env.ParseConfig('pkg-config --cflags --libs libdotneato') - if not conf.CheckCHeader('graphviz/render.h') and not conf.CheckCHeader('render.h'): - Exit(1) - env.Append(LIBS = [ - 'cdt', - 'common', - 'dotgen', - 'dotneato', - 'graph', - 'gvrender', - 'pathplan' - ]) - if str(Platform()) != 'win32': - old_libs = env['LIBS'] - if not conf.CheckLib('dotgen', 'begin_component', header = '#include <graphviz/render.h>\n#include <graphviz/dotprocs.h>'): + if conf.CheckPkg('libgraph', graphviz_pkgconfig_version) and conf.CheckPkg('libgvc', graphviz_pkgconfig_version): + env.ParseConfig('pkg-config --cflags --libs libgraph') + env.ParseConfig('pkg-config --cflags --libs libgvc') + found_it_with_pkg_config = True + if not found_it_with_pkg_config: + if not conf.CheckCHeader('gvc.h'): Exit(1) + if str(Platform()) != 'win32': + if not conf.CheckLib('gvc', 'gvContext', header = '#include <gvc.h>'): + Exit(1) + env.AppendUnique(LIBS = [ + 'cdt', + 'graph', + 'gvc' + ]) # Log4cpp AppendPackagePaths('log4cpp', env) @@ -390,15 +386,15 @@ # define targets # ################################################## if env['release']: - env.Append(CPPDEFINES = [ + env.AppendUnique(CPPDEFINES = [ 'FREEORION_RELEASE' ]) if str(Platform()) == 'win32': - env.Append(CPPDEFINES = [ + env.AppendUnique(CPPDEFINES = [ 'FREEORION_WIN32' ]) else: - env.Append(CPPDEFINES = [ + env.AppendUnique(CPPDEFINES = [ 'FREEORION_LINUX', 'ENABLE_BINRELOC' ]) @@ -431,19 +427,19 @@ '/Zi', '/wd4099', '/wd4251', '/wd4800', '/wd4267', '/wd4275', '/wd4244', '/wd4101', '/wd4258', '/wd4351', '/wd4996' ] - env.Append(CCFLAGS = flags) - env.Append(CPPDEFINES = [ + env.AppendUnique(CCFLAGS = flags) + env.AppendUnique(CPPDEFINES = [ (env['debug'] and '_DEBUG' or 'NDEBUG'), 'WIN32', '_WINDOWS' ]) if env['dynamic']: - env.Append(CPPDEFINES = [ + env.AppendUnique(CPPDEFINES = [ '_USRDLL', '_WINDLL' ]) - env.Append(LINKFLAGS = ['/SUBSYSTEM:CONSOLE', '/DEBUG']) - env.Append(LIBS = [ + env.AppendUnique(LINKFLAGS = ['/SUBSYSTEM:CONSOLE', '/DEBUG']) + env.AppendUnique(LIBS = [ 'comdlg32', 'gd', 'gdi32', @@ -466,9 +462,9 @@ ]) else: if env['debug']: - env.Append(CCFLAGS = ['-Wall', '-g', '-O0']) + env.AppendUnique(CCFLAGS = ['-Wall', '-g', '-O0']) else: - env.Append(CCFLAGS = ['-Wall', '-O2']) + env.AppendUnique(CCFLAGS = ['-Wall', '-O2']) # generate Version.cpp version_cpp_in = open('util/Version.cpp.in', 'r') Modified: trunk/FreeOrion/UI/TechTreeWnd.cpp =================================================================== --- trunk/FreeOrion/UI/TechTreeWnd.cpp 2006-03-23 05:20:46 UTC (rev 1826) +++ trunk/FreeOrion/UI/TechTreeWnd.cpp 2006-05-21 07:22:41 UTC (rev 1827) @@ -19,15 +19,7 @@ #include <valarray> -extern "C" { -#ifdef FREEORION_WIN32 -#include <render.h> -#include <dotprocs.h> -#else -#include <graphviz/render.h> -#include <graphviz/dotprocs.h> -#endif -} +#include <gvc.h> #include <boost/format.hpp> @@ -93,6 +85,21 @@ return HumanClientApp::GetApp()->GetTextureOrDefault(ClientUI::ART_DIR + icon_filename); } + pointf Bezier(pointf* patch, double t) + { + pointf temp[6][6]; + for (int j = 0; j <= 3; j++) { + temp[0][j] = patch[j]; + } + for (int i = 1; i <= 3; i++) { + for (int j = 0; j <= 3 - i; j++) { + temp[i][j].x = (1.0 - t) * temp[i - 1][j].x + t * temp[i - 1][j + 1].x; + temp[i][j].y = (1.0 - t) * temp[i - 1][j].y + t * temp[i - 1][j + 1].y; + } + } + return temp[3][0]; + } + std::vector<std::pair<double, double> > Spline(const std::vector<std::pair<int, int> >& control_points) { std::vector<std::pair<double, double> > retval; @@ -108,7 +115,7 @@ retval.push_back(std::make_pair(patch[0].x, patch[0].y)); const int SUBDIVISIONS = 20; for (int step = 1; step <= SUBDIVISIONS; ++step) { - pointf pt = Bezier(patch, 3, static_cast<double>(step) / SUBDIVISIONS, 0, 0); + pointf pt = Bezier(patch, static_cast<double>(step) / SUBDIVISIONS); retval.push_back(std::make_pair(pt.x, pt.y)); } } @@ -1385,7 +1392,7 @@ Clear(); m_selected_tech = selected_tech; - aginit(); + GVC_t* gvc = gvContext(); // default graph properties agraphattr(0, "rankdir", "LR"); @@ -1427,7 +1434,7 @@ } } - dot_layout(graph); + gvLayout(gvc, graph, "dot"); // create new tech panels and new dependency arcs const int TECH_PANEL_MARGIN = 10; @@ -1489,7 +1496,9 @@ m_vscroll->SizeScroll(0, layout_size.y - 1, std::max(50, std::min(layout_size.y / 10, client_sz.y)), client_sz.y); m_hscroll->SizeScroll(0, layout_size.x - 1, std::max(50, std::min(layout_size.x / 10, client_sz.x)), client_sz.x); - dot_cleanup(graph); + gvFreeLayout(gvc, graph); + gvFreeContext(gvc); + agclose(graph); if (keep_position) { Modified: trunk/FreeOrion/build_config.py =================================================================== --- trunk/FreeOrion/build_config.py 2006-03-23 05:20:46 UTC (rev 1826) +++ trunk/FreeOrion/build_config.py 2006-05-21 07:22:41 UTC (rev 1827) @@ -21,7 +21,7 @@ log4cpp_version = '0.3.4b' -fmod_version = '3.74' +fmod_version = '3.75' fmod_win32_lib_name = 'fmodvc' -graphviz_pkgconfig_version = '0.15.0' +graphviz_pkgconfig_version = '2.8' Modified: trunk/FreeOrion/build_support.py =================================================================== --- trunk/FreeOrion/build_support.py 2006-03-23 05:20:46 UTC (rev 1826) +++ trunk/FreeOrion/build_support.py 2006-05-21 07:22:41 UTC (rev 1827) @@ -148,9 +148,9 @@ if not lib and root: lib = os.path.normpath(os.path.join(root, 'lib')) if inc: - env.Append(CPPPATH = [inc]) + env.AppendUnique(CPPPATH = [inc]) if lib: - env.Append(LIBPATH = [lib]) + env.AppendUnique(LIBPATH = [lib]) def CheckPkgConfig(context, version): context.Message('Checking for pkg-config... ') Modified: trunk/FreeOrion/universe/ValueRefParser.cpp =================================================================== --- trunk/FreeOrion/universe/ValueRefParser.cpp 2006-03-23 05:20:46 UTC (rev 1826) +++ trunk/FreeOrion/universe/ValueRefParser.cpp 2006-05-21 07:22:41 UTC (rev 1827) @@ -53,151 +53,151 @@ ValueRefParserDefinition<UniverseObjectType> universeobjecttype_value_ref_def(universeobjecttype_expr_p); ValueRefParserDefinition<StarType> startype_value_ref_def(startype_expr_p); ValueRefParserDefinition<FocusType> focustype_value_ref_def(focustype_expr_p); -} -template <class T> -ValueRefParserDefinition<T>::ValueRefParserDefinition(Rule& expr) -{ - SpecializedInit(); + template <class T> + ValueRefParserDefinition<T>::ValueRefParserDefinition(Rule& expr) + { + SpecializedInit(); - variable_container = - str_p("planet") - | "system"; + variable_container = + str_p("planet") + | "system"; - variable = - str_p("source") >> '.' >> (!(variable_container >> ".") >> variable_final) - [variable.this_ = new_<RefVar>(val(true), construct_<std::string>(arg1, arg2))] - | str_p("target") >> '.' >> (!(variable_container >> ".") >> variable_final) - [variable.this_ = new_<RefVar>(val(false), construct_<std::string>(arg1, arg2))]; + variable = + str_p("source") >> '.' >> (!(variable_container >> ".") >> variable_final) + [variable.this_ = new_<RefVar>(val(true), construct_<std::string>(arg1, arg2))] + | str_p("target") >> '.' >> (!(variable_container >> ".") >> variable_final) + [variable.this_ = new_<RefVar>(val(false), construct_<std::string>(arg1, arg2))]; - primary_expr = - constant[primary_expr.this_ = arg1] - | variable[primary_expr.this_ = arg1] - | '(' >> expr[primary_expr.this_ = arg1] >> ')'; + primary_expr = + constant[primary_expr.this_ = arg1] + | variable[primary_expr.this_ = arg1] + | '(' >> expr[primary_expr.this_ = arg1] >> ')'; - negative_expr = - primary_expr[negative_expr.this_ = arg1] - | (ch_p('-') >> primary_expr[negative_expr.operand1 = arg1])[negative_expr.this_ = new_<RefOp>(val(ValueRef::NEGATE), negative_expr.operand1)]; + negative_expr = + primary_expr[negative_expr.this_ = arg1] + | (ch_p('-') >> primary_expr[negative_expr.operand1 = arg1])[negative_expr.this_ = new_<RefOp>(val(ValueRef::NEGATE), negative_expr.operand1)]; - times_expr = - (negative_expr[times_expr.operand1 = arg1] >> ch_p('*') >> times_expr[times_expr.operand2 = arg1])[times_expr.this_ = new_<RefOp>(val(ValueRef::TIMES), times_expr.operand1, times_expr.operand2)] - | negative_expr[times_expr.this_ = arg1]; + times_expr = + (negative_expr[times_expr.operand1 = arg1] >> ch_p('*') >> times_expr[times_expr.operand2 = arg1])[times_expr.this_ = new_<RefOp>(val(ValueRef::TIMES), times_expr.operand1, times_expr.operand2)] + | negative_expr[times_expr.this_ = arg1]; - divides_expr = - (times_expr[divides_expr.operand1 = arg1] >> ch_p('/') >> divides_expr[divides_expr.operand2 = arg1])[divides_expr.this_ = new_<RefOp>(val(ValueRef::DIVIDES), divides_expr.operand1, divides_expr.operand2)] - | times_expr[divides_expr.this_ = arg1]; + divides_expr = + (times_expr[divides_expr.operand1 = arg1] >> ch_p('/') >> divides_expr[divides_expr.operand2 = arg1])[divides_expr.this_ = new_<RefOp>(val(ValueRef::DIVIDES), divides_expr.operand1, divides_expr.operand2)] + | times_expr[divides_expr.this_ = arg1]; - plus_expr = - (divides_expr[plus_expr.operand1 = arg1] >> ch_p('+') >> plus_expr[plus_expr.operand2 = arg1])[plus_expr.this_ = new_<RefOp>(val(ValueRef::PLUS), plus_expr.operand1, plus_expr.operand2)] - | divides_expr[plus_expr.this_ = arg1]; + plus_expr = + (divides_expr[plus_expr.operand1 = arg1] >> ch_p('+') >> plus_expr[plus_expr.operand2 = arg1])[plus_expr.this_ = new_<RefOp>(val(ValueRef::PLUS), plus_expr.operand1, plus_expr.operand2)] + | divides_expr[plus_expr.this_ = arg1]; - minus_expr = - (plus_expr[minus_expr.operand1 = arg1] >> ch_p('-') >> minus_expr[minus_expr.operand2 = arg1])[minus_expr.this_ = new_<RefOp>(val(ValueRef::MINUS), minus_expr.operand1, minus_expr.operand2)] - | plus_expr[minus_expr.this_ = arg1]; + minus_expr = + (plus_expr[minus_expr.operand1 = arg1] >> ch_p('-') >> minus_expr[minus_expr.operand2 = arg1])[minus_expr.this_ = new_<RefOp>(val(ValueRef::MINUS), minus_expr.operand1, minus_expr.operand2)] + | plus_expr[minus_expr.this_ = arg1]; - expr = minus_expr[expr.this_ = arg1]; -} + expr = minus_expr[expr.this_ = arg1]; + } -template <> -void ValueRefParserDefinition<int>::SpecializedInit() -{ - constant = - real_p[constant.this_ = new_<RefConst>(static_cast_<int>(arg1))] - | int_p[constant.this_ = new_<RefConst>(arg1)]; + template <> + void ValueRefParserDefinition<int>::SpecializedInit() + { + constant = + real_p[constant.this_ = new_<RefConst>(static_cast_<int>(arg1))] + | int_p[constant.this_ = new_<RefConst>(arg1)]; - variable_final = str_p("owner") | "id"; -} + variable_final = str_p("owner") | "id"; + } -template <> -void ValueRefParserDefinition<double>::SpecializedInit() -{ - constant = - real_p[constant.this_ = new_<RefConst>(arg1)] - | int_p[constant.this_ = new_<RefConst>(static_cast_<double>(arg1))]; + template <> + void ValueRefParserDefinition<double>::SpecializedInit() + { + constant = + real_p[constant.this_ = new_<RefConst>(arg1)] + | int_p[constant.this_ = new_<RefConst>(static_cast_<double>(arg1))]; - variable_final = - str_p("currentfarming") - | "maxfarming" - | "currentindustry" - | "maxindustry" - | "currentresearch" - | "maxresearch" - | "currenttrade" - | "maxtrade" - | "currentmining" - | "maxmining" - | "currentconstruction" - | "maxconstruction" - | "currenthealth" - | "maxhealth" - | "currentpopulation" - | "maxpopulation" - | "tradestockpile" - | "mineralstockpile" - | "foodstockpile" - | "tradeproduction" - | "foodproduction" - | "mineralproduction" - | "industryproduction" - | "researchproduction"; -} + variable_final = + str_p("currentfarming") + | "maxfarming" + | "currentindustry" + | "maxindustry" + | "currentresearch" + | "maxresearch" + | "currenttrade" + | "maxtrade" + | "currentmining" + | "maxmining" + | "currentconstruction" + | "maxconstruction" + | "currenthealth" + | "maxhealth" + | "currentpopulation" + | "maxpopulation" + | "tradestockpile" + | "mineralstockpile" + | "foodstockpile" + | "tradeproduction" + | "foodproduction" + | "mineralproduction" + | "industryproduction" + | "researchproduction"; + } -template <> -void ValueRefParserDefinition<PlanetSize>::SpecializedInit() -{ - constant = - planet_size_p[constant.this_ = new_<RefConst>(arg1)] - | int_p[constant.this_ = new_<RefConst>(static_cast_<PlanetSize>(arg1))]; + template <> + void ValueRefParserDefinition<PlanetSize>::SpecializedInit() + { + constant = + planet_size_p[constant.this_ = new_<RefConst>(arg1)] + | int_p[constant.this_ = new_<RefConst>(static_cast_<PlanetSize>(arg1))]; - variable_final = str_p("planetsize"); -} + variable_final = str_p("planetsize"); + } -template <> -void ValueRefParserDefinition<PlanetType>::SpecializedInit() -{ - constant = - planet_type_p[constant.this_ = new_<RefConst>(arg1)] - | int_p[constant.this_ = new_<RefConst>(static_cast_<PlanetType>(arg1))]; + template <> + void ValueRefParserDefinition<PlanetType>::SpecializedInit() + { + constant = + planet_type_p[constant.this_ = new_<RefConst>(arg1)] + | int_p[constant.this_ = new_<RefConst>(static_cast_<PlanetType>(arg1))]; - variable_final = str_p("planettype"); -} + variable_final = str_p("planettype"); + } -template <> -void ValueRefParserDefinition<PlanetEnvironment>::SpecializedInit() -{ - constant = - planet_environment_type_p[constant.this_ = new_<RefConst>(arg1)] - | int_p[constant.this_ = new_<RefConst>(static_cast_<PlanetEnvironment>(arg1))]; + template <> + void ValueRefParserDefinition<PlanetEnvironment>::SpecializedInit() + { + constant = + planet_environment_type_p[constant.this_ = new_<RefConst>(arg1)] + | int_p[constant.this_ = new_<RefConst>(static_cast_<PlanetEnvironment>(arg1))]; - variable_final = str_p("planetenvironment"); -} + variable_final = str_p("planetenvironment"); + } -template <> -void ValueRefParserDefinition<UniverseObjectType>::SpecializedInit() -{ - constant = - universe_object_type_p[constant.this_ = new_<RefConst>(arg1)] - | int_p[constant.this_ = new_<RefConst>(static_cast_<UniverseObjectType>(arg1))]; + template <> + void ValueRefParserDefinition<UniverseObjectType>::SpecializedInit() + { + constant = + universe_object_type_p[constant.this_ = new_<RefConst>(arg1)] + | int_p[constant.this_ = new_<RefConst>(static_cast_<UniverseObjectType>(arg1))]; - variable_final = str_p("objecttype"); -} + variable_final = str_p("objecttype"); + } -template <> -void ValueRefParserDefinition<StarType>::SpecializedInit() -{ - constant = - star_type_p[constant.this_ = new_<RefConst>(arg1)] - | int_p[constant.this_ = new_<RefConst>(static_cast_<StarType>(arg1))]; + template <> + void ValueRefParserDefinition<StarType>::SpecializedInit() + { + constant = + star_type_p[constant.this_ = new_<RefConst>(arg1)] + | int_p[constant.this_ = new_<RefConst>(static_cast_<StarType>(arg1))]; - variable_final = str_p("startype"); -} + variable_final = str_p("startype"); + } -template <> -void ValueRefParserDefinition<FocusType>::SpecializedInit() -{ - constant = - focus_type_p[constant.this_ = new_<RefConst>(arg1)] - | int_p[constant.this_ = new_<RefConst>(static_cast_<FocusType>(arg1))]; + template <> + void ValueRefParserDefinition<FocusType>::SpecializedInit() + { + constant = + focus_type_p[constant.this_ = new_<RefConst>(arg1)] + | int_p[constant.this_ = new_<RefConst>(static_cast_<FocusType>(arg1))]; - variable_final = str_p("primaryfocus") | "secondaryfocus"; + variable_final = str_p("primaryfocus") | "secondaryfocus"; + } } |