00001 /* $Id: terrain.hpp 52533 2012-01-07 02:35:17Z shadowmaster $ */ 00002 /* 00003 Copyright (C) 2003 - 2012 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 as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY. 00012 00013 See the COPYING file for more details. 00014 */ 00015 #ifndef TERRAIN_H_INCLUDED 00016 #define TERRAIN_H_INCLUDED 00017 00018 #include "config.hpp" 00019 #include "terrain_translation.hpp" 00020 00021 class terrain_type 00022 { 00023 public: 00024 00025 terrain_type(); 00026 terrain_type(const config& cfg); 00027 terrain_type(const terrain_type& base, const terrain_type& overlay); 00028 00029 const std::string& minimap_image() const { return minimap_image_; } 00030 const std::string& minimap_image_overlay() const { return minimap_image_overlay_; } 00031 const std::string& editor_image() const { return editor_image_; } 00032 const t_string& name() const { return name_; } 00033 const t_string& editor_name() const { return editor_name_.empty() ? description() : editor_name_; } 00034 const t_string& description() const { return description_.empty() ? name_ : description_; } 00035 const std::string& id() const { return id_; } 00036 00037 bool hide_in_editor() const { return hide_in_editor_; } 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 void set_editor_group(const std::string& str) { editor_group_ = str; } 00068 00069 bool is_overlay() const { return overlay_; } 00070 bool is_combined() const { return combined_; } 00071 00072 t_translation::t_terrain default_base() const { return editor_default_base_; } 00073 t_translation::t_terrain terrain_with_default_base() const; 00074 00075 bool operator==(const terrain_type& other) const; 00076 private: 00077 /** The image used in the minimap */ 00078 std::string minimap_image_; 00079 std::string minimap_image_overlay_; 00080 00081 /** 00082 * The image used in the editor pallete if not defined in WML it will be 00083 * initialized with the value of minimap_image_ 00084 */ 00085 std::string editor_image_; 00086 std::string id_; 00087 t_string name_; 00088 t_string editor_name_; 00089 t_string description_; 00090 00091 //the 'number' is the number that represents this 00092 //terrain type. The 'type' is a list of the 'underlying types' 00093 //of the terrain. This may simply be the same as the number. 00094 //This is the internal number used, WML still uses character strings. 00095 t_translation::t_terrain number_; 00096 t_translation::t_list mvt_type_; 00097 t_translation::t_list def_type_; 00098 t_translation::t_list union_type_; 00099 00100 int height_adjust_; 00101 bool height_adjust_set_; 00102 00103 double submerge_; 00104 bool submerge_set_; 00105 00106 int light_modification_, heals_; 00107 00108 t_string income_description_; 00109 t_string income_description_ally_; 00110 t_string income_description_enemy_; 00111 t_string income_description_own_; 00112 00113 std::string editor_group_; 00114 00115 bool village_, castle_, keep_; 00116 00117 bool overlay_, combined_; 00118 t_translation::t_terrain editor_default_base_; 00119 bool hide_in_editor_; 00120 }; 00121 00122 void create_terrain_maps(const config::const_child_itors &cfgs, 00123 t_translation::t_list& terrain_list, 00124 std::map<t_translation::t_terrain, terrain_type>& letter_to_terrain); 00125 00126 void merge_alias_lists(t_translation::t_list& first, const t_translation::t_list& second); 00127 00128 #endif
| Generated by doxygen 1.7.1 on Fri May 25 2012 01:03:11 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |