[wesnoth-commits] [wesnoth/wesnoth] 8366eb: Refactor the game map to permit exposing it to Lua...
Celtic Minstrel
noreply at github.com
Tue Feb 23 06:55:57 UTC 2021
Branch: refs/heads/lua_gamemap
Home: https://github.com/wesnoth/wesnoth
Commit: 8366eb0064db20e3f9e3c0c435b6d2c06ca9bdaf
https://github.com/wesnoth/wesnoth/commit/8366eb0064db20e3f9e3c0c435b6d2c06ca9bdaf
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M data/lua/core/map.lua
M src/editor/action/action.cpp
M src/editor/action/mouse/mouse_action.cpp
M src/editor/map/editor_map.cpp
M src/game_board.cpp
M src/game_board.hpp
M src/map/map.cpp
M src/map/map.hpp
M src/scripting/game_lua_kernel.cpp
M src/scripting/game_lua_kernel.hpp
M src/scripting/lua_terrainfilter.cpp
M src/scripting/lua_terrainfilter.hpp
M src/scripting/lua_terrainmap.cpp
M src/scripting/lua_terrainmap.hpp
M src/scripting/mapgen_lua_kernel.cpp
Log Message:
-----------
Refactor the game map to permit exposing it to Lua via wesnoth.current.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
- Special locations are now part of the map object. The length operator is deprecated.
- other than that, wesnoth.map is treated as if it were the metatable of the map object
Commit: 87aea69e32ad238005e3ea094b92c5ba29ceefaf
https://github.com/wesnoth/wesnoth/commit/87aea69e32ad238005e3ea094b92c5ba29ceefaf
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M data/lua/core/map.lua
M src/scripting/game_lua_kernel.cpp
M src/scripting/game_lua_kernel.hpp
Log Message:
-----------
Move various functions into the map module
Commit: 2dc4417eeeaf3ec10efc8964f7b62ccdbb41fea0
https://github.com/wesnoth/wesnoth/commit/2dc4417eeeaf3ec10efc8964f7b62ccdbb41fea0
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M data/lua/core/map.lua
M src/scripting/game_lua_kernel.cpp
M src/scripting/lua_terrainfilter.cpp
M src/scripting/lua_terrainmap.cpp
M src/scripting/lua_terrainmap.hpp
M src/scripting/mapgen_lua_kernel.cpp
Log Message:
-----------
Rename existing map functions in the map generation kernel
Commit: 79d14525f7156b95a39422d9a03d011d4f2ea5ba
https://github.com/wesnoth/wesnoth/commit/79d14525f7156b95a39422d9a03d011d4f2ea5ba
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M data/lua/core/map.lua
M src/scripting/lua_kernel_base.cpp
Log Message:
-----------
Rename two functions for consistency of terminology
Commit: 349bbe5a5d45b3862cd245634b01875abeb7ab2c
https://github.com/wesnoth/wesnoth/commit/349bbe5a5d45b3862cd245634b01875abeb7ab2c
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M src/scripting/game_lua_kernel.cpp
M src/scripting/game_lua_kernel.hpp
Log Message:
-----------
Add wesnoth.map.get_label
Commit: 815a499052814b96f34055cce6a4a8bc22e714b7
https://github.com/wesnoth/wesnoth/commit/815a499052814b96f34055cce6a4a8bc22e714b7
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M src/scripting/lua_kernel_base.cpp
M src/scripting/lua_map_location_ops.cpp
M src/scripting/lua_map_location_ops.hpp
Log Message:
-----------
Add wesnoth.map.get_hexes_in_radius
Commit: cba75ef597b300c60aef3ff7b78b3df013560369
https://github.com/wesnoth/wesnoth/commit/cba75ef597b300c60aef3ff7b78b3df013560369
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M src/scripting/game_lua_kernel.cpp
M src/scripting/lua_terrainmap.cpp
M src/scripting/lua_terrainmap.hpp
Log Message:
-----------
Add on_board and on_border map methods
Commit: e3c76a11414eeca7609c7b93ae8cb31e55765a90
https://github.com/wesnoth/wesnoth/commit/e3c76a11414eeca7609c7b93ae8cb31e55765a90
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M src/scripting/game_lua_kernel.cpp
M src/scripting/lua_terrainmap.cpp
M src/scripting/lua_terrainmap.hpp
Log Message:
-----------
Implement a map iterator
Commit: 019d79865f9245d2cd70faf1e2696cb189143875
https://github.com/wesnoth/wesnoth/commit/019d79865f9245d2cd70faf1e2696cb189143875
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M data/lua/core/map.lua
Log Message:
-----------
Add a terrain hex reference API
This adds a metatable to all locations returned from wesnoth.map.find.
Commit: 18c5694c15b71532118fd2418ab87ce297e73121
https://github.com/wesnoth/wesnoth/commit/18c5694c15b71532118fd2418ab87ce297e73121
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M data/lua/core/map.lua
M src/scripting/game_lua_kernel.cpp
M src/scripting/game_lua_kernel.hpp
Log Message:
-----------
Add a wesnoth.terrain_types table
Commit: c54e7ee8ec7357ed269901e30b836bed9b6fa906
https://github.com/wesnoth/wesnoth/commit/c54e7ee8ec7357ed269901e30b836bed9b6fa906
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M data/ai/lua/ai_helper.lua
M data/ai/lua/battle_calcs.lua
M data/ai/lua/ca_castle_switch.lua
M data/ai/lua/ca_grab_villages.lua
M data/ai/lua/ca_recruit_rushers.lua
M data/ai/lua/ca_spread_poison.lua
M data/ai/lua/ca_village_hunt.lua
M data/ai/lua/generic_recruit_engine.lua
M data/ai/lua/retreat.lua
M data/ai/micro_ais/cas/ca_assassin_move.lua
M data/ai/micro_ais/cas/ca_big_animals.lua
M data/ai/micro_ais/cas/ca_bottleneck_move.lua
M data/ai/micro_ais/cas/ca_fast_attack_utils.lua
M data/ai/micro_ais/cas/ca_fast_move.lua
M data/ai/micro_ais/cas/ca_forest_animals_new_rabbit.lua
M data/ai/micro_ais/cas/ca_goto.lua
M data/ai/micro_ais/cas/ca_healer_move.lua
M data/ai/micro_ais/cas/ca_herding_dog_move.lua
M data/ai/micro_ais/cas/ca_herding_f_herding_area.lua
M data/ai/micro_ais/cas/ca_herding_herd_sheep.lua
M data/ai/micro_ais/cas/ca_lurkers.lua
M data/ai/micro_ais/cas/ca_protect_unit_move.lua
M data/ai/micro_ais/cas/ca_recruit_random.lua
M data/ai/micro_ais/cas/ca_stationed_guardian.lua
M data/ai/micro_ais/cas/ca_wolves_move.lua
M data/ai/micro_ais/cas/ca_zone_guardian.lua
M data/campaigns/Descent_Into_Darkness/scenarios/04_Spring_of_Reprisal.cfg
M data/campaigns/Eastern_Invasion/ai/ca_ogres_flee.lua
M data/campaigns/Eastern_Invasion/lua/bandits.lua
M data/campaigns/Heir_To_The_Throne/scenarios/13_The_Dwarven_Doors.cfg
M data/campaigns/Northern_Rebirth/lua/respawn_utils.lua
M data/campaigns/Son_Of_The_Black_Eye/ai/ca_transport_S6.lua
M data/campaigns/The_Hammer_of_Thursagan/lua/spawns.lua
M data/campaigns/The_Hammer_of_Thursagan/scenarios/05_Fear.cfg
M data/campaigns/Two_Brothers/ai/ca_muff_toras_move.lua
M data/campaigns/World_Conquest/lua/campaign/autorecall.lua
M data/campaigns/World_Conquest/lua/campaign/enemy.lua
M data/campaigns/World_Conquest/lua/campaign/enemy_themed.lua
M data/campaigns/World_Conquest/lua/game_mechanics/bonus.lua
M data/campaigns/World_Conquest/lua/game_mechanics/supply.lua
M data/campaigns/World_Conquest/lua/map/generator/utilities.lua
M data/campaigns/World_Conquest/lua/map/postgeneration/1A_Start.lua
M data/campaigns/World_Conquest/lua/map/postgeneration/2A_Springs.lua
M data/campaigns/World_Conquest/lua/map/postgeneration/2C_Glaciers.lua
M data/campaigns/World_Conquest/lua/map/postgeneration/2D_Provinces.lua
M data/campaigns/World_Conquest/lua/map/postgeneration/2E_Paradise.lua
M data/campaigns/World_Conquest/lua/map/postgeneration/3C_Delta.lua
M data/campaigns/World_Conquest/lua/map/postgeneration/3F_Wetland.lua
M data/campaigns/World_Conquest/lua/map/postgeneration/4A_Thermal.lua
M data/campaigns/World_Conquest/lua/map/postgeneration/4B_Volcanic.lua
M data/campaigns/World_Conquest/lua/map/postgeneration/4C_Mines.lua
M data/campaigns/World_Conquest/lua/map/postgeneration/6A_Rural.lua
M data/campaigns/World_Conquest/lua/map/postgeneration/6B_Maritime.lua
M data/campaigns/World_Conquest/lua/map/postgeneration/6C_Industrial.lua
M data/campaigns/World_Conquest/lua/map/postgeneration/6D_Feudal.lua
M data/campaigns/World_Conquest/lua/map/postgeneration_utils/engine.lua
M data/campaigns/World_Conquest/lua/map/postgeneration_utils/events.lua
M data/campaigns/World_Conquest/lua/map/postgeneration_utils/noise.lua
M data/campaigns/World_Conquest/lua/map/postgeneration_utils/utilities.lua
M data/campaigns/World_Conquest/lua/map/postgeneration_utils/wild_zones.lua
M data/campaigns/World_Conquest/lua/map/scenario_utils/bonus_points.lua
M data/campaigns/World_Conquest/lua/map/wct_map_generator.lua
M data/campaigns/World_Conquest/lua/optional_mechanics/destruction.lua
M data/lua/helper.lua
M data/lua/location_set.lua
M data/lua/wml-tags.lua
M data/lua/wml/animate_unit.lua
M data/lua/wml/find_path.lua
M data/lua/wml/items.lua
M data/lua/wml/modify_side.lua
M data/lua/wml/random_placement.lua
M data/modifications/pick_advance/main.lua
M data/multiplayer/scenarios/2p_Dark_Forecast.lua
M data/scenario-test.cfg
M src/scripting/lua_terrainmap.cpp
Log Message:
-----------
Update everything to use the new wesnoth.map module
- get_terrain and set_terrain replaced with direct indexing operations
- get_map_size mostly replaced with either the iterator or an on_board call.
Only a few cases really needed to know the size of the map for some other purpose.
- shroud and fog operations, village owner, time areas, and location filters
- get_terrain_info replaced with terrain_types table
- Map generation functions create_map and create_filter
Commit: c55373f082997822389ac120ce2b25b84975bfdc
https://github.com/wesnoth/wesnoth/commit/c55373f082997822389ac120ce2b25b84975bfdc
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M src/map/location.cpp
Log Message:
-----------
No reason to use the less clear implementation, is there?
Commit: b4de3df0fc357a8cda76d7fda1ccca12c5b95aba
https://github.com/wesnoth/wesnoth/commit/b4de3df0fc357a8cda76d7fda1ccca12c5b95aba
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M data/campaigns/World_Conquest/lua/map/postgeneration_utils/engine.lua
M data/lua/core/map.lua
Log Message:
-----------
Move WC's filter tag helpers into core
Commit: 7f89ffa3afa4985dccd903e7ced9222202b3ad42
https://github.com/wesnoth/wesnoth/commit/7f89ffa3afa4985dccd903e7ced9222202b3ad42
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M src/scripting/lua_terrainfilter.cpp
Log Message:
-----------
Fix mapgen "notall" filter not working
Commit: fa560069428b9a15edba1f39ac980122b9636c31
https://github.com/wesnoth/wesnoth/commit/fa560069428b9a15edba1f39ac980122b9636c31
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M src/scripting/lua_terrainfilter.cpp
M src/scripting/lua_terrainfilter.hpp
M src/scripting/mapgen_lua_kernel.cpp
Log Message:
-----------
For consistency, mapgen should also expose a matches function
Commit: 891299dc9f76dbad7f182af68f548d8b61d509ab
https://github.com/wesnoth/wesnoth/commit/891299dc9f76dbad7f182af68f548d8b61d509ab
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M src/scripting/game_lua_kernel.cpp
Log Message:
-----------
Enable find() and matches() to be called as map methods
Commit: fcdffbae36769e8c73c81f836269df408bc3b04c
https://github.com/wesnoth/wesnoth/commit/fcdffbae36769e8c73c81f836269df408bc3b04c
Author: Celtic Minstrel <celtic.minstrel.ca at some.place>
Date: 2021-02-23 (Tue, 23 Feb 2021)
Changed paths:
M data/lua/wml/test_condition.lua
Log Message:
-----------
Update [test_condition] to be a little more verbose and make use of newer features
Compare: https://github.com/wesnoth/wesnoth/compare/edcc217ae4a5...fcdffbae3676
More information about the Commits
mailing list