From 051426044fedb600825dea8b23c31e73d7fdb526 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sun, 22 Aug 2010 10:54:33 +0100 Subject: [PATCH] Fix some function names --- include/Colour.hpp | 4 ++-- include/IXMLParser.hpp | 12 ++++++------ src/Building.cpp | 2 +- src/Config.cpp | 2 +- src/Engine.cpp | 2 +- src/Map.cpp | 18 +++++++++--------- src/Tree.cpp | 2 +- src/Waggon.cpp | 2 +- src/XMLParser.cpp | 4 +--- src/gui/Layout.cpp | 2 +- 10 files changed, 24 insertions(+), 26 deletions(-) diff --git a/include/Colour.hpp b/include/Colour.hpp index 5f8fe17..11cd48f 100644 --- a/include/Colour.hpp +++ b/include/Colour.hpp @@ -1,5 +1,5 @@ // -// Copyright (C) 2006-2009 Nick Gasson +// Copyright (C) 2009-2010 Nick Gasson // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ inline Colour make_colour(float r, float g, float b, float a=1.0f) return c; } -inline Colour makeRGB(int r, int g, int b, int a=255) +inline Colour make_rgb(int r, int g, int b, int a=255) { return make_colour( static_cast(r) / 255.0f, diff --git a/include/IXMLParser.hpp b/include/IXMLParser.hpp index 4446431..6558610 100644 --- a/include/IXMLParser.hpp +++ b/include/IXMLParser.hpp @@ -64,7 +64,7 @@ namespace { "Cannot parse colour attribute with value '" + str + "'"); - return makeRGB(r, g, b); + return make_rgb(r, g, b); } template @@ -92,7 +92,7 @@ public: } template - T get(const std::string& a_name) const + T get(const string& a_name) const { XMLCh* xml_name = xercesc::XMLString::transcode(a_name.c_str()); @@ -113,7 +113,7 @@ public: } template - void get(const std::string& a_name, T& aT) const + void get(const string& a_name, T& aT) const { aT = get(a_name); } @@ -144,13 +144,13 @@ struct IXMLCallback { struct IXMLParser { virtual ~IXMLParser() {} - virtual void parse(const std::string& a_file_name, - IXMLCallback& a_callback) = 0; + virtual void parse(const string& a_file_name, + IXMLCallback& a_callback) = 0; }; typedef shared_ptr IXMLParserPtr; -IXMLParserPtr makeXMLParser(const std::string& a_schema_file); +IXMLParserPtr make_xml_parser(const std::string& a_schema_file); #endif diff --git a/src/Building.cpp b/src/Building.cpp index cda3102..43f9107 100644 --- a/src/Building.cpp +++ b/src/Building.cpp @@ -59,7 +59,7 @@ private: Building::Building(IResourcePtr a_res) : name_("???"), resource(a_res), angle(0.0f) { - static IXMLParserPtr parser = makeXMLParser("schemas/building.xsd"); + static IXMLParserPtr parser = make_xml_parser("schemas/building.xsd"); parser_state = new ParserState; parser->parse(a_res->xml_file_name(), *this); diff --git a/src/Config.cpp b/src/Config.cpp index c99d2f8..715eeb8 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -87,7 +87,7 @@ Config::Config() if (boost::filesystem::exists(config_file)) { log() << "Reading config from " << config_file; - IXMLParserPtr parser = makeXMLParser("schemas/config.xsd"); + IXMLParserPtr parser = make_xml_parser("schemas/config.xsd"); parser->parse(config_file, *this); // Ignore all the set() calls made by the XML parser diff --git a/src/Engine.cpp b/src/Engine.cpp index e8f3d92..f55b28f 100644 --- a/src/Engine.cpp +++ b/src/Engine.cpp @@ -126,7 +126,7 @@ Engine::Engine(IResourcePtr a_res) have_stopped(true), resource(a_res) { - static IXMLParserPtr parser = makeXMLParser("schemas/engine.xsd"); + static IXMLParserPtr parser = make_xml_parser("schemas/engine.xsd"); parser->parse(resource->xml_file_name(), *this); } diff --git a/src/Map.cpp b/src/Map.cpp index 713c6e3..e4b9885 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -622,12 +622,12 @@ void Map::build_mesh(int id, Point bot_left, Point top_right) { static const tuple colour_map[] = { // Start height colour - make_tuple( 7.0f, makeRGB(238, 233, 233) ), - make_tuple( 5.0f, makeRGB(124, 113, 36) ), - make_tuple( 3.0f, makeRGB(129, 142, 57) ), - make_tuple( 0.0f, makeRGB(103, 142, 57) ), - make_tuple( -2.0f, makeRGB(208, 207, 104)), - make_tuple( -1e10f, makeRGB(177, 176, 96) ) + make_tuple( 7.0f, make_rgb(238, 233, 233) ), + make_tuple( 5.0f, make_rgb(124, 113, 36) ), + make_tuple( 3.0f, make_rgb(129, 142, 57) ), + make_tuple( 0.0f, make_rgb(103, 142, 57) ), + make_tuple( -2.0f, make_rgb(208, 207, 104)), + make_tuple( -1e10f, make_rgb(177, 176, 96) ) }; IMeshBufferPtr buf = make_mesh_buffer(); @@ -688,7 +688,7 @@ void Map::build_mesh(int id, Point bot_left, Point top_right) const float y1 = static_cast(bot_left.y) - 0.5f; const float y2 = static_cast(top_right.y) - 0.5f; - const Colour brown = makeRGB(104, 57, 12); + const Colour brown = make_rgb(104, 57, 12); const float depth = -3.0f; int index[4]; @@ -935,7 +935,7 @@ void Map::post_render_sector(IGraphicsPtr a_context, int id, const float trY = static_cast(top_right.y); static const float sea_level = -0.6f; - gl::colour(makeRGB(0, 80, 160, 150)); + gl::colour(make_rgb(0, 80, 160, 150)); glNormal3f(0.0f, 1.0f, 0.0f); glBegin(GL_QUADS); glVertex3f(blX - 0.5f, sea_level, blY - 0.5f); @@ -1896,7 +1896,7 @@ IMapPtr load_map(const string& a_res_id) log() << "Loading map from file " << res->xml_file_name(); - static IXMLParserPtr xml_parser = makeXMLParser("schemas/map.xsd"); + static IXMLParserPtr xml_parser = make_xml_parser("schemas/map.xsd"); MapLoader loader(map, res); xml_parser->parse(res->xml_file_name(), loader); diff --git a/src/Tree.cpp b/src/Tree.cpp index 090d664..74ba839 100644 --- a/src/Tree.cpp +++ b/src/Tree.cpp @@ -64,7 +64,7 @@ private: Tree::Tree(IResourcePtr res) { - static IXMLParserPtr parser = makeXMLParser("schemas/tree.xsd"); + static IXMLParserPtr parser = make_xml_parser("schemas/tree.xsd"); parser_state = new ParserState; parser_state->res = res; diff --git a/src/Waggon.cpp b/src/Waggon.cpp index 5cd768f..e86946f 100644 --- a/src/Waggon.cpp +++ b/src/Waggon.cpp @@ -55,7 +55,7 @@ const float Waggon::MODEL_SCALE(0.4f); Waggon::Waggon(IResourcePtr a_res) : resource(a_res) { - static IXMLParserPtr parser = makeXMLParser("schemas/waggon.xsd"); + static IXMLParserPtr parser = make_xml_parser("schemas/waggon.xsd"); parser->parse(resource->xml_file_name(), *this); } diff --git a/src/XMLParser.cpp b/src/XMLParser.cpp index 9f2e3cc..6074aa3 100644 --- a/src/XMLParser.cpp +++ b/src/XMLParser.cpp @@ -27,8 +27,6 @@ #include #include -using namespace std; -using namespace std::tr1; using namespace xercesc; // SAX2 handler to call our own methods @@ -189,7 +187,7 @@ void XercesXMLParser::parse(const string& a_file_name, IXMLCallback& a_callback) } // Create a Xerces parser for a schema and return a handle to it -IXMLParserPtr makeXMLParser(const std::string& a_schema_file) +IXMLParserPtr make_xml_parser(const std::string& a_schema_file) { return IXMLParserPtr(new XercesXMLParser(a_schema_file)); } diff --git a/src/gui/Layout.cpp b/src/gui/Layout.cpp index b2b1cd6..d38bf76 100644 --- a/src/gui/Layout.cpp +++ b/src/gui/Layout.cpp @@ -84,7 +84,7 @@ private: Layout::Layout(const string& file_name) { - IXMLParserPtr parser = makeXMLParser("schemas/layout.xsd"); + IXMLParserPtr parser = make_xml_parser("schemas/layout.xsd"); parser->parse(file_name, *this); log() << "Loaded UI layout from " << file_name; -- 2.39.2