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

Fix loading submap radiation. #36903

Merged
merged 1 commit into from
Jan 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/savegame_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3806,10 +3806,10 @@ void submap::load( JsonIn &jsin, const std::string &member_name, int version )
int rad_strength = jsin.get_int();
int rad_num = jsin.get_int();
for( int i = 0; i < rad_num; ++i ) {
// A little array trick here, assign to it as a 1D array.
// If it's not in bounds we're kinda hosed anyway.
set_radiation( { 0, rad_cell }, rad_strength );
rad_cell++;
if( rad_cell < SEEX * SEEY ) {
set_radiation( { 0 % SEEX, rad_cell / SEEX }, rad_strength );
rad_cell++;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the old code that used an "array trick" was also transposing the radiation map every time the game is saved and loaded. This fixes that too.

}
}
} else if( member_name == "furniture" ) {
Expand Down