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

No duplicate linear predecessors #67773

Merged

Conversation

Procyonae
Copy link
Contributor

@Procyonae Procyonae commented Aug 19, 2023

Summary

None

Purpose of change

Replaces the hacky function I added in #67223 with a better and consistent solution
Needed for #67470

Describe the solution

Prevents the duplicates ever getting added rather than dealing with them when they enter reality bubble
I tried making predecessors_ a cata::flat_set too but couldn't figure out the savegame stuff, I were trying to do something vaguely like:

} else if( name == "predecessors" ) {
           auto flattened_predecessors;
            om_member.read( flattened_predecessors, true );

            void read_pred [&] ( std::vector<std::pair<tripoint_om_omt, std::vector<oter_id>>> flattened_predecessors ) {
                for( std::pair<tripoint_om_omt, std::vector<oter_id>> &p : flattened_predecessors_old ) {
                    predecessors_.insert( std::move( p ) );
                }
            };

            void read_pred [&] ( std::vector<std::pair<tripoint_om_omt, cata::flat_set<oter_id>>> flattened_predecessors ) {
                for( std::pair<tripoint_om_omt, std::vector<oter_id>> &p : flattened_predecessors ) {
                    predecessors_.insert( p );
                }
            };

           read_pred( flattened_predecessors );
        }

(L657 of src/savegame.cpp)

but it doesn't like the uninitialised auto flattened_predecessors and I couldn't think of a good way around it

Describe alternatives you've considered

Testing

Tested on my trail PR and it looks good just wanted to make this a separate PR

Actually nvm this seems to break the crossroad manholes somehow False alarm the manhole id sometimes being overwritten appears intended (or at least is happening in vanilla)

Additional context

@github-actions github-actions bot added Map / Mapgen Overmap, Mapgen, Map extras, Map display [C++] Changes (can be) made in C++. Previously named `Code` labels Aug 19, 2023
@Procyonae Procyonae marked this pull request as draft August 19, 2023 17:32
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Aug 19, 2023
@Procyonae Procyonae marked this pull request as ready for review August 19, 2023 17:38
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Aug 19, 2023
@Maleclypse Maleclypse merged commit aa6cccf into CleverRaven:master Aug 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions Map / Mapgen Overmap, Mapgen, Map extras, Map display
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants