This commit is contained in:
Chris Beck 2014-10-29 22:03:40 -04:00
commit 696f4daa24
8 changed files with 25 additions and 32 deletions

View File

@ -25,10 +25,8 @@
carryover::carryover(const config& side)
: add_(side["add"].to_bool())
, color_(side["color"])
, current_player_(side["current_player"])
, gold_(side["gold"].to_int())
, name_(side["name"])
// if we load it from a snapshot we need to read the recruits from "recruits" and not from "previous_recruits".
, previous_recruits_(side.has_attribute("recruit") ? utils::set_split(side["recruit"]) :utils::set_split(side["previous_recruits"]))
, recall_list_()
@ -47,10 +45,8 @@ carryover::carryover(const config& side)
carryover::carryover(const team& t, const int gold, const bool add)
: add_ (add)
, color_(t.color())
, current_player_(t.current_player())
, gold_(gold)
, name_(t.name())
, previous_recruits_(t.recruits())
, recall_list_()
, save_id_(t.save_id())
@ -108,9 +104,7 @@ std::string carryover::get_recruits(bool erase){
void carryover::update_carryover(const team& t, const int gold, const bool add){
gold_ += gold;
add_ = add;
color_ = t.color();
current_player_ = t.current_player();
name_ = t.name();
previous_recruits_.insert(t.recruits().begin(), t.recruits().end());
BOOST_FOREACH(const unit_const_ptr & u, t.recall_list()) {
recall_list_.push_back(config());
@ -141,9 +135,7 @@ void carryover::to_config(config& cfg){
side["save_id"] = save_id_;
side["gold"] = gold_;
side["add"] = add_;
side["color"] = color_;
side["current_player"] = current_player_;
side["name"] = name_;
side["previous_recruits"] = get_recruits(false);
BOOST_FOREACH(const config & u_cfg, recall_list_)
side.add_child("unit", u_cfg);

View File

@ -18,10 +18,8 @@ class carryover{
public:
carryover()
: add_ ()
, color_()
, current_player_()
, gold_()
, name_()
, previous_recruits_()
, recall_list_()
, save_id_()
@ -44,10 +42,8 @@ public:
void set_gold(int gold, bool add);
private:
bool add_;
std::string color_;
std::string current_player_;
int gold_;
std::string name_;
std::set<std::string> previous_recruits_;
// NOTE: we store configs instead of units because units often assume or
// assert that various resources:: are available, which is not the

View File

@ -856,11 +856,17 @@ side_engine::side_engine(const config& cfg, connect_engine& parent_engine,
// Tweak the controllers.
if (cfg_["controller"] == "human_ai" ||
cfg_["controller"] == "network_ai" ||
(parent_.state_.classification().campaign_type == game_classification::SCENARIO && cfg_["controller"].blank()) ||
(cfg_["controller"] == "network" && !allow_player_ && parent_.params_.saved_game)) { //this is a workaround for bug #21797
(parent_.state_.classification().campaign_type == game_classification::SCENARIO && cfg_["controller"].blank()))
{
cfg_["controller"] = "ai";
}
//this is a workaround for bug #21797
if(cfg_["controller"] == "network" && !allow_player_ && parent_.params_.saved_game)
{
WRN_MP << "Found a side controlled by a network player with allow_player=no" << std::endl;
cfg_["controller"] = "ai";
}
if (cfg_["controller"] == "null") {
set_controller(CNTR_EMPTY);
} else if (cfg_["controller"] == "ai") {
@ -869,7 +875,7 @@ side_engine::side_engine(const config& cfg, connect_engine& parent_engine,
// Reserve a side for "current_player", unless the side
// is played by an AI.
set_controller(CNTR_RESERVED);
} else if (allow_player_ && !parent_.params_.saved_game) {
} else if (allow_player_) {
set_controller(parent_.default_controller_);
} else {
// AI is the default.

View File

@ -133,16 +133,6 @@ saved_game::saved_game(const saved_game& state)
{
}
saved_game& saved_game::operator=(const saved_game& state)
{
// Use copy constructor to make sure we are coherent
if (this != &state) {
this->~saved_game();
new (this) saved_game(state) ;
}
return *this ;
}
void saved_game::set_carryover_sides_start(config carryover_sides_start)
{
carryover_.swap(carryover_sides_start);

View File

@ -27,7 +27,6 @@ public:
explicit saved_game(const config& cfg);
~saved_game(){}
saved_game& operator=(const saved_game& state);
/// writes the config information into a stream (file)
void write_config(config_writer& out) const;
@ -41,9 +40,8 @@ public:
/** Multiplayer parameters for this game */
mp_game_settings& mp_settings() { return mp_settings_; }
const mp_game_settings& mp_settings() const { return mp_settings_; }
void set_carryover_sides_start(config carryover_sides_start);
const config& carryover() { return carryover_; }
/// copies the content of a [scenario] with the correct id attribute from the game config into this object.
/// reloads the game config from disk if necessary.

View File

@ -212,6 +212,9 @@ public:
int minimum_recruit_price() const;
const std::string& last_recruit() const { return last_recruit_; }
void last_recruit(const std::string & u_type) { last_recruit_ = u_type; }
// TODO: This attribute is never used for user messages. (currently
// current_player is used there). It's only used for debug messages
// and it's accessible to wml via [store_side]. Do we really need it?
const std::string& name() const
{ return info_.name; }

View File

@ -12,6 +12,12 @@ MINOR_V=${STABLE#*.}
OLDSTABLE=$MAJOR_V.$(($MINOR_V-2))
DEV=$MAJOR_V.$(($MINOR_V+1))
PREV=$DEV-prev
if [ "$OLDSTABLE" = "1.10" ]; then
# special case for 1.10 since it kept the 1.9 dir
OLDSTABLE="1.9"
fi
echo "oldstable = $OLDSTABLE; stable = $STABLE; dev = $DEV; prev = $PREV"
set -x

View File

@ -40,10 +40,12 @@ case $SERVER in
THREADS=16 ;;
1.7*) PORT=14997
THREADS=16 ;;
1.9*) PORT=14997
THREADS=16 ;;
1.10)
1.9*|1.10*)
PORT=14997
THREADS=30 ;;
1.12*)
# TODO: increase after 1.12.0 is announced
THREADS=16 ;;
esac
ulimit -Ss 2048