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

Keep original values when saving based on Map version #1146

Closed
wants to merge 1 commit into from
Closed

Keep original values when saving based on Map version #1146

wants to merge 1 commit into from

Conversation

tomek-i
Copy link

@tomek-i tomek-i commented Sep 19, 2019

Changed the saving routine to take into account what the current map version is
this allows to modify maps from terraria mobile (iOS), save them and load them up in the game again
without any issues.

the changes have been tested on terraria IOS mobile 1.3.0.7 (latest)
@BinaryConstruct
Copy link
Collaborator

Thanks for the PR. These changes are pretty extensive so I will need to test a several scenarios. Alternatively, the previous release can be used for now.

@@ -310,7 +319,7 @@ public static int SaveNPCs(IEnumerable<NPC> npcs, BinaryWriter bw)
foreach (NPC npc in npcs)
{
bw.Write(true);
bw.Write(npc.SpriteId);
bw.Write(npc.Name);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why was this change made? Is this an IOS save file format?

TEditXna/Terraria/World.FileV2.cs Show resolved Hide resolved
@@ -21,8 +21,10 @@ private static void SaveV2(World world, BinaryWriter bw)
{
world.Validate();

// initialize tileframeimportance array if empty
if (TileFrameImportant == null || TileFrameImportant.Length < TileCount)
if (TileFrameImportant.Length < TileCount && TileFrameImportant.Length > 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If framed tiles change between versions there could be issues here. I don't know if this is something that can be fixed here without keeping track of framed tiles for every version.

@BinaryConstruct
Copy link
Collaborator

If you can rebase and update this with the latest changes I will test and merge it. Could you also attach a world file to test with? Thanks.

@tomek-i
Copy link
Author

tomek-i commented May 24, 2020 via email

@BinaryConstruct
Copy link
Collaborator

Yes, please.

@tomek-i
Copy link
Author

tomek-i commented May 28, 2020

Just downloaded terraria again on iOS

Terraria IOS is still on v1.3.0.7.9 build 390

Test world is a new blank created world.

The other two worlds are more advanced with few buildings and chests and npcs etc.

By the way, where do I upload it here? Just in a new issue?

I did delete the local repo after few weeks of no activity in that project so I haven’t had the time to check it out again and migrate any of your other changes done for 1.4 ... I hope I can have a look / play on the weekend and then I can do the rebase

@tomek-i
Copy link
Author

tomek-i commented May 28, 2020

@BinaryConstruct
Copy link
Collaborator

This has been merged. Thanks for the idea!

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.

None yet

2 participants