mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-18 09:03:32 +00:00
Fixed bug #19599: Engine keeps redundant ai_special information for units.
Patch #3235 by Ayne.
This commit is contained in:
parent
e8c4a79dc9
commit
d767abd3ed
@ -58,6 +58,8 @@ Version 1.11.0-svn:
|
|||||||
* is scaled to fit at all resolutions.
|
* is scaled to fit at all resolutions.
|
||||||
* Removed the scrolling feature which is no longer needed.
|
* Removed the scrolling feature which is no longer needed.
|
||||||
* Map label placement tool
|
* Map label placement tool
|
||||||
|
* Engine:
|
||||||
|
* Fixed bug #19599: Engine keeps redundant unit.ai_special_ information.
|
||||||
* Graphics:
|
* Graphics:
|
||||||
* New graphics for the Spectre.
|
* New graphics for the Spectre.
|
||||||
* Language and i18n:
|
* Language and i18n:
|
||||||
|
@ -894,6 +894,9 @@
|
|||||||
[entry]
|
[entry]
|
||||||
name = "Andrius Štikonas"
|
name = "Andrius Štikonas"
|
||||||
[/entry]
|
[/entry]
|
||||||
|
[entry]
|
||||||
|
name = "Anja Keicher (ayne)"
|
||||||
|
[/entry]
|
||||||
[entry]
|
[entry]
|
||||||
name = "Ben Anderman (crimson_penguin)"
|
name = "Ben Anderman (crimson_penguin)"
|
||||||
comment = "unit list"
|
comment = "unit list"
|
||||||
|
13
src/unit.cpp
13
src/unit.cpp
@ -156,7 +156,6 @@ unit::unit(const unit& o):
|
|||||||
overlays_(o.overlays_),
|
overlays_(o.overlays_),
|
||||||
|
|
||||||
role_(o.role_),
|
role_(o.role_),
|
||||||
ai_special_(o.ai_special_),
|
|
||||||
attacks_(o.attacks_),
|
attacks_(o.attacks_),
|
||||||
facing_(o.facing_),
|
facing_(o.facing_),
|
||||||
|
|
||||||
@ -236,7 +235,6 @@ unit::unit(const config &cfg, bool use_traits, game_state* state, const vconfig*
|
|||||||
state_(STATE_STANDING),
|
state_(STATE_STANDING),
|
||||||
overlays_(),
|
overlays_(),
|
||||||
role_(cfg["role"]),
|
role_(cfg["role"]),
|
||||||
ai_special_(cfg["ai_special"]),
|
|
||||||
attacks_(),
|
attacks_(),
|
||||||
facing_(map_location::NDIRECTIONS),
|
facing_(map_location::NDIRECTIONS),
|
||||||
trait_names_(),
|
trait_names_(),
|
||||||
@ -445,7 +443,7 @@ unit::unit(const config &cfg, bool use_traits, game_state* state, const vconfig*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(cfg["ai_special"] == "guardian") {
|
if(cfg["ai_special"] == "guardian") {
|
||||||
set_state("guardian", true);
|
set_state(STATE_GUARDIAN, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove animations from private cfg, they're not needed there now
|
// Remove animations from private cfg, they're not needed there now
|
||||||
@ -597,7 +595,6 @@ unit::unit(const unit_type *t, int side, bool real_unit,
|
|||||||
state_(STATE_STANDING),
|
state_(STATE_STANDING),
|
||||||
overlays_(),
|
overlays_(),
|
||||||
role_(),
|
role_(),
|
||||||
ai_special_(),
|
|
||||||
attacks_(),
|
attacks_(),
|
||||||
facing_(static_cast<map_location::DIRECTION>(rand()%map_location::NDIRECTIONS)),
|
facing_(static_cast<map_location::DIRECTION>(rand()%map_location::NDIRECTIONS)),
|
||||||
trait_names_(),
|
trait_names_(),
|
||||||
@ -1071,7 +1068,6 @@ void unit::end_turn()
|
|||||||
}
|
}
|
||||||
void unit::new_scenario()
|
void unit::new_scenario()
|
||||||
{
|
{
|
||||||
ai_special_ = "";
|
|
||||||
|
|
||||||
// Set the goto-command to be going to no-where
|
// Set the goto-command to be going to no-where
|
||||||
goto_ = map_location();
|
goto_ = map_location();
|
||||||
@ -1101,6 +1097,7 @@ void unit::new_scenario()
|
|||||||
set_state(STATE_SLOWED, false);
|
set_state(STATE_SLOWED, false);
|
||||||
set_state(STATE_POISONED, false);
|
set_state(STATE_POISONED, false);
|
||||||
set_state(STATE_PETRIFIED, false);
|
set_state(STATE_PETRIFIED, false);
|
||||||
|
set_state(STATE_GUARDIAN, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void unit::heal(int amount)
|
void unit::heal(int amount)
|
||||||
@ -1172,8 +1169,7 @@ std::map<std::string, unit::state_t> unit::get_known_boolean_state_names()
|
|||||||
known_boolean_state_names_map.insert(std::make_pair("uncovered", STATE_UNCOVERED));
|
known_boolean_state_names_map.insert(std::make_pair("uncovered", STATE_UNCOVERED));
|
||||||
known_boolean_state_names_map.insert(std::make_pair("not_moved",STATE_NOT_MOVED));
|
known_boolean_state_names_map.insert(std::make_pair("not_moved",STATE_NOT_MOVED));
|
||||||
known_boolean_state_names_map.insert(std::make_pair("unhealable",STATE_UNHEALABLE));
|
known_boolean_state_names_map.insert(std::make_pair("unhealable",STATE_UNHEALABLE));
|
||||||
//not sure if "guardian" is a yes/no state.
|
known_boolean_state_names_map.insert(std::make_pair("guardian",STATE_GUARDIAN));
|
||||||
//known_boolean_state_names_map.insert(std::make_pair("guardian",STATE_GUARDIAN));
|
|
||||||
return known_boolean_state_names_map;
|
return known_boolean_state_names_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1419,7 +1415,7 @@ bool unit::internal_matches_filter(const vconfig& cfg, const map_location& loc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
config::attribute_value cfg_ai_special = cfg["ai_special"];
|
config::attribute_value cfg_ai_special = cfg["ai_special"];
|
||||||
if (!cfg_ai_special.blank() && cfg_ai_special.str() != ai_special_) {
|
if (!cfg_ai_special.blank() && ((cfg_ai_special.str() == "guardian" ? true : false) != get_state(STATE_GUARDIAN))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1638,7 +1634,6 @@ void unit::write(config& cfg) const
|
|||||||
cfg["variation"] = variation_;
|
cfg["variation"] = variation_;
|
||||||
|
|
||||||
cfg["role"] = role_;
|
cfg["role"] = role_;
|
||||||
cfg["ai_special"] = ai_special_;
|
|
||||||
cfg["flying"] = flying_;
|
cfg["flying"] = flying_;
|
||||||
|
|
||||||
config status_flags;
|
config status_flags;
|
||||||
|
@ -171,7 +171,7 @@ public:
|
|||||||
bool get_state(const std::string& state) const;
|
bool get_state(const std::string& state) const;
|
||||||
void set_state(const std::string &state, bool value);
|
void set_state(const std::string &state, bool value);
|
||||||
enum state_t { STATE_SLOWED = 0, STATE_POISONED, STATE_PETRIFIED,
|
enum state_t { STATE_SLOWED = 0, STATE_POISONED, STATE_PETRIFIED,
|
||||||
STATE_UNCOVERED, STATE_NOT_MOVED, STATE_UNHEALABLE, STATE_UNKNOWN = -1 };
|
STATE_UNCOVERED, STATE_NOT_MOVED, STATE_UNHEALABLE, STATE_GUARDIAN, STATE_UNKNOWN = -1 };
|
||||||
void set_state(state_t state, bool value);
|
void set_state(state_t state, bool value);
|
||||||
bool get_state(state_t state) const;
|
bool get_state(state_t state) const;
|
||||||
static state_t get_known_boolean_state_id(const std::string &state);
|
static state_t get_known_boolean_state_id(const std::string &state);
|
||||||
@ -190,8 +190,6 @@ public:
|
|||||||
void set_role(const std::string& role) { role_ = role; }
|
void set_role(const std::string& role) { role_ = role; }
|
||||||
const std::string &get_role() const { return role_; }
|
const std::string &get_role() const { return role_; }
|
||||||
|
|
||||||
void assign_ai_special(const std::string& s) { ai_special_ = s;}
|
|
||||||
std::string get_ai_special() const { return(ai_special_); }
|
|
||||||
const std::vector<attack_type>& attacks() const { return attacks_; }
|
const std::vector<attack_type>& attacks() const { return attacks_; }
|
||||||
std::vector<attack_type>& attacks() { return attacks_; }
|
std::vector<attack_type>& attacks() { return attacks_; }
|
||||||
|
|
||||||
@ -436,7 +434,6 @@ private:
|
|||||||
std::vector<std::string> overlays_;
|
std::vector<std::string> overlays_;
|
||||||
|
|
||||||
std::string role_;
|
std::string role_;
|
||||||
std::string ai_special_;
|
|
||||||
std::vector<attack_type> attacks_;
|
std::vector<attack_type> attacks_;
|
||||||
map_location::DIRECTION facing_;
|
map_location::DIRECTION facing_;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user