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

Tileset JSON: deprecate additional_tiles key and move contents into multitile key #46253

Closed
int-ua opened this issue Dec 22, 2020 · 5 comments
Closed
Labels
Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style <Documentation> Design documents, internal info, guides and help. SDL: Tiles / Sound Tiles visual interface and sounds. stale Closed for lack of activity, but still valid.

Comments

@int-ua
Copy link
Contributor

int-ua commented Dec 22, 2020

Is your feature request related to a problem? Please describe.

If "multitile": true always requires additional_tiles key to be present they can be simply merged, I don't see a need to have them both.

Describe the solution you'd like

Move contents of additional_tiles into multitile value, don't check if multitile is true but if it's present at all. Maybe I'll try to do that later but I already have a lot of other things to do.

Suggestion from @anothersimulacrum :

diff --git a/src/cata_tiles.cpp b/src/cata_tiles.cpp
index fed4154888..0088cd2ee6 100644
--- a/src/cata_tiles.cpp
+++ b/src/cata_tiles.cpp
@@ -919,12 +919,12 @@ void tileset_loader::load_tilejson_from_file( const JsonObject &config )
         for( const std::string &t_id : ids ) {
             tile_type &curr_tile = load_tile( entry, t_id );
             curr_tile.offset = sprite_offset;
-            bool t_multi = entry.get_bool( "multitile", false );
+            bool t_multi = entry.has_array( "multitile" );
             bool t_rota = entry.get_bool( "rotates", t_multi );
             int t_h3d = entry.get_int( "height_3d", 0 );
             if( t_multi ) {
                 // fetch additional tiles
-                for( const JsonObject subentry : entry.get_array( "additional_tiles" ) ) {
+                for( const JsonObject subentry : entry.get_array( "multitile" ) ) {
                     const std::string s_id = subentry.get_string( "id" );
                     const std::string m_id = t_id + "_" + s_id;
                     tile_type &curr_subtile = load_tile( subentry, m_id );
@@ -933,8 +933,6 @@ void tileset_loader::load_tilejson_from_file( const JsonObject &config )
                     curr_subtile.height_3d = t_h3d;
                     curr_tile.available_subtiles.push_back( s_id );
                 }
-            } else if( entry.has_array( "additional_tiles" ) ) {
-                entry.throw_error( "Additional tiles defined, but 'multitile' is not true." );
             }
             // write the information of the base tile to curr_tile
             curr_tile.multitile = t_multi;

It would also require changing compose.py, TILESET.md and tile_config.jsons if done in a backward-incompatible way.

Describe alternatives you've considered

Additional context

https://discord.com/channels/598523535169945603/598535887801810944/790871379821068308

@esotericist esotericist added <Documentation> Design documents, internal info, guides and help. Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels Dec 23, 2020
@int-ua
Copy link
Contributor Author

int-ua commented Jan 17, 2021

There was a suggestion here that was moved to #46835

@actual-nh
Copy link
Contributor

Perhaps the "Documentation" label should be updated with a Tiles-related one?

@int-ua
Copy link
Contributor Author

int-ua commented Jan 17, 2021

#46835

@stale
Copy link

stale bot commented May 2, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not 'bump' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

@stale stale bot added the stale Closed for lack of activity, but still valid. label May 2, 2022
@Night-Pryanik
Copy link
Contributor

Closing as stale, since stalebot can't do this by itself.

@Night-Pryanik Night-Pryanik closed this as not planned Won't fix, can't repro, duplicate, stale Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style <Documentation> Design documents, internal info, guides and help. SDL: Tiles / Sound Tiles visual interface and sounds. stale Closed for lack of activity, but still valid.
Projects
None yet
Development

No branches or pull requests

4 participants