mapgen.hpp

Go to the documentation of this file.
00001 /* $Id: mapgen.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 
00016 /** @file */
00017 
00018 #ifndef MAP_GEN_HPP_INCLUDED
00019 #define MAP_GEN_HPP_INCLUDED
00020 
00021 class config;
00022 class display;
00023 
00024 #include "exceptions.hpp"
00025 #include "map_location.hpp"
00026 
00027 #include <map>
00028 
00029 struct mapgen_exception : public game::error
00030 {
00031     mapgen_exception(const std::string& msg)
00032     : game::error(msg)
00033     {}
00034 };
00035 
00036 class map_generator
00037 {
00038 public:
00039     virtual ~map_generator() {}
00040 
00041     /**
00042      * Returns true iff the map generator has an interactive screen,
00043      * which allows the user to modify how the generator behaves.
00044      */
00045     virtual bool allow_user_config() const = 0;
00046 
00047     /**
00048      * Display the interactive screen, which allows the user
00049      * to modify how the generator behaves.
00050      * (This function will not be called if allow_user_config() returns false).
00051      */
00052     virtual void user_config(display& disp) = 0;
00053 
00054     /**
00055      * Returns a string identifying the generator by name.
00056      * The name should not contain spaces.
00057      */
00058     virtual std::string name() const = 0;
00059 
00060     /**
00061      * Return a friendly name for the generator
00062      * used to differentiate between different configs of the same generator
00063      */
00064     virtual std::string config_name() const = 0;
00065 
00066     /**
00067      * Creates a new map and returns it.
00068      * args may contain arguments to the map generator.
00069      */
00070     virtual std::string create_map(const std::vector<std::string>& args) = 0;
00071 
00072     virtual config create_scenario(const std::vector<std::string>& args);
00073 };
00074 
00075 /** Generate the map. */
00076 std::string default_generate_map(size_t width, size_t height, size_t island_size, size_t island_off_center,
00077                                  size_t iterations, size_t hill_size,
00078                                  size_t max_lakes, size_t nvillages, size_t castle_size, size_t nplayers,
00079                                  bool roads_between_castles, std::map<map_location,std::string>* labels,
00080                                  const config& cfg);
00081 
00082 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:03:05 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs