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

BAPI - mapmanip submap noop handling #19523

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

DreamySkrell
Copy link
Contributor

@DreamySkrell DreamySkrell commented Jun 22, 2024

changes:

  • rscadd: "BAPI - mapmanip submap noop handling."
  • rscadd: "BAPI - mapmanip submap repeat setting."

both features are explained in forum thread https://forums.aurorastation.org/topic/20511-mapmanip-guide-submaps/

but basically:

  • "noop" areas and turfs has special meaning and determine whether the submap manipulation is more like "replacing" or "appending"
  • repeat setting controls whether extracted submaps should repeat on insertion

@BotBOREALIS BotBOREALIS added Changelog Required Sprites Adds new or changes existing sprites. labels Jun 22, 2024
@DreamySkrell
Copy link
Contributor Author

!build_bapi

@github-actions github-actions bot added the 🗺️ Mapping - Horizon The PR touches the Horizon map files. label Jun 22, 2024
@DreamySkrell
Copy link
Contributor Author

!build_bapi

@DreamySkrell
Copy link
Contributor Author

!build_bapi

@DreamySkrell
Copy link
Contributor Author

!review

Comment on lines +49 to +84
match (tile_src_area_is_noop, tile_src_turf_is_noop) {
(true, true) => {
// both area and turf are noop
// append all atoms from src into dst
// use dst turf, and dst area
tile_dst.prefabs.append(&mut tile_src.prefabs);
tile_dst.prefabs.push(tile_dst_turf);
tile_dst.prefabs.push(tile_dst_area);
}
(true, false) => {
// src tile has noop area
// replace all dst atoms with src atoms
// use src turf, and dst area
tile_dst.prefabs = tile_src.prefabs;
tile_dst.prefabs.push(tile_src_turf);
tile_dst.prefabs.push(tile_dst_area);
}
(false, true) => {
// src tile has noop turf
// append all atoms from src into dst
// use dst turf, and src area
tile_dst.prefabs.append(&mut tile_src.prefabs);
tile_dst.prefabs.push(tile_dst_turf);
tile_dst.prefabs.push(tile_src_area);
}
(false, false) => {
// src tile has neither noop area nor turf
// the simplest case, just replace the whole dst tile with the src tile
// use src turf, and src area
tile_dst.prefabs = tile_src.prefabs;
tile_dst.prefabs.push(tile_src_turf);
tile_dst.prefabs.push(tile_src_area);
// do note that in dmm file format
// turf and area have to be the two last elements in a prefab
}
}
Copy link
Contributor

@Llywelwyn Llywelwyn Jun 23, 2024

Choose a reason for hiding this comment

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

let new_area = if tile_src_area_is_noop { tile_dst_area } else { tile_src_area };
let new_turf;
if tile_src_turf_is_noop {
	new_turf = tile_dst_turf
	tile_dst.prefabs.append(&mut tile_src.prefabs)
} else {
	new_turf = tile_src_turf
	tile_dst.prefabs = tile_src.prefabs
}
tile_dst.prefabs.push(new_turf);
tile_dst.prefabs.push(new_area);

something like this is functionally the same but a little cleaner than needing the comments imo

Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗺️ Mapping - Horizon The PR touches the Horizon map files. Merge Conflict Review Required Sprites Adds new or changes existing sprites. Tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants