Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tribes filtering #3693

Merged
merged 215 commits into from Aug 18, 2020
Merged

Tribes filtering #3693

merged 215 commits into from Aug 18, 2020

Conversation

gunchleoc
Copy link
Contributor

@gunchleoc gunchleoc commented Feb 16, 2020

This PR contains code to only load the tribes that are actually being used.

I am planning to use the same design for loading the world, so that defining units will become orthogonal again. However, this branch is already big as it is.

Note that I relaxed the testing requirements a bit, because conquering is not working properly in the editor. This could be tested by merging the scenario editor branch once it's usable again.

Coding changes:

  • Map object types are registered in a new class DescriptionManager
  • Each tribe only gets loaded when a player is playing as that tribe
  • Buildings and immovables can still be placed via Lua,
    e.g. we can place a frisian_fortress if nobody is playing Frisians.
    If they need immovables with an attribute, these are loaded dynamically via the
    attribute.
  • Support for custom scenario wares as well as workers and buildings
  • Support for overwriting default units via scenario code
  • Fix subdirectory handling in zip file system
  • Player statistics and allowed ware/worker types are now stored in maps rather than vectors
  • Make success of LuaFlag::set_wares independent of wares order
  • Clean up some superfluous includes
  • New test scenario that places all tribes' buildings
  • Added new tests to market scenario and lua_testsuite for foreign and custom units
  • Added a script for bulk renaming files with git mv. It just somehow ended up in this branch...

Changes to the Lua interface:

  • For each init.lua, there is a register.lua.
    The register.lua registers the names and attributes with the engine, like this:
    return {
        berry_bush_blueberry_tiny = { "seed_berrybush" },
        berry_bush_blueberry_small = {},
        berry_bush_blueberry_medium = { "flowering" },
        berry_bush_blueberry_ripe = { "ripe_bush" },
    }
  • Custom scenario units to be added to a tribe are now defined via a table rather
    than special Lua functions
  • If you're overwriting a default unit without assigning it to a different tribe,
    just place an init.lua and register.lua below <scenario>/scripting/tribes.
    There's no need to list it in <scenario>/scripting/tribes/init.lua as well.

…eparate file + cleanup includes. Removed some dead code from src/map_io/map_buildingdata_packet.cc.
Copy link
Member

@Noordfrees Noordfrees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only two minor comments regarding the testsuite left, code LGTM. Will test this a bit more today.

sleep(2000)
prefilled_buildings(p1, { "barbarians_custom_building", 22, 27 })
custom_building = map:get_field(22, 27).immovable
-- NOCOM busy roads are broken
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then do please :)
This is the last nit, once this is done this is good to go in

@gunchleoc
Copy link
Contributor Author

Thanks a lot for this big review :)

@gunchleoc gunchleoc merged commit d06d4c4 into widelands:master Aug 18, 2020
@gunchleoc gunchleoc deleted the tribes-filtering branch August 18, 2020 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants