terrain.hpp

Go to the documentation of this file.
00001 /* $Id: terrain.hpp 26689 2008-05-18 12:53:14Z mog $ */
00002 /*
00003    Copyright (C) 2003 - 2008 by David White <dave@whitevine.net>
00004    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License version 2
00008    or at your option any later version.
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY.
00011 
00012    See the COPYING file for more details.
00013 */
00014 #ifndef TERRAIN_H_INCLUDED
00015 #define TERRAIN_H_INCLUDED
00016 
00017 class config;
00018 #include "tstring.hpp"
00019 #include "terrain_translation.hpp"
00020 
00021 #include <map>
00022 #include <string>
00023 #include <vector>
00024 
00025 class terrain_type
00026 {
00027 public:
00028 
00029     terrain_type();
00030     terrain_type(const config& cfg);
00031     terrain_type(const terrain_type& base, const terrain_type& overlay);
00032 
00033     const std::string& minimap_image() const { return minimap_image_; }
00034     const std::string& minimap_image_overlay() const { return minimap_image_overlay_; }
00035     const std::string& editor_image() const { return editor_image_; }
00036     const t_string& name() const { return name_; }
00037     const std::string& id() const { return id_; }
00038 
00039     //the character representing this terrain
00040     t_translation::t_terrain number() const { return number_; }
00041 
00042     //the underlying type of the terrain
00043     const t_translation::t_list& mvt_type() const { return mvt_type_; }
00044     const t_translation::t_list& def_type() const { return def_type_; }
00045     const t_translation::t_list& union_type() const { return union_type_; }
00046 
00047     bool is_nonnull() const { return  (number_ != t_translation::NONE_TERRAIN) &&
00048         (number_ != t_translation::VOID_TERRAIN ); }
00049     int light_modification() const { return light_modification_; }
00050 
00051     int unit_height_adjust() const { return height_adjust_; }
00052     double unit_submerge() const { return submerge_; }
00053 
00054     int gives_healing() const { return heals_; }
00055     bool is_village() const { return village_; }
00056     bool is_castle() const { return castle_; }
00057     bool is_keep() const { return keep_; }
00058 
00059     //these descriptions are shown for the terrain in the mouse over
00060     //depending on the owner or the village
00061     const t_string& income_description() const { return income_description_; }
00062     const t_string& income_description_ally() const { return income_description_ally_; }
00063     const t_string& income_description_enemy() const { return income_description_enemy_; }
00064     const t_string& income_description_own() const { return income_description_own_; }
00065 
00066     const std::string& editor_group() const { return editor_group_; }
00067 
00068     bool is_overlay() const { return overlay_; }
00069     bool is_combined() const { return combined_; }
00070 
00071     t_translation::t_terrain default_base() const { return editor_default_base_; }
00072     t_translation::t_terrain terrain_with_default_base() const;
00073 
00074 private:
00075     //! The image used in the minimap
00076     std::string minimap_image_;
00077     std::string minimap_image_overlay_;
00078 
00079     //! The image used in the editor pallete if not defined in WML it will
00080     //! be initialized with the value of minimap_image_
00081     std::string editor_image_;
00082     std::string id_;
00083     t_string name_;
00084 
00085     //the 'number' is the number that represents this
00086     //terrain type. The 'type' is a list of the 'underlying types'
00087     //of the terrain. This may simply be the same as the number.
00088     //This is the internal number used, WML still used characters
00089     t_translation::t_terrain number_;
00090     t_translation::t_list mvt_type_;
00091     t_translation::t_list def_type_;
00092     t_translation::t_list union_type_;
00093 
00094     int height_adjust_;
00095 
00096     double submerge_;
00097 
00098     int light_modification_, heals_;
00099 
00100     t_string income_description_;
00101     t_string income_description_ally_;
00102     t_string income_description_enemy_;
00103     t_string income_description_own_;
00104 
00105     std::string editor_group_;
00106 
00107     bool village_, castle_, keep_;
00108 
00109     bool overlay_, combined_;
00110     t_translation::t_terrain editor_default_base_;
00111 };
00112 
00113 void create_terrain_maps(const std::vector<config*>& cfgs,
00114                          t_translation::t_list& terrain_list,
00115                          std::map<t_translation::t_terrain, terrain_type>& letter_to_terrain);
00116 
00117 void merge_alias_lists(t_translation::t_list& first, const t_translation::t_list& second);
00118 
00119 #endif

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs