Author: ilor
Date: Tue Oct 7 22:31:40 2008
New Revision: 29959
URL: http://svn.gna.org/viewcvs/wesnoth?rev=29959&view=rev
Log:
rename WIP files to avoid confusion
Added:
trunk/src/editor2/terrain_group.cpp.wip (props changed)
- copied unchanged from r29951, trunk/src/editor2/terrain_group.cpp
trunk/src/editor2/terrain_group.hpp.wip (props changed)
- copied unchanged from r29951, trunk/src/editor2/terrain_group.hpp
Removed:
trunk/src/editor2/terrain_group.cpp
trunk/src/editor2/terrain_group.hpp
Removed: trunk/src/editor2/terrain_group.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/terrain_group.cpp?rev=29958&view=auto
==============================================================================
--- trunk/src/editor2/terrain_group.cpp (original)
+++ trunk/src/editor2/terrain_group.cpp (removed)
@@ -1,131 +1,0 @@
-/* $Id$ */
-/*
- Copyright (C) 2008 by Tomasz Sniatowski <[EMAIL PROTECTED]>
- Part of the Battle for Wesnoth Project http://www.wesnoth.org/
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- or at your option any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY.
-
- See the COPYING file for more details.
-*/
-
-// UNUSED CODE -- TODO FOR THE NEW TERRAIN PALETTE
-
-#include "terrain_group.hpp"
-#include "editor_common.hpp"
-#include "../foreach.hpp"
-
-namespace editor2 {
-
-terrain_group::terrain_group(const config& cfg);
-: id_(cfg["id"]), name_(cfg["name"]), icon_string_(cfg["icon"])
-{
-}
-
-terrain_group::terrain_group(const std::string& id)
-: id_(id), name_(id), icon_string_()
-{
-}
-
-void terrain_group::add_terrain(t_translation::t_terrain terrain)
-{
- terrains_.push_back(terrain);
-}
-
-const std::string terrain_palette::TERRAIN_GROUP_DEFAULT = "all";
-
-static bool is_invalid_terrain(t_translation::t_terrain c) {
- return (c == t_translation::VOID_TERRAIN || c == t_translation::FOGGED);
-}
-
-terrain_palette::terrain_palette(const gamemap &map, const config& cfg)
-: map_(map), current_group_index_(0)
-{
- // Get the available terrains
- std::vector<t_translation::t_terrain> terrains =
map_.get_terrain_list();
- terrains.erase(std::remove_if(terrains.begin(), terrains.end(),
is_invalid_terrain), terrains.end());
-
- // Get the available groups and add them to the structure
- const config::child_list& group_configs = cfg.get_children("editor_group");
- std::set<std::string> group_ids;
- foreach (config* c, group_configs) {
- if (group_ids.find((*c)["id"]) == group_ids.end()) {
- groups_.push_back(terrain_group(*c, gui));
- } else {
- ERR_ED << "Duplicate terrain group: " << (*c)["id"] <<
"\n";
- }
- }
- if (groups_.find(TERRAIN_GROUP_DEFAULT) == groups_.end()) {
- ERR_ED << "No default (" << TERRAIN_GROUP_DEFAULT << ") terrain
group defined!\n";
- groups_.push_back(terrain_group(TERRAIN_GROUP_DEFAULT)));
- }
- std::map<std::string, terrain_group*> groups_map;
- foreach (terrain_group& tg, groups_) {
- groups_map.insert(std::make_pair(tg.get_id(), &tg));
- }
-
- // add the groups for all terrains to the map
- foreach (t_translation::t_terrain t, terrains) {
- const terrain_type& t_info = map_.get_terrain_info(t);
- // don't display terrains that were automatically created from
base+overlay
- if (t_info.is_combined()) continue;
-
- std::vector<std::string>& keys =
utils::split(t_info.editor_group());
- foreach (std::string& key, keys) {
- std::map<std::string, terrain_group*>::iterator it =
groups_map.find(key);
- if (it != groups_map.end()) {
- groups_map[key]->add_terrain(t);
- } else {
- WRN_ED << "Undefined terrain group used in
terrain: " << key << "\n";
- }
- }
- // Add the terrain to the default group
- groups_[TERRAIN_GROUP_DEFAULT].add_terrain(t);
- }
-}
-
-terrain_palette::current_group()
-{
- return groups_[current_group_index_];
-}
-
-int terrain_palette::groups_count()
-{
- return groups_.size();
-}
-
-void terrain_palette::next_group();
-{
- current_group_index_++;
- current_group_index_ %= groups_.size();
-}
-
-void terrain_palette::prev_group()
-{
- current_group_index_ += groups_size();
- current_group_index_--;
- current_group_index_ %= groups_.size();
-}
-
-void terrain_palette::set_group_index(int index)
-{
- assert(index >= 0);
- assert(index < groups_.size());
- current_group_index_ = index;
-}
-
-void set_group(const std::string& id)
-{
- int idx = 0;
- while (idx < groups_.size() && groups_[idx].get_id() != id) idx++;
- if (idx < groups_.size()) {
- current_group_index_ = index;
- } else {
- ERR_ED << "Invalid terrain group id (" << id << ") in
set_group\n";
- }
-}
-
-} //end namespace editor2
Propchange: trunk/src/editor2/terrain_group.cpp.wip
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/src/editor2/terrain_group.cpp.wip
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: trunk/src/editor2/terrain_group.cpp.wip
------------------------------------------------------------------------------
svn:mergeinfo =
Removed: trunk/src/editor2/terrain_group.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor2/terrain_group.hpp?rev=29958&view=auto
==============================================================================
--- trunk/src/editor2/terrain_group.hpp (original)
+++ trunk/src/editor2/terrain_group.hpp (removed)
@@ -1,65 +1,0 @@
-/* $Id$ */
-/*
- Copyright (C) 2008 by Tomasz Sniatowski <[EMAIL PROTECTED]>
- Part of the Battle for Wesnoth Project http://www.wesnoth.org/
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- or at your option any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY.
-
- See the COPYING file for more details.
-*/
-
-// UNUSED CODE -- TODO FOR THE NEW TERRAIN PALETTE
-
-#ifndef EDITOR2_TERRAIN_GROUP_HPP
-#define EDITOR2_TERRAIN_GROUP_HPP
-
-#include "action_base.hpp"
-#include "editor_map.hpp"
-#include "map_fragment.hpp"
-#include "../map.hpp"
-#include "../terrain.hpp"
-
-
-namespace editor2 {
-
-class terrain_group
-{
-public:
- terrain_group(const config& cfg);
- explicit terrain_group(const std::string id);
- void add_terrain(t_translation::t_terrain terrain);
- const std::string& get_id() const { return id_; }
- std::vector<t_translation::t_terrain> get_terrains();
-
-private:
- std::string id_;
- t_string name_;
- std::string icon_string_;
- std::vector<t_translation::t_terrain> terrains_;
-};
-
-class terrain_palette
-{
-public:
- terrain_palette(const config& cfg, const gamemap& map);
- terrain_group& current_group();
- int groups_count();
- void next_group();
- void prev_group();
- void set_group_index(int index);
- void set_group(const std::string& id);
-
- static const std::string TERRAIN_GROUP_DEFAULT;
-private:
- std::vector<terrain_group> groups_;
- int current_group_index_;
-};
-
-
-} //end namespace editor2
-
-#endif
Propchange: trunk/src/editor2/terrain_group.hpp.wip
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/src/editor2/terrain_group.hpp.wip
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: trunk/src/editor2/terrain_group.hpp.wip
------------------------------------------------------------------------------
svn:mergeinfo =
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits