This commit is contained in:
ln-zookeeper 2016-11-01 00:26:40 +02:00
commit 2c85743f75
5 changed files with 28 additions and 7 deletions

View file

@ -101,6 +101,8 @@ Version 1.13.5+dev:
only used if any [option] appear
* Added value= to [option]: if specified, gives value to store in variable
instead of index number, only used if variable= appears in [message]
* New second_unit, second_image, second_mirror attributes for showing two
portraits on a single message.
* New attributes for [role]:
* search_recall_list=yes|no|only(default yes) controls where to look
* reassign=yes|no(default yes) if no, check for a unit and do not assign to
@ -137,7 +139,9 @@ Version 1.13.5+dev:
* Fixed filter returning invalid locations if invalid locations were given
in a variable that was used with find_in=
* Moves cave map generator to lua. scenario_generation=cave is now deprecated and
will be removed soon.
will be removed soon. The Lua version has feature parity with the old one, but
the syntax is a little different. It supports both map_generation and
scenario_generation.
* Tunnel functionality was expanded and the default behavior was altered in
order to make moves through tunnels consistent with all other moves:
* Vison through tunnels is now possible and enabled by default. It can be
@ -198,6 +202,8 @@ Version 1.13.5+dev:
full attack analysis.
* Aspect fetcher functions (eg ai.get_aggression()) are now deprecated in favour
of the ai.aspects table.
* The location_set iter and stable_iter functions can now be called with no argument.
In this case, they return an iterator suitable for use in a for loop.
* Networking
* Ported campaignd to use boost.asio instead of SDL_net.
* Removed unit tests for old networking stack. This was the last part that

View file

@ -61,7 +61,7 @@ function callbacks.generate_map(params)
y = random(tonumber(y_min), tonumber(y_max))
end
local locs_set = LS.create()
build_chamber(x, y, locs_set, chambers.size or 3, chambers.size or 0)
build_chamber(x, y, locs_set, chamber.size or 3, chamber.jagged or 0)
local items = {}
for item in helper.child_range(chamber, "item_location") do
table.insert(items, item)
@ -165,10 +165,10 @@ end
function callbacks.generate_scenario(params)
-- This is more or less backwards compatible with the cave generator syntax
local scenario = helper.child(params, "scenario")
local scenario = helper.get_child(params, "scenario")
scenario.map_data = callbacks.generate_map(params)
for chamber in helper.child_range(params, "chamber") do
local items = helper.child(chamber, "items")
local items = helper.get_child(chamber, "items")
if chamber.chance == 100 and chamber_items then
-- TODO: Should we support [event]same_location_as_previous=yes?
for i,tag in ipairs(chamber_items) do

View file

@ -32,6 +32,10 @@ lua_map_generator::lua_map_generator(const config & cfg)
const char* required[] = {"id", "config_name", "create_map"};
for (std::string req : required) {
if (!cfg.has_attribute(req)) {
if(req == "create_map" && cfg.has_attribute("create_scenario")) {
// One of these is required, but not both
continue;
}
std::string msg = "Error when constructing a lua map generator -- missing a required attribute '";
msg += req + "'\n";
msg += "Config was '" + cfg.debug() + "'";
@ -54,6 +58,10 @@ void lua_map_generator::user_config()
std::string lua_map_generator::create_map(boost::optional<uint32_t> seed)
{
if(create_map_.empty()) {
return map_generator::create_map(seed);
}
try {
return lk_.create_map(create_map_.c_str(), generator_data_, seed);
} catch (game::lua_error & e) {
@ -66,8 +74,8 @@ std::string lua_map_generator::create_map(boost::optional<uint32_t> seed)
config lua_map_generator::create_scenario(boost::optional<uint32_t> seed)
{
if (!create_scenario_.size()) {
return map_generator::create_scenario();
if(create_scenario_.empty()) {
return map_generator::create_scenario(seed);
}
try {

View file

@ -34,6 +34,10 @@ config map_generator::create_scenario(boost::optional<uint32_t> randomseed)
res["map_data"] = create_map(randomseed);
return res;
}
std::string map_generator::create_map(boost::optional<uint32_t> randomseed)
{
return create_scenario(randomseed)["map_data"];
}
/**
by default we don't allow user configs.
*/

View file

@ -322,10 +322,13 @@ public:
ttree_view_node* selected = dynamic_cast<ttree_view&>(tree).selected_item();
callbacks[selected->describe_path()](*selected);
// We recursively fold, but non-recursively unfold.
// This is because only one node on a level should be open at any given time.
// Furthermore, there's no need to remember that a subnode was open once the parent is closed.
if(!selected->is_root_node()) {
for(auto& node : selected->parent_node().children()) {
if(&node != selected) {
node.fold();
node.fold(true);
}
}