[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src Makefile.am mapgen.cpp mapgen.hpp m...
From: |
Yann Dirson |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src Makefile.am mapgen.cpp mapgen.hpp m... |
Date: |
Sat, 05 Mar 2005 11:07:54 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Yann Dirson <address@hidden> 05/03/05 16:07:54
Modified files:
src : Makefile.am mapgen.cpp mapgen.hpp
multiplayer_create.cpp playlevel.cpp
src/editor : editor_dialogs.cpp
Log message:
move high-level map-creation utility functions out of mapgen
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/Makefile.am.diff?tr1=1.78&tr2=1.79&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/mapgen.cpp.diff?tr1=1.58&tr2=1.59&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/mapgen.hpp.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_create.cpp.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playlevel.cpp.diff?tr1=1.178&tr2=1.179&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_dialogs.cpp.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
Patches:
Index: wesnoth/src/Makefile.am
diff -u wesnoth/src/Makefile.am:1.78 wesnoth/src/Makefile.am:1.79
--- wesnoth/src/Makefile.am:1.78 Sat Mar 5 12:49:11 2005
+++ wesnoth/src/Makefile.am Sat Mar 5 16:07:54 2005
@@ -65,6 +65,7 @@
leader_list.cpp \
log.cpp \
map.cpp \
+ map_create.cpp \
map_label.cpp \
mapgen.cpp \
mapgen_dialog.cpp \
@@ -154,6 +155,7 @@
leader_list.hpp \
log.hpp \
map.hpp \
+ map_create.hpp \
map_label.hpp \
mapgen.hpp \
mapgen_dialog.hpp \
@@ -249,6 +251,7 @@
key.cpp \
language.cpp \
log.cpp \
+ map_create.cpp \
map_label.cpp \
map.cpp \
mapgen.cpp \
@@ -329,6 +332,7 @@
key.hpp \
language.hpp \
log.hpp \
+ map_create.hpp \
map_label.hpp \
map.hpp \
mapgen.hpp \
Index: wesnoth/src/editor/editor_dialogs.cpp
diff -u wesnoth/src/editor/editor_dialogs.cpp:1.21
wesnoth/src/editor/editor_dialogs.cpp:1.22
--- wesnoth/src/editor/editor_dialogs.cpp:1.21 Sat Mar 5 10:54:25 2005
+++ wesnoth/src/editor/editor_dialogs.cpp Sat Mar 5 16:07:54 2005
@@ -19,6 +19,7 @@
#include "../language.hpp"
#include "../game_config.hpp"
#include "../mapgen.hpp"
+#include "../map_create.hpp"
#include "../filesystem.hpp"
#include "../font.hpp"
#include "../events.hpp"
Index: wesnoth/src/mapgen.cpp
diff -u wesnoth/src/mapgen.cpp:1.58 wesnoth/src/mapgen.cpp:1.59
--- wesnoth/src/mapgen.cpp:1.58 Sat Mar 5 10:54:25 2005
+++ wesnoth/src/mapgen.cpp Sat Mar 5 16:07:54 2005
@@ -11,11 +11,9 @@
#include <ctime>
#include <vector>
-#include "cavegen.hpp"
#include "language.hpp"
#include "log.hpp"
#include "mapgen.hpp"
-#include "mapgen_dialog.hpp"
#include "pathfind.hpp"
#include "race.hpp"
#include "scoped_resource.hpp"
@@ -25,38 +23,6 @@
#define ERR_CF lg::err(lg::config)
#define LOG_NG lg::info(lg::engine)
-//function to generate a random map, from a string which describes
-//the generator to use and its arguments
-std::string random_generate_map(const std::string& parms, const config* cfg)
-{
- //the first token is the name of the generator, tokens after
- //that are arguments to the generator
- std::vector<std::string> parameters = utils::split(parms, ' ');
- util::scoped_ptr<map_generator>
generator(create_map_generator(parameters.front(),cfg));
- if(generator == NULL) {
- ERR_CF << "could not find map generator '" <<
parameters.front() << "'\n";
- return std::string();
- }
-
- parameters.erase(parameters.begin());
- return generator.get()->create_map(parameters);
-}
-
-config random_generate_scenario(const std::string& parms, const config* cfg)
-{
- //the first token is the name of the generator, tokens after
- //that are arguments to the generator
- std::vector<std::string> parameters = utils::split(parms, ' ');
- util::scoped_ptr<map_generator>
generator(create_map_generator(parameters.front(),cfg));
- if(generator == NULL) {
- ERR_CF << "could not find map generator '" <<
parameters.front() << "'\n";
- return config();
- }
-
- parameters.erase(parameters.begin());
- return generator->create_scenario(parameters);
-}
-
config map_generator::create_scenario(const std::vector<std::string>& args)
{
config res;
@@ -1205,17 +1171,6 @@
}
-map_generator* create_map_generator(const std::string& name, const config* cfg)
-{
- if(name == "default" || name == "") {
- return new default_map_generator(cfg);
- } else if(name == "cave") {
- return new cave_map_generator(cfg);
- } else {
- return NULL;
- }
-}
-
#ifdef TEST_MAPGEN
int main(int argc, char** argv)
Index: wesnoth/src/mapgen.hpp
diff -u wesnoth/src/mapgen.hpp:1.11 wesnoth/src/mapgen.hpp:1.12
--- wesnoth/src/mapgen.hpp:1.11 Wed Aug 25 02:59:51 2004
+++ wesnoth/src/mapgen.hpp Sat Mar 5 16:07:54 2005
@@ -6,9 +6,6 @@
#include <string>
-std::string random_generate_map(const std::string& parms, const config* cfg);
-config random_generate_scenario(const std::string& parms, const config* cfg);
-
class map_generator
{
public:
@@ -34,8 +31,6 @@
virtual config create_scenario(const std::vector<std::string>& args);
};
-map_generator* create_map_generator(const std::string& name, const config*
cfg);
-
std::string default_generate_map(size_t width, size_t height, size_t
island_size, size_t island_off_center,
size_t iterations, size_t hill_size,
size_t
max_lakes, size_t nvillages, size_t nplayers,
Index: wesnoth/src/multiplayer_create.cpp
diff -u wesnoth/src/multiplayer_create.cpp:1.9
wesnoth/src/multiplayer_create.cpp:1.10
--- wesnoth/src/multiplayer_create.cpp:1.9 Thu Mar 3 21:52:39 2005
+++ wesnoth/src/multiplayer_create.cpp Sat Mar 5 16:07:54 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_create.cpp,v 1.9 2005/03/03 21:52:39 gruikya Exp $ */
+/* $Id: multiplayer_create.cpp,v 1.10 2005/03/05 16:07:54 ydirson Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -13,6 +13,7 @@
#include "global.hpp"
#include "show_dialog.hpp"
+#include "map_create.hpp"
#include "multiplayer_create.hpp"
#include "filesystem.hpp"
#include "preferences.hpp"
Index: wesnoth/src/playlevel.cpp
diff -u wesnoth/src/playlevel.cpp:1.178 wesnoth/src/playlevel.cpp:1.179
--- wesnoth/src/playlevel.cpp:1.178 Sun Feb 27 15:43:31 2005
+++ wesnoth/src/playlevel.cpp Sat Mar 5 16:07:54 2005
@@ -1,4 +1,4 @@
-/* $Id: playlevel.cpp,v 1.178 2005/02/27 15:43:31 ydirson Exp $ */
+/* $Id: playlevel.cpp,v 1.179 2005/03/05 16:07:54 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -24,6 +24,7 @@
#include "language.hpp"
#include "log.hpp"
#include "mapgen.hpp"
+#include "map_create.hpp"
#include "network.hpp"
#include "playlevel.hpp"
#include "playturn.hpp"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src Makefile.am mapgen.cpp mapgen.hpp m...,
Yann Dirson <=