Protofall / Crayon-Savefile

A savefile system designed to take up little space and support version control. Works on PC and Dreamcast
BSD 3-Clause "New" or "Revised" License
3 stars 0 forks source link

Savefile: Remove replaces var #12

Closed Protofall closed 4 years ago

Protofall commented 4 years ago

When a variable is removed and we have the option to do something with the value, add a new option for that value to completely override an existing variables. Eg.

var = crayon_savefile_add_variable(details, NULL, CRAY_TYPE_U8, 1, &zero, sf_version); //Previously the prefered mines
var2 = crayon_savefile_add_variable(details, pref_mines, CRAY_TYPE_U16, 1, &zero, sf_version);
crayon_savefile_remove_variable(details, var, CRAY_TYPE_U8, CRAY_SF_REMOVE_CMD_REPLACE, var2, version);

So here we are just upgrading a variable from uint8_t to uint16_t (Like I wanted to with Minesweeper's pref mine count)

Protofall commented 4 years ago

Just a note, eventually the remove function was in itself removed in favour of letting the user make a function to handle removed variables