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

changed DrawMap() function to allow access to named objects of the MapCreator if kept #114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TeaElKay
Copy link
Contributor

This implements DrawCreatorMap() function for LC. DrawCreatorMap uses the MapCreator used for the generation of the initial map from Landscape.txt to draw a map with named overlays the same way DrawMap() would. Like DrawDefMap it requires KeepMapCreator=1. The way it is implemented, it can also be used to append named overlays to the MapCreator.

DrawCreatorMap(0,0,LandscapeWidth(),LandscapeHeight(),"map newMap{Rock{y=0};Paper{y=33;};Scissors{y=67;};};")

Would draw a new map using overlays with the names "Rock", "Paper" and "Scissors" if they're defined in the Landscape.txt. Additonally the map "newMap" is appended to the MapCreator, so DrawDefMap(0,0,LandscapeWidth(),LandscapeHeight(),"newMap") is now possible even if newMap was not initially defined in the Landscape.txt

This implementation did not require changes to the C4MapCreatorS2.

Note: The C4MapCreatorS2::GetMap() function does always provide a drawable map if one is present in the MapCreator-Tree (i.e. is defined in Landscape.txt or appended to the MapCreator using DrawCreatorMap) thus calling DrawCreatorMap() will draw a map even if only a named overlay is defined.

@TeaElKay
Copy link
Contributor Author

TeaElKay commented Sep 26, 2024

After internal feedback, changes were made to the feature. The Function DrawCreatorMap() now no longer exists, its functionality was largely replaced by changes to DrawMap(). If KeepMapCreator=1 is present in the Scenario.txt the MapCreator will be copied and used to draw the map, which allows for the usage of named objects from the Landscape.txt. If the MapCreator isn't kept, the functionality of DrawMap() remains the same.

This removes the feature, that would have appended to the MapCreator. This functionality is still interesting, but it may be added later with a separate function.

(see https://discord.com/channels/373735548659171328/868176023852810300/1259901358119587930 for some of the internal discussion)

@TeaElKay TeaElKay changed the title added DrawCreatorMap() function changed DrawMap() function to allow access to named objects of the MapCreator if kept Sep 26, 2024
Copy link
Member

@maxmitti maxmitti left a comment

Choose a reason for hiding this comment

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

I am glad that the feature of implicitly adding new named nodes to the map creator has been removed.

I am not too experienced with MapCreatorS2. What happens if a new node has the same name as an existing node?
I am asking specifically from a compatibility perspective.

src/C4MapCreatorS2.h Outdated Show resolved Hide resolved
maxmitti
maxmitti previously approved these changes Oct 12, 2024
@maxmitti maxmitti self-requested a review October 12, 2024 18:32
@Fulgen301 Fulgen301 removed the request for review from maxmitti October 12, 2024 19:22
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.

2 participants