00001 /* $Id: builder.hpp 26213 2008-04-28 16:54:29Z mog $ */ 00002 /* 00003 Copyright (C) 2004 - 2008 by Philippe Plantier <ayin@anathas.org> 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 00015 //! @file builder.hpp 00016 //! Definitions for the terrain builder. 00017 00018 #ifndef BUILDER_H_INCLUDED 00019 #define BUILDER_H_INCLUDED 00020 00021 #include "animated.hpp" 00022 #include "image.hpp" 00023 #include "map.hpp" 00024 00025 #include <map> 00026 #include <set> 00027 00028 class config; 00029 00030 /** 00031 * The class terrain_builder is constructed from a config object, and a 00032 * gamemap object. On construction, it parses the configuration and extracts 00033 * the list of [terrain_graphics] rules. Each terrain_graphics rule attaches 00034 * one or more images to a specific terrain pattern. 00035 * It then applies the rules loaded from the configuration to the current map, 00036 * and calculates the list of images that must be associated to each hex of 00037 * the map. 00038 * 00039 * The get_terrain_at method can then be used to obtain the list of images 00040 * necessary to draw the terrain on a given tile. 00041 */ 00042 class terrain_builder 00043 { 00044 public: 00045 //! Used as a parameter for the get_terrain_at function. 00046 enum ADJACENT_TERRAIN_TYPE { 00047 ADJACENT_BACKGROUND, //!< Represents terrains which are to be drawn behind unit sprites 00048 ADJACENT_FOREGROUND //!< Represents terrains which are to be drawn in front of them. 00049 }; 00050 00051 /** A shorthand typedef for a list of animated image locators, 00052 * the base data type returned by the get_terrain_at method. 00053 */ 00054 typedef std::vector<animated<image::locator> > imagelist; 00055 00056 /** Constructor for the terrain_builder class. 00057 * 00058 * @param cfg The main grame configuration object, where the 00059 * [terrain_graphics] rule reside. 00060 * @param level A level (scenario)-specific configuration file, 00061 * containing scenario-specific [terrain_graphics] rules. 00062 * @param map A properly-initialized gamemap object representing 00063 * the current terrain map. 00064 * @param offmap_image The filename of the image which will be used as 00065 * off map image (see add_off_map_rule()). 00066 * This image automatically gets the 'terrain/' prefix 00067 * and '.png' suffix 00068 */ 00069 terrain_builder(const config& cfg, const config &level, 00070 const gamemap& map, const std::string& offmap_image); 00071 00072 /** Returns a vector of strings representing the images to load & blit 00073 * together to get the built content for this tile. 00074 * 00075 * @param loc The location relative the the terrain map, 00076 * where we ask for the image list 00077 * @param tod The string representing the current time-of day. 00078 * Will be used if some images specify several 00079 * time-of-day- related variants. 00080 * @param terrain_type ADJACENT_BACKGROUND or ADJACENT_FOREGROUND, 00081 * depending on wheter we ask for the terrain which is 00082 * before, or after the unit sprite. 00083 * 00084 * @return Returns a pointer list of animated images corresponding 00085 * to the parameters, or NULL if there is none. 00086 */ 00087 const imagelist *get_terrain_at(const gamemap::location &loc, 00088 const std::string &tod, ADJACENT_TERRAIN_TYPE const terrain_type); 00089 00090 /** Updates the animation at a given tile. 00091 * Returns true if something has changed, and must be redrawn. 00092 * 00093 * @param loc the location to update 00094 * 00095 * @retval true: this tile must be redrawn. 00096 */ 00097 bool update_animation(const gamemap::location &loc); 00098 00099 /** Performs a "quick-rebuild" of the terrain in a given location. 00100 * The "quick-rebuild" is no proper rebuild: it only clears the 00101 * terrain cache for a given location, and replaces it with a single, 00102 * default image for this terrain. 00103 * 00104 * @param loc the location where to rebuild terrains 00105 */ 00106 void rebuild_terrain(const gamemap::location &loc); 00107 00108 /** Performs a complete rebuild of the list of terrain graphics 00109 * attached to a map. 00110 * Should be called when a terrain is changed in the map. 00111 */ 00112 void rebuild_all(); 00113 00114 /** 00115 * An image variant. The in-memory representation of the [variant] 00116 * WML tag of the [image] WML tag. When an image only has one variant, 00117 * the [variant] tag may be omitted. 00118 */ 00119 struct rule_image_variant { 00120 /** Shorthand constructor for this structure */ 00121 rule_image_variant(const std::string &image_string, const std::string &tod) : 00122 image_string(image_string), 00123 image(), 00124 tod(tod) 00125 {}; 00126 00127 /** A string representing either the filename for an image, or 00128 * a list of images, with an optional timing for each image. 00129 * Corresponds to the "name" parameter of the [variant] (or of 00130 * the [image]) WML tag. 00131 * 00132 * The timing string is in the following format (expressed in EBNF) 00133 * 00134 *@verbatim 00135 * <timing_string> ::= <timed_image> ( "," <timed_image> ) + 00136 * 00137 * <timed_image> ::= <image_name> [ ":" <timing> ] 00138 * 00139 * Where <image_name> represents the actual filename of an image, 00140 * and <timing> the number of milliseconds this image will last 00141 * in the animation. 00142 *@endverbatim 00143 */ 00144 std::string image_string; 00145 00146 /** An animated image locator built according to the image string. 00147 * This will be the image locator which will actually 00148 * be returned to the user. 00149 */ 00150 animated<image::locator> image; 00151 /** 00152 * The time-of-day to which this variant applies. 00153 * Set to the empty string, this variant applies to all TODs. 00154 */ 00155 std::string tod; 00156 }; 00157 00158 /** 00159 * A map associating a rule_image_variant to a string representing 00160 * the time of day. 00161 */ 00162 typedef std::map<std::string, rule_image_variant> rule_image_variantlist; 00163 00164 /** 00165 * Each terrain_graphics rule is associated a set of images, which are 00166 * applied on the terrain if the rule matches. An image is more than 00167 * graphics: it is graphics (with several possible tod-alternatives,) 00168 * and a position for these graphics. 00169 * The rule_image structure represents one such image. 00170 */ 00171 struct rule_image { 00172 rule_image(int layer, int x, int y, bool global_image=false, int center_x=-1, int center_y=-1); 00173 00174 /** The layer of the image for horizontal layering */ 00175 int layer; 00176 /** The position of the image base (that is, the point where 00177 * the image reaches the floor) for vertical layering 00178 */ 00179 int basex, basey; 00180 00181 /** A list of Time-Of-Day-related variants for this image 00182 */ 00183 rule_image_variantlist variants; 00184 00185 /** Set to true if the image was defined as a child of the 00186 * [terrain_graphics] tag, set to false if it was defined as a 00187 * child of a [tile] tag */ 00188 bool global_image; 00189 00190 /** The position where the center of the image base should be 00191 */ 00192 int center_x, center_y; 00193 }; 00194 00195 /** 00196 * A shorthand notation for a vector of rule_images 00197 */ 00198 typedef std::vector<rule_image> rule_imagelist; 00199 00200 /** 00201 * The in-memory representation of a [tile] WML rule 00202 * inside of a [terrain_graphics] WML rule. 00203 */ 00204 struct terrain_constraint 00205 { 00206 terrain_constraint() : 00207 loc(), 00208 terrain_types_match(), 00209 set_flag(), 00210 no_flag(), 00211 has_flag(), 00212 images() 00213 {}; 00214 00215 terrain_constraint(gamemap::location loc) : 00216 loc(loc), 00217 terrain_types_match(), 00218 set_flag(), 00219 no_flag(), 00220 has_flag(), 00221 images() 00222 {}; 00223 00224 gamemap::location loc; 00225 t_translation::t_match terrain_types_match; 00226 std::vector<std::string> set_flag; 00227 std::vector<std::string> no_flag; 00228 std::vector<std::string> has_flag; 00229 rule_imagelist images; 00230 }; 00231 00232 /** 00233 * Represents a tile of the game map, with all associated 00234 * builder-specific parameters: flags, images attached to this tile, 00235 * etc. An array of those tiles is built when terrains are built either 00236 * during construction, or upon calling the rebuild_all() method. 00237 */ 00238 struct tile 00239 { 00240 /** An ordered rule_image list */ 00241 typedef std::multimap<int, const rule_image*> ordered_ri_list; 00242 00243 /** Contructor for the tile() structure */ 00244 tile(); 00245 00246 /** Adds an image, extracted from an ordered rule_image list, 00247 * to the background or foreground image cache. 00248 * 00249 * @param tod The current time-of-day, to select between 00250 * images presenting several variants. 00251 * @param itor An iterator pointing to the rule_image where 00252 * to extract the image we wish to add to the 00253 * cache. 00254 */ 00255 void add_image_to_cache(const std::string &tod, ordered_ri_list::const_iterator itor); 00256 00257 /** Rebuilds the whole image cache, for a given time-of-day. 00258 * Must be called when the time-of-day has changed, 00259 * to select the correct images. 00260 * 00261 * @param tod The current time-of-day 00262 */ 00263 void rebuild_cache(const std::string &tod); 00264 00265 /** Clears all data in this tile, and resets the cache */ 00266 void clear(); 00267 00268 /** The list of flags present in this tile */ 00269 std::set<std::string> flags; 00270 00271 /** The list of images associated to this tile, ordered by 00272 * their layer first and base-y position second. 00273 */ 00274 ordered_ri_list images; 00275 00276 /** The list of images which are in front of the unit sprites, 00277 * attached to this tile. This member is considered a cache: 00278 * it is built once, and on-demand. 00279 */ 00280 imagelist images_foreground; 00281 /** The list of images which are behind the unit sprites, 00282 * attached to this tile. This member is considered a cache: 00283 * it is built once, and on-demand. 00284 */ 00285 imagelist images_background; 00286 /** 00287 * The time-of-day to which the image caches correspond. 00288 */ 00289 std::string last_tod; 00290 00291 }; 00292 00293 private: 00294 /** 00295 * The list of constraints attached to a terrain_graphics WML rule. 00296 */ 00297 typedef std::map<gamemap::location, terrain_constraint> constraint_set; 00298 00299 /** 00300 * The in-memory representation of a [terrain_graphics] WML rule. 00301 */ 00302 struct building_rule 00303 { 00304 building_rule() : 00305 constraints(), 00306 location_constraints(), 00307 probability(0), 00308 precedence(0) 00309 {} 00310 00311 /** 00312 * The set of [tile] constraints of this rule. 00313 */ 00314 constraint_set constraints; 00315 00316 /** 00317 * The location on which this map may match. 00318 * Set to a valid gamemap::location if the "x" and "y" parameters 00319 * of the [terrain_graphics] rule are set. 00320 */ 00321 gamemap::location location_constraints; 00322 00323 /** 00324 * The probability of this rule to match, when all conditions 00325 * are met. Defined if the "probability" parameter of the 00326 * [terrain_graphics] element is set. 00327 */ 00328 int probability; 00329 00330 /** 00331 * The precedence of this rule. Used to order rules differently 00332 * that the order in which they appear. 00333 * Defined if the "precedence" parameter of the 00334 * [terrain_graphics] element is set. 00335 */ 00336 int precedence; 00337 }; 00338 00339 /** 00340 * The map of "tile" structures corresponding to the level map. 00341 */ 00342 class tilemap 00343 { 00344 public: 00345 /** 00346 * Constructs a tilemap of dimensions x * y 00347 */ 00348 tilemap(int x, int y) : 00349 map_((x + 4) * (y + 4)), 00350 x_(x), 00351 y_(y) 00352 {} 00353 00354 /** 00355 * Returns a reference to the tile which is at the position 00356 * pointed by loc. The location MUST be on the map! 00357 * 00358 * @param loc The location of the tile 00359 * 00360 * @return A reference to the tile at this location. 00361 * 00362 */ 00363 tile &operator[](const gamemap::location &loc); 00364 /** 00365 * a const variant of operator[] 00366 */ 00367 const tile &operator[] (const gamemap::location &loc) const; 00368 00369 /** 00370 * Tests if a location is on the map. 00371 * 00372 * @param loc The location to test 00373 * 00374 * @return true if loc is on the map, false otherwise. 00375 */ 00376 bool on_map(const gamemap::location &loc) const; 00377 00378 /** 00379 * Resets the whole tile map 00380 */ 00381 void reset(); 00382 private: 00383 /** The map */ 00384 std::vector<tile> map_; 00385 /** The x dimension of the map */ 00386 int x_; 00387 /** The y dimension of the map */ 00388 int y_; 00389 }; 00390 00391 /** 00392 * A set of building rules. In-memory representation 00393 * of the whole set of [terrain_graphics] rules. 00394 */ 00395 typedef std::multimap<int, building_rule> building_ruleset; 00396 00397 /** 00398 * Tests for validity of a rule. A rule is considered valid if all its 00399 * images are present. This method is used, when building the ruleset, 00400 * to only add rules which are valid to the ruleset. 00401 * 00402 * @param rule The rule to test for validity 00403 * 00404 * @return true if the rule is valid, false if it is not. 00405 */ 00406 bool rule_valid(const building_rule &rule) const; 00407 00408 /** 00409 * Starts the animation on a rule. 00410 * 00411 * @param rule The rule on which ot start animations 00412 * 00413 * @return true 00414 */ 00415 bool start_animation(building_rule &rule); 00416 00417 /** 00418 * "Rotates" a constraint from a rule. 00419 * Takes a template constraint from a template rule, and creates 00420 * a constraint from this template, rotated to the given angle. 00421 * 00422 * On a constraint, the relative position of each rule, and the "base" 00423 * of each vertical images, are rotated according to the given angle. 00424 * 00425 * Template terrain constraints are defined like normal terrain 00426 * constraints, except that, flags, and image filenames, 00427 * may contain template strings of the form 00428 *@verbatim 00429 * <code>@Rn</code>, 00430 *@endverbatim 00431 * n being a number from 0 to 5. 00432 * See the rotate_rule method for more info. 00433 * 00434 * @param constraint A template constraint to rotate 00435 * @param angle An int, from 0 to 5, representing the rotation angle. 00436 */ 00437 terrain_constraint rotate(const terrain_constraint &constraint, int angle); 00438 00439 /** 00440 * Replaces, in a given string, a token with its value. 00441 * 00442 * @param s The string in which to do the replacement 00443 * @param token The token to substitute 00444 * @param replacement The replacement string 00445 */ 00446 void replace_token(std::string &s, const std::string &token, 00447 const std::string& replacement); 00448 00449 /** 00450 * Replaces, in a given rule_image, a token with its value. 00451 * The actual substitution is done in all variants of the given image. 00452 * 00453 * @param image The rule_image in which to do the replacement 00454 * @param token The token to substitute 00455 * @param replacement The replacement string 00456 */ 00457 void replace_token(rule_image &image, const std::string &token, 00458 const std::string& replacement); 00459 00460 /** 00461 * Replaces, in a given rule_variant_image, a token with its value. 00462 * The actual substitution is done in the "image_string" parameter 00463 * of this rule_variant_image. 00464 * 00465 * @param variant The rule_variant_image in which to do the replacement 00466 * @param token The token to substitute 00467 * @param replacement The replacement string 00468 */ 00469 void replace_token(rule_image_variant &variant, const std::string &token, 00470 const std::string& replacement) 00471 { replace_token(variant.image_string, token, replacement); } 00472 00473 /** 00474 * Replaces, in a given rule_imagelist, a token with its value. 00475 * The actual substitution is done in all rule_images contained 00476 * in the rule_imagelist. 00477 * 00478 * @param & The rule_imagelist in which to do the replacement 00479 * @param token The token to substitute 00480 * @param replacement The replacement string 00481 */ 00482 void replace_token(rule_imagelist &, const std::string &token, 00483 const std::string& replacement); 00484 00485 /** 00486 * Replaces, in a given building_rule, a token with its value. 00487 * The actual substitution is done in the rule_imagelists contained 00488 * in all constraints of the building_rule, and in the flags 00489 * (has_flag, set_flag and no_flag) contained in all constraints 00490 * of the building_rule. 00491 * 00492 * @param s The building_rule in which to do the replacement 00493 * @param token The token to substitute 00494 * @param replacement The replacement string 00495 */ 00496 void replace_token(building_rule &s, const std::string &token, 00497 const std::string& replacement); 00498 00499 /** 00500 * Rotates a template rule to a given angle, and returns the rotated rule. 00501 * 00502 * Template rules are defined like normal rules, except that: 00503 * * Flags and image filenames may contain template strings of the form 00504 *@verbatim 00505 * <code>@Rn</code>, n being a number from 0 to 5. 00506 *@endverbatim 00507 * * The rule contains the rotations=r0,r1,r2,r3,r4,r5, with r0 to r5 00508 * being strings describing the 6 different positions, typically, 00509 * n, ne, se, s, sw, and nw (but maybe anything else.) 00510 * 00511 * A template rule will generate 6 rules, which are similar 00512 * to the template, except that: 00513 * 00514 * * The map of constraints ( [tile]s ) of this rule will be 00515 * rotated by an angle, of 0 to 5 pi / 6 00516 * 00517 * * On the rule which is rotated to 0rad, the template strings 00518 *@verbatim 00519 * @R0, @R1, @R2, @R3, @R4, @R5, 00520 *@endverbatim 00521 * will be replaced by the corresponding r0, r1, r2, r3, r4, r5 00522 * variables given in the rotations= element. 00523 * 00524 * * On the rule which is rotated to pi/3 rad, the template strings 00525 *@verbatim 00526 * @R0, @R1, @R2 etc. 00527 *@endverbatim 00528 * will be replaced by the corresponding 00529 * <strong>r1, r2, r3, r4, r5, r0</strong> (note the shift in indices). 00530 * 00531 * * On the rule rotated 2pi/3, those will be replaced by 00532 * r2, r3, r4, r5, r0, r1 and so on. 00533 * 00534 */ 00535 building_rule rotate_rule(const building_rule &rule, int angle, 00536 const std::vector<std::string>& angle_name); 00537 00538 /** 00539 * Parses a "config" object, which should contains [image] children, 00540 * and adds the corresponding parsed rule_images to a rule_imagelist. 00541 * 00542 * @param images The rule_imagelist into which to add the parsed images. 00543 * @param cfg The WML configuration object to parse 00544 * @param global Whether those [image]s elements belong to a 00545 * [terrain_graphics] element, or to a [tile] child. 00546 * Set to true if those belong to a [terrain_graphics] 00547 * element. 00548 * @param dx The X coordinate of the constraint those images 00549 * apply to, relative to the start of the rule. Only 00550 * meaningful if global is set to false. 00551 * @param dy The Y coordinate of the constraint those images 00552 * apply to. 00553 */ 00554 void add_images_from_config(rule_imagelist &images, const config &cfg, bool global, 00555 int dx=0, int dy=0); 00556 00557 00558 /** 00559 * Creates a rule constraint object which matches a given list of 00560 * terrains, and adds it to the list of constraints of a rule. 00561 * 00562 * @param constraints The constraint set to which to add the constraint. 00563 * @param loc The location of the constraint 00564 * @param type The list of terrains this constraint will match 00565 * @param global_images A configuration object containing [image] tags 00566 * describing rule-global images. 00567 */ 00568 void add_constraints(constraint_set& constraints, 00569 const gamemap::location &loc, const t_translation::t_match& type, 00570 const config& global_images); 00571 00572 /** 00573 * Creates a rule constraint object from a config object and 00574 * adds it to the list of constraints of a rule. 00575 * 00576 * @param constraints The constraint set to which to add the constraint. 00577 * @param loc The location of the constraint 00578 * @param cfg The config object describing this constraint. 00579 * Usually, a [tile] child of a [terrain_graphics] rule. 00580 * @param global_images A configuration object containing [image] tags 00581 * describing rule-global images. 00582 */ 00583 void add_constraints(constraint_set& constraints, 00584 const gamemap::location &loc, const config &cfg, 00585 const config& global_images); 00586 00587 typedef std::multimap<int, gamemap::location> anchormap; 00588 00589 /** 00590 * Parses a map string (the map= element of a [terrain_graphics] rule, 00591 * and adds constraints from this map to a building_rule. 00592 * 00593 * @param mapstring The map vector to parse 00594 * @param br The building rule into which to add the extracted 00595 * constraints 00596 * @param anchors A map where to put "anchors" extracted from the map. 00597 * @param global_images A config object representing the images defined 00598 * as direct children of the [terrain_graphics] rule. 00599 */ 00600 void parse_mapstring(const std::string &mapstring, struct building_rule &br, 00601 anchormap& anchors, const config& global_images); 00602 00603 /** 00604 * Adds a rule to a ruleset. Checks for validity before adding the rule. 00605 * 00606 * @param rules The ruleset into which to add the rules. 00607 * @param rule The rule to add. 00608 */ 00609 void add_rule(building_ruleset& rules, building_rule &rule); 00610 00611 /** 00612 * Adds a set of rules to a ruleset, from a template rule which spans 00613 * 6 rotations (or less if some of the rotated rules are invalid). 00614 * 00615 * @param rules The ruleset into which to add the rules. 00616 * @param tpl The template rule 00617 * @param rotations A comma-separated string containing the 00618 * 6 values for replacing rotation 00619 * template strings @verbatim (@Rn) @endverbatim 00620 */ 00621 void add_rotated_rules(building_ruleset& rules, building_rule& tpl, const std::string &rotations); 00622 00623 /** 00624 * Parses a configuration object containing [terrain_graphics] rules, 00625 * and fills the building_rules_ member of the current class according 00626 * to those. 00627 * 00628 * @param cfg The configuration object to parse. 00629 */ 00630 void parse_config(const config &cfg); 00631 00632 /** 00633 * Adds a builder rule for the _off^_usr tile, this tile only has 1 image. 00634 * 00635 * @param image The filename of the image 00636 */ 00637 void add_off_map_rule(const std::string& image); 00638 00639 /** 00640 * Checks whether a terrain code matches a given list of terrain codes. 00641 * 00642 * @param tcode The terrain to check 00643 * @param terrains The terrain list agains which to check the terrain. 00644 * May contain the metacharacters 00645 * - '*' STAR, meaning "all terrains" 00646 * - '!' NOT, meaning "all terrains except those present in the list." 00647 * 00648 * @return returns true if "tcode" matches the list or the list is empty, 00649 * else false. 00650 */ 00651 bool terrain_matches(t_translation::t_terrain tcode, const t_translation::t_list& terrains) const 00652 { return terrains.empty()? true : t_translation::terrain_matches(tcode, terrains); } 00653 00654 /** 00655 * Checks whether a terrain code matches a given list of terrain tcodes. 00656 * 00657 * @param tcode The terrain code to check 00658 * @param terrain The terrain match structure which to check the terrain. 00659 * See previous definition for more details. 00660 * 00661 * @return returns true if "tcode" matches the list or the list is empty, 00662 * else false. 00663 */ 00664 bool terrain_matches(t_translation::t_terrain tcode, const t_translation::t_match &terrain) const 00665 { return terrain.is_empty ? true : t_translation::terrain_matches(tcode, terrain); } 00666 00667 /** 00668 * Checks whether a rule matches a given location in the map. 00669 * 00670 * @param rule The rule to check. 00671 * @param loc The location in the map where we want to check 00672 * whether the rule matches. 00673 * @param rule_index The index of the rule, relative to the start of 00674 * the rule list. Rule indices are used for seeding 00675 * the pseudo-random-number generator used for 00676 * probability calculations. 00677 * @param type_checked The constraint which we already know that its 00678 * terrain types matches. 00679 */ 00680 bool rule_matches(const building_rule &rule, const gamemap::location &loc, 00681 const int rule_index, const constraint_set::const_iterator type_checked) const; 00682 00683 /** 00684 * Applies a rule at a given location: applies the result of a 00685 * matching rule at a given location: attachs the images corresponding 00686 * to the rule, and sets the flags corresponding to the rule. 00687 * 00688 * @param rule The rule to apply 00689 * @param loc The location to which to apply the rule. 00690 */ 00691 void apply_rule(const building_rule &rule, const gamemap::location &loc); 00692 00693 /** 00694 * Calculates the list of terrains, and fills the tile_map_ member, 00695 * from the gamemap and the building_rules_. 00696 */ 00697 void build_terrains(); 00698 00699 /** 00700 * A reference to the gamemap class used in the current level. 00701 */ 00702 const gamemap& map_; 00703 /** 00704 * The tile_map_ for the current level, which is filled by the 00705 * build_terrains_ method to contain "tiles" representing images 00706 * attached to each tile. 00707 */ 00708 tilemap tile_map_; 00709 00710 /** 00711 * Shorthand typedef for a map associating a list of locations to a terrain type. 00712 */ 00713 typedef std::map<t_translation::t_terrain, std::vector<gamemap::location> > terrain_by_type_map; 00714 00715 /** 00716 * A map representing all locations whose terrain is of a given type. 00717 */ 00718 terrain_by_type_map terrain_by_type_; 00719 00720 building_ruleset building_rules_; 00721 00722 }; 00723 00724 #endif
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |