Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor the game map to permit exposing it to Lua via wesnoth.curren…
…t.map The method of accessing terrain on the map has drastically changed. - wesnoth.get_terrain and wesnoth.set_terrain are both deprecated - wesnoth.terrain_mask still works but is moved into the wesnoth.map module and now takes the map object as the first parameter - The map's terrain is now accessed exclusively via indexing on the map object, ie map[{x,y}] - You set terrain by assigning a terrain code; the position of ^ in the terrain code now determines the merge mode - The replace_if_failed option is now manifested as a function that converts any terrain code into a special value that, when assigned to a location on the map, uses the replace if failed logic. The map object has a few attributes in it: - width and height are the total size, including borders - playable_width and playable_height are the values returned from wesnoth.get_map_size, which is now deprecated - border_size is the third value from wesnoth.get_map_size - data converts the map to a string - other than that, wesnoth.map is treated as if it were the metatable of the map object Other stuff in here: - Special locations are now part of the map object. The length operator is deprecated. - Add some utility functions to help clarify the merge mode being used when assigning terrains - they just add or remove a leading or trailing ^ as necessary - Add a utility function to extract a location from the front of a variadic parameter pack
- Loading branch information
1 parent
cc395fb
commit add5c1e
Showing
15 changed files
with
646 additions
and
840 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.