Example #1
0
config replay_helper::get_attack(const map_location& a, const map_location& b,
	int att_weapon, int def_weapon, const std::string& attacker_type_id,
	const std::string& defender_type_id, int attacker_lvl,
	int defender_lvl, const size_t turn, const time_of_day &t)
{

	config move, src, dst;
	a.write(src);
	b.write(dst);

	move.add_child("source", std::move(src));
	move.add_child("destination", std::move(dst));


	move["weapon"] = att_weapon;
	move["defender_weapon"] = def_weapon;
	move["attacker_type"] = attacker_type_id;
	move["defender_type"] = defender_type_id;
	move["attacker_lvl"] = attacker_lvl;
	move["defender_lvl"] = defender_lvl;
	move["turn"] = int(turn);
	move["tod"] = t.id;
	/*
	add_unit_checksum(a,current_);
	add_unit_checksum(b,current_);
	*/
	return move;
}
Example #2
0
config replay_helper::get_recruit(const std::string& type_id, const map_location& loc, const map_location& from)
{
	config val;
	val["type"] = type_id;
	loc.write(val);
	config& leader_position = val.add_child("from");
	from.write(leader_position);

	return val;
}
Example #3
0
config replay_helper::get_event(const std::string& name, const map_location& loc, const map_location*  last_select_loc)
{
	config ev;
	ev["raise"] = name;
	if(loc.valid()) {
		config& source = ev.add_child("source");
		loc.write(source);
	}
	if(last_select_loc != nullptr && last_select_loc->valid())
	{
		config& source = ev.add_child("last_select");
		last_select_loc->write(source);
	}
	return ev;
}