Home » MODDING HQ 1.13 » v1.13 Bug Reports » Problems with MercAvailability.xml and old savegames
Problems with MercAvailability.xml and old savegames[message #323850] Sat, 10 August 2013 14:11 Go to previous message
silversurfer

 
Messages:2791
Registered:May 2009
I didn't want to continue this discussion in the BUGZILLA thread so I decided to start a new thread.

When we load a savegame we also load merc availability data for the M.E.R.C website. This caused problems in the past when MercAvailability.xml had been altered in the meantime.

My fix that was introduced in 6278 did only solve part of the problem. It provides valid data which is good but the content is fixed to the data we can read from the savegame. Only those mercs that were already in the savegame would show on the website.
I didn't like that so I thought a little more about the problem and a quite simple solution came to mind.

I will use the availability array from MercAvailability.xml and only update it with relevant data from the savegame. For that I loop through all the 255 indexes of the XML array and check if I can find the ProfileID in the Load array. If I find a match it means the merc exists in the savegame and we have something to copy.
This is done in Laptop\mercs.cpp function LoadNewMercsFromLoadGameFile( ... ).

These are the tags that could be copied from the savegame to the working array:
  • uiIndex - copying that would break our XML array so we better don't
  • ProfilId - if we found a match this is already the same
  • usMoneyPaid - if we want to be able to make updates to this via XML we shouldn't copy
  • usDay - if we want to be able to make updates to this via XML we shouldn't copy
  • MercBio - if we want to be able to make updates to this via XML we shouldn't copy
  • Drunk - if we want to be able to make updates to this via XML we shouldn't copy
  • uiAlternateIndex - if we want to be able to make updates to this via XML we shouldn't copy
  • NewMercsAvailable - we definitely want to copy this as it defines current availability!
  • StartMercsAvailable - we definitely want to copy this as it defines current availability!
In the end it turned out that I only want to copy 2 tags - NewMercsAvailable and StartMercsAvailable - and take the rest from the XML. This way we have the maximum flexibility for updates via XML.
Any objections to that? Anything that I have overlooked?

This functionality should solve all of these conditions with MercAvailability.xml:
  • savegame is current - both arrays are the same so nothing to update anyway
  • different sort order - someone was probably moving mercs around in the XML. New sort order will be used and saved to the next savegame.
  • a tag is set wrong in the XML - oops, fix the XML first which fixes the array on the next load (except for NewMercsAvailable and StartMercsAvailable)
  • new mercs have been added to the XML - no data to load from the savegame but we keep the data from the XML
  • mercs have been removed from the XML - I don't think that this should happen but if it does we simply ignore the additional data in the savegame. This data will be lost.
Flugente will be my preferred tester because he can read the code and has an old savegame available and write access to SVN. Very Happy

I will make some tests today and wait for additional comments to my thoughts. Please tell me if I made some fundamental mistake with the selection of the tags or anything else. I'll upload the patch to Mediafire later.

One more thing. During the addition of the natives one thing was overlooked. For the drunken Larry 33 the has to be updated.

old: 29
new: 32


edit: I tested a bit with Bugglers broken savegame and made changes to MercAvailability.xml.
  • different sort order? - check
  • Larries alternate index fixed? - check
  • insert new mercs? - check
  • remove mercs? - check
Looks good to me. Smile

[Updated on: Sat, 10 August 2013 14:51] by Moderator

Report message to a moderator

Lieutenant
 
Read Message
Read Message
Read Message
Previous Topic: Disappearing Sector Inventories
Next Topic: Dropped Off Mercs Location Unmoveable
Goto Forum:
  


Current Time: Sat Nov 30 04:31:17 GMT+2 2024

Total time taken to generate the page: 0.01349 seconds