[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth data/game.cfg ./changelog src/unit.cpp ...
From: |
David White |
Subject: |
[Wesnoth-cvs-commits] wesnoth data/game.cfg ./changelog src/unit.cpp ... |
Date: |
Sun, 27 Feb 2005 22:44:44 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: David White <address@hidden> 05/02/28 03:44:44
Modified files:
data : game.cfg
. : changelog
src : unit.cpp unit.hpp unit_types.cpp unit_types.hpp
race.hpp race.cpp
Added files:
data : traits.cfg
Log message:
added dextrous trait for elves. Removed loyal trait as a random trait;
can only be given by scenario designer. loyal units are free of upkeep.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/data/traits.cfg?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/data/game.cfg.diff?tr1=1.143&tr2=1.144&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/changelog.diff?tr1=1.511&tr2=1.512&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit.cpp.diff?tr1=1.123&tr2=1.124&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit.hpp.diff?tr1=1.60&tr2=1.61&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit_types.cpp.diff?tr1=1.82&tr2=1.83&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit_types.hpp.diff?tr1=1.60&tr2=1.61&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/race.hpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/race.cpp.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
Patches:
Index: wesnoth/changelog
diff -u wesnoth/changelog:1.511 wesnoth/changelog:1.512
--- wesnoth/changelog:1.511 Sun Feb 27 15:25:06 2005
+++ wesnoth/changelog Mon Feb 28 03:44:43 2005
@@ -1,4 +1,6 @@
CVS HEAD:
+ * made 'loyal' a trait which is only given to units explicitly by the
scenario designer
+ * added the 'dextrous' trait and applied it to Elves
* language and i18n
* new translation: Estonian
* updated translations: Dutch, French, German, Hungarian, Portuguese
(Brazilian), Russian, Slovenian, Spanish
Index: wesnoth/data/game.cfg
diff -u wesnoth/data/game.cfg:1.143 wesnoth/data/game.cfg:1.144
--- wesnoth/data/game.cfg:1.143 Sun Feb 13 12:42:26 2005
+++ wesnoth/data/game.cfg Mon Feb 28 03:44:43 2005
@@ -436,11 +436,21 @@
{units}
{~units}
+ {traits.cfg}
+
+ #traits that are common to all races and units
+ {TRAIT_STRONG}
+ {TRAIT_QUICK}
+ {TRAIT_INTELLIGENT}
+ {TRAIT_RESILIENT}
+
[race]
name=elf
num_traits=2
markov_chain_size=2
{ELVISH_NAMES}
+
+ {TRAIT_DEXTROUS}
[/race]
[race]
name=wose
@@ -509,63 +519,6 @@
{LIZARD_NAMES}
[/race]
- [trait]
- id=loyal
- name= _ "loyal"
- [effect]
- apply_to=loyal
- [/effect]
- [/trait]
-
- [trait]
- id=strong
- name= _ "strong"
- [effect]
- apply_to=attack
- range=short
- increase_damage=1
- [/effect]
- [effect]
- apply_to=hitpoints
- increase_total=2
- heal_full=yes
- [/effect]
- [/trait]
-
- [trait]
- id=quick
- name= _ "quick"
- [effect]
- apply_to=movement
- increase=1
- [/effect]
- [effect]
- apply_to=hitpoints
- increase_total=-10%
- heal_full=yes
- [/effect]
- [/trait]
-
- [trait]
- id=intelligent
- name= _ "intelligent"
- [effect]
- apply_to=max_experience
- increase=-20%
- [/effect]
- [/trait]
-
- [trait]
- id=resilient
- name= _ "resilient"
- [effect]
- apply_to=hitpoints
- increase_total=7
- #make sure the unit starts at full health
- heal_full=yes
- [/effect]
- [/trait]
-
[movetype]
name=smallfoot
[movement costs]
Index: wesnoth/src/race.cpp
diff -u wesnoth/src/race.cpp:1.13 wesnoth/src/race.cpp:1.14
--- wesnoth/src/race.cpp:1.13 Mon Feb 21 09:05:51 2005
+++ wesnoth/src/race.cpp Mon Feb 28 03:44:44 2005
@@ -7,6 +7,8 @@
#include <cstdlib>
namespace {
+
+config::child_list empty_traits;
void add_prefixes(const wide_string& str, size_t length, markov_prefix_map&
res)
{
@@ -93,12 +95,12 @@
}
-unit_race::unit_race() : ntraits_(0), chain_size_(0), not_living_(false)
+unit_race::unit_race() : ntraits_(0), chain_size_(0), not_living_(false),
traits_(&empty_traits)
{
}
unit_race::unit_race(const config& cfg) : name_(cfg["name"]),
ntraits_(atoi(cfg["num_traits"].c_str())),
- not_living_(cfg["not_living"] ==
"yes")
+ not_living_(cfg["not_living"] ==
"yes"), traits_(&cfg.get_children("trait"))
{
names_[MALE] = utils::split(cfg["male_names"]);
names_[FEMALE] = utils::split(cfg["female_names"]);
@@ -117,6 +119,11 @@
{
return
wstring_to_string(markov_generate_name(next_[gender],chain_size_,12));
}
+
+const config::child_list& unit_race::additional_traits() const
+{
+ return *traits_;
+}
int unit_race::num_traits() const { return ntraits_; }
Index: wesnoth/src/race.hpp
diff -u wesnoth/src/race.hpp:1.3 wesnoth/src/race.hpp:1.4
--- wesnoth/src/race.hpp:1.3 Thu Aug 5 21:25:12 2004
+++ wesnoth/src/race.hpp Mon Feb 28 03:44:44 2005
@@ -21,7 +21,8 @@
const std::string& name() const;
std::string generate_name(GENDER gender) const;
-
+
+ const config::child_list& additional_traits() const;
int num_traits() const;
bool not_living() const;
@@ -33,7 +34,9 @@
markov_prefix_map next_[NUM_GENDERS];
int chain_size_;
- bool not_living_;
+ bool not_living_;
+
+ const config::child_list* traits_;
};
typedef std::map<std::string,unit_race> race_map;
Index: wesnoth/src/unit.cpp
diff -u wesnoth/src/unit.cpp:1.123 wesnoth/src/unit.cpp:1.124
--- wesnoth/src/unit.cpp:1.123 Mon Feb 21 09:05:51 2005
+++ wesnoth/src/unit.cpp Mon Feb 28 03:44:43 2005
@@ -1,4 +1,4 @@
-/* $Id: unit.cpp,v 1.123 2005/02/21 09:05:51 silene Exp $ */
+/* $Id: unit.cpp,v 1.124 2005/02/28 03:44:43 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -135,11 +135,6 @@
apply_modifications();
heal_all();
statusFlags_.clear();
-
- //generate traits for the unit if it doesn't already have some
- //currently removed, because we are testing not giving advancing
- //traitless units new traits
-// generate_traits();
}
void unit::generate_traits()
@@ -160,22 +155,11 @@
std::vector<std::string> description;
- for(std::vector<config*>::const_iterator j = traits.begin(); j !=
traits.end(); ++j) {
- add_modification("trait",**j);
- description.push_back((**j)["name"]);
- }
-
- traitsDescription_ = "";
-
- //we want to make sure the description always has a consistent ordering
- std::sort(description.begin(),description.end());
- for(std::vector<std::string>::const_iterator i = description.begin(); i
!= description.end(); ++i) {
- if(i != description.begin()) {
- traitsDescription_ += ", ";
- }
-
- traitsDescription_ += gettext(i->c_str());
+ for(std::vector<config*>::const_iterator j = traits.begin(); j !=
traits.end(); ++j) {
+ modifications_.add_child("trait",**j);
}
+
+ apply_modifications();
}
const unit_type& unit::type() const
@@ -1181,15 +1165,34 @@
void unit::apply_modifications()
{
log_scope("apply mods");
- modificationDescriptions_.clear();
+ modificationDescriptions_.clear();
+
+ std::vector<std::string> descriptions;
for(size_t i = 0; i != NumModificationTypes; ++i) {
const std::string& mod = ModificationTypes[i];
const config::child_list& mods =
modifications_.get_children(mod);
for(config::child_list::const_iterator j = mods.begin(); j !=
mods.end(); ++j) {
log_scope("add mod");
- add_modification(ModificationTypes[i],**j,true);
- }
+ add_modification(ModificationTypes[i],**j,true);
+
+ const std::string& name = (**j)["name"];
+ if(name.empty() == false) {
+ descriptions.push_back(name);
+ }
+ }
+ }
+
+ traitsDescription_ = "";
+
+ //we want to make sure the description always has a consistent ordering
+ std::sort(descriptions.begin(),descriptions.end());
+ for(std::vector<std::string>::const_iterator j = descriptions.begin();
j != descriptions.end(); ++j) {
+ if(j != descriptions.begin()) {
+ traitsDescription_ += ", ";
+ }
+
+ traitsDescription_ += gettext(j->c_str());
}
}
@@ -1222,7 +1225,7 @@
{
switch(upkeep_) {
case UPKEEP_FREE: return 0;
- case UPKEEP_LOYAL: return minimum<int>(1,type().level());
+ case UPKEEP_LOYAL: return 0;
case UPKEEP_FULL_PRICE: return type().level();
default: wassert(false); return 0;
}
Index: wesnoth/src/unit.hpp
diff -u wesnoth/src/unit.hpp:1.60 wesnoth/src/unit.hpp:1.61
--- wesnoth/src/unit.hpp:1.60 Wed Feb 9 23:32:01 2005
+++ wesnoth/src/unit.hpp Mon Feb 28 03:44:44 2005
@@ -1,4 +1,4 @@
-/* $Id: unit.hpp,v 1.60 2005/02/09 23:32:01 ydirson Exp $ */
+/* $Id: unit.hpp,v 1.61 2005/02/28 03:44:44 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -226,7 +226,8 @@
void reset_modifications();
void apply_modifications();
void remove_temporary_modifications();
- void generate_traits();
+ void generate_traits();
+ void generate_traits_description();
};
//object which temporarily resets a unit's movement
Index: wesnoth/src/unit_types.cpp
diff -u wesnoth/src/unit_types.cpp:1.82 wesnoth/src/unit_types.cpp:1.83
--- wesnoth/src/unit_types.cpp:1.82 Tue Feb 22 00:03:53 2005
+++ wesnoth/src/unit_types.cpp Mon Feb 28 03:44:44 2005
@@ -1,4 +1,4 @@
-/* $Id: unit_types.cpp,v 1.82 2005/02/22 00:03:53 silene Exp $ */
+/* $Id: unit_types.cpp,v 1.83 2005/02/28 03:44:44 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -579,7 +579,11 @@
const race_map::const_iterator race_it = races.find(cfg["race"]);
if(race_it != races.end()) {
- race_ = &race_it->second;
+ race_ = &race_it->second;
+ if(race_ != NULL) {
+ const config::child_list& traits =
race_->additional_traits();
+
possibleTraits_.insert(possibleTraits_.end(),traits.begin(),traits.end());
+ }
} else {
static const unit_race dummy_race;
race_ = &dummy_race;
Index: wesnoth/src/unit_types.hpp
diff -u wesnoth/src/unit_types.hpp:1.60 wesnoth/src/unit_types.hpp:1.61
--- wesnoth/src/unit_types.hpp:1.60 Tue Feb 22 00:03:53 2005
+++ wesnoth/src/unit_types.hpp Mon Feb 28 03:44:44 2005
@@ -1,4 +1,4 @@
-/* $Id: unit_types.hpp,v 1.60 2005/02/22 00:03:53 silene Exp $ */
+/* $Id: unit_types.hpp,v 1.61 2005/02/28 03:44:44 Sirp Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -277,7 +277,7 @@
unit_movement_type movementType_;
- const std::vector<config*>& possibleTraits_;
+ std::vector<config*> possibleTraits_;
std::vector<unit_race::GENDER> genders_;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth data/game.cfg ./changelog src/unit.cpp ...,
David White <=