engine/XML/source/XMLTilesReader.cpp
// Takes in the "Text" node of a particular tile, as well as a shared pointer to some
// data structure I haven't defined, yet.
Takes in the "Text" node of a particular tile, as well as a shared pointer to some
data structure I haven't defined, yet.
Takes in the " Text " node of a particular tile as well as a shared pointer to some data structure I haven ' t defined yet .
void XMLTilesReader::parse_tile_text_details(vector<DisplayTile>& tile_info, const XMLNode& tile_node)
{
  if (!tile_node.is_null())
  {
    XMLNode text_node = XMLUtils::get_next_element_by_local_name(tile_node, "Text");
    if (!text_node.is_null())
    {
      string symbol_s = XMLUtils::get_child_node_value(text_node, "Symbol");
      uchar symbol = '?';
      if (!symbol_s.empty())
      {
        symbol = symbol_s.at(0);
      }
      SeasonTileColourMap tile_colours;
      XMLNode colour_node = XMLUtils::get_next_element_by_local_name(text_node, "Colour");
      if (!colour_node.is_null())
      {
        int colour = XMLUtils::get_node_int_value(colour_node, 0);
        for (int i = static_cast<int>(Season::SEASON_SPRING); i < static_cast<int>(Season::SEASON_LAST); i++)
        {
          Season season = static_cast<Season>(i);
          tile_colours[season] = colour;
        }
      }
      XMLNode colours_node = XMLUtils::get_next_element_by_local_name(text_node, "Colours");
      if (!colours_node.is_null())
      {
        tile_colours.clear();
        int spring_colour = XMLUtils::get_child_node_int_value(colours_node, "Spring");
        int summer_colour = XMLUtils::get_child_node_int_value(colours_node, "Summer");
        int autumn_colour = XMLUtils::get_child_node_int_value(colours_node, "Autumn");
        int winter_colour = XMLUtils::get_child_node_int_value(colours_node, "Winter");
        tile_colours[Season::SEASON_SPRING] = spring_colour;
        tile_colours[Season::SEASON_SUMMER] = summer_colour;
        tile_colours[Season::SEASON_AUTUMN] = autumn_colour;
        tile_colours[Season::SEASON_WINTER] = winter_colour;
      }
      DisplayTile current_tile_info(symbol, tile_colours);
      tile_info.push_back(current_tile_info);
    }
  }
}
void XMLTilesReader :: parse_tile_text_details ( vector < DisplayTile > & tile_info , const XMLNode & tile_node ) { if ( ! tile_node . is_null ( ) ) { XMLNode text_node = XMLUtils :: get_next_element_by_local_name ( tile_node , " " ) ; if ( ! text_node . is_null ( ) ) { string symbol_s = XMLUtils :: get_child_node_value ( text_node , " " ) ; uchar symbol = ' ' ; if ( ! symbol_s . empty ( ) ) { symbol = symbol_s . at ( 0 ) ; } SeasonTileColourMap tile_colours ; XMLNode colour_node = XMLUtils :: get_next_element_by_local_name ( text_node , " " ) ; if ( ! colour_node . is_null ( ) ) { int colour = XMLUtils :: get_node_int_value ( colour_node , 0 ) ; for ( int i = static_cast < int > ( Season :: SEASON_SPRING ) ; i < static_cast < int > ( Season :: SEASON_LAST ) ; i ++ ) { Season season = static_cast < Season > ( i ) ; tile_colours [ season ] = colour ; } } XMLNode colours_node = XMLUtils :: get_next_element_by_local_name ( text_node , " " ) ; if ( ! colours_node . is_null ( ) ) { tile_colours . clear ( ) ; int spring_colour = XMLUtils :: get_child_node_int_value ( colours_node , " " ) ; int summer_colour = XMLUtils :: get_child_node_int_value ( colours_node , " " ) ; int autumn_colour = XMLUtils :: get_child_node_int_value ( colours_node , " " ) ; int winter_colour = XMLUtils :: get_child_node_int_value ( colours_node , " " ) ; tile_colours [ Season :: SEASON_SPRING ] = spring_colour ; tile_colours [ Season :: SEASON_SUMMER ] = summer_colour ; tile_colours [ Season :: SEASON_AUTUMN ] = autumn_colour ; tile_colours [ Season :: SEASON_WINTER ] = winter_colour ; } DisplayTile current_tile_info ( symbol , tile_colours ) ; tile_info . push_back ( current_tile_info ) ; } } }
Takes in the "Text" node of a particular tile, as well as a shared pointer to some
data structure I haven't defined, yet.
Takes in the " Text " node of a particular tile as well as a shared pointer to some data structure I haven ' t defined yet .
// Well, it is a uchar! // May be null, if seasonal colours are provided for the tile type.