polymod
polymod copied to clipboard
CSV merge logic appears to work against column slices, not by column key
Based on my experience using merge CSV files against Dicey Dungeon, the logic appears to require every single column between the first and last columns that you're changing. For example, with a CSV like this:
Name,A,B,C,D,E,F
CoolThing1,1,2,3,4,5,6
CoolThing2,1,2,3,4,5,6
CoolThing3,1,2,3,4,5,6
If you include a merge file like this:
Name,B,D
CoolThing2,7,9
It actually won't work. The intent is obvious here: You just want to change properties B and D for CoolThing2, without messing with any of the other properties. However, what you have to do is this:
Name,B,C,D
CoolThing2,7,3,9
This is including more properties than you actually want to change, possibly causing issues when property C is changed by the original game later on. Why doesn't it just look up the column name, like it does for the row name on index 0?
Here's the problem code block.
This could be changed to something like:
// Start at 1 to skip matched index field
for (j in 1...row.length)
{
for (k in 1...otherRow.length) {
if (baseCSV.fields[k] == mergeCSV.fields[j])
{
otherRow[k] = row[j];
}
}
}
This would be backwards-compatible with the existing usage as well.
Thanks for this! I've got my hands full at the moment but I will make a note to test this when I can, it seems like a good change.