Skip to content

Commit

Permalink
Fixed a couple of saved game issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrettin committed Dec 15, 2015
1 parent bc2de48 commit a82b8ff
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/game/loadgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ void LoadGame(const std::string &filename)
{
//Wyrmgus start
CleanPlayers(); //clean players, as they may not have been cleansed after a scenario
CurrentCustomHero = NULL; //otherwise the loaded game will have an extra hero for the current custom hero
//Wyrmgus end

// log will be enabled if found in the save game
Expand Down
12 changes: 8 additions & 4 deletions src/unit/unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -921,12 +921,16 @@ void CUnit::EquipItem(CUnit &item, bool affect_character)
Variable[HP_INDEX].Max += item.Variable[i].Max;
Variable[HP_INDEX].Increase += item.Variable[i].Increase;
} else if (i == SIGHTRANGE_INDEX) {
MapUnmarkUnitSight(*this);
if (!SaveGameLoading) {
MapUnmarkUnitSight(*this);
}
Variable[i].Value += item.Variable[i].Value;
Variable[i].Max += item.Variable[i].Max;
CurrentSightRange = Variable[i].Value;
UpdateUnitSightRange(*this);
MapMarkUnitSight(*this);
if (!SaveGameLoading) {
CurrentSightRange = Variable[i].Value;
UpdateUnitSightRange(*this);
MapMarkUnitSight(*this);
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/unit/unit_save.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@ void SaveUnit(const CUnit &unit, CFile &file)
file.printf(",\n \"variation\", %d", unit.Variation);
if (unit.Character != NULL) {
if (!unit.Character->Custom) {
file.printf(",\n \"character\", %s", unit.Character->GetFullName().c_str());
file.printf(",\n \"character\", \"%s\"", unit.Character->GetFullName().c_str());
} else {
file.printf(",\n \"custom-hero\", %s", unit.Character->GetFullName().c_str());
file.printf(",\n \"custom-hero\", \"%s\"", unit.Character->GetFullName().c_str());
}
}
//Wyrmgus end
Expand Down

0 comments on commit a82b8ff

Please sign in to comment.