Skip to content

Commit

Permalink
fix: character change does not persist after save.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ridwanah committed Nov 21, 2024
1 parent 8b28179 commit 22b726f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion game/static/game/js/level_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2556,6 +2556,17 @@ ocargo.LevelEditor = function(levelId) {
function restoreState(state) {
console.log("restoring state");

// Get character id from saved character name
var characterName = state.character_name;
if (characterName) {
var characterId = null;
for (var id in CHARACTERS) {
if (characterName == CHARACTERS[id].name) {
characterId = id;
break;
}
}
}
clear();

// Load node data
Expand Down Expand Up @@ -2585,7 +2596,7 @@ ocargo.LevelEditor = function(levelId) {
}

// Load in character
$('#character_select').val(state.character);
$('#character_select').val(characterId);
$('#character_select').change();

drawAll();
Expand Down

0 comments on commit 22b726f

Please sign in to comment.