Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove save format support older than 0.9.12 #5718

Merged
merged 1 commit into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions src/fheroes2/campaign/campaign_savedata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,23 +132,6 @@ namespace Campaign
>> data._daysPassed >> data._obtainedCampaignAwards >> data._carryOverTroops;
}

void CampaignSaveData::loadOldSaveSata( StreamBase & msg, CampaignSaveData & data )
{
static_assert( LAST_SUPPORTED_FORMAT_VERSION < FORMAT_VERSION_0912_RELEASE, "Remove this method." );

msg >> data._currentScenarioInfoId.scenarioId >> data._currentScenarioBonus;

std::vector<int> finishedMaps;
msg >> finishedMaps;

msg >> data._currentScenarioInfoId.campaignId >> data._daysPassed >> data._obtainedCampaignAwards >> data._carryOverTroops;

data._finishedMaps.clear();
for ( const int mapId : finishedMaps ) {
data._finishedMaps.emplace_back( data._currentScenarioInfoId.campaignId, mapId );
}
}

ScenarioVictoryCondition getCurrentScenarioVictoryCondition()
{
const CampaignSaveData & campaignData = CampaignSaveData::Get();
Expand Down
2 changes: 0 additions & 2 deletions src/fheroes2/campaign/campaign_savedata.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ namespace Campaign

static CampaignSaveData & Get();

static void loadOldSaveSata( StreamBase & msg, CampaignSaveData & data );

private:
friend StreamBase & operator<<( StreamBase & msg, const CampaignSaveData & data );
friend StreamBase & operator>>( StreamBase & msg, CampaignSaveData & data );
Expand Down
8 changes: 1 addition & 7 deletions src/fheroes2/game/game_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,7 @@ fheroes2::GameMode Game::Load( const std::string & fn )

if ( conf.isCampaignGameType() ) {
Campaign::CampaignSaveData & saveData = Campaign::CampaignSaveData::Get();
static_assert( LAST_SUPPORTED_FORMAT_VERSION < FORMAT_VERSION_0912_RELEASE, "Remove the usage of loadOldSaveSata method." );
if ( binver < FORMAT_VERSION_0912_RELEASE ) {
Campaign::CampaignSaveData::loadOldSaveSata( fz, saveData );
}
else {
fz >> saveData;
}
fz >> saveData;

if ( !saveData.isStarting() && saveData.getCurrentScenarioInfoId() == saveData.getLastCompletedScenarioInfoID() ) {
// This is the end of the current scenario. We should show next scenario selection.
Expand Down
19 changes: 0 additions & 19 deletions src/fheroes2/kingdom/week.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,22 +293,3 @@ Week Week::RandomWeek( const World & worldInstance, const bool isNewMonth, const

return { weekName, Monster::UNKNOWN };
}

StreamBase & operator>>( StreamBase & stream, Week & week )
{
static_assert( LAST_SUPPORTED_FORMAT_VERSION < FORMAT_VERSION_PRE3_0912_RELEASE, "Remove this operator." );

int32_t weekType;
int32_t monster;
StreamBase & sb = stream >> weekType >> monster;
week._week = static_cast<WeekName>( weekType );
week._monster = static_cast<Monster::monster_t>( monster );
return sb;
}

StreamBase & operator<<( StreamBase & stream, const Week & week )
{
static_assert( LAST_SUPPORTED_FORMAT_VERSION < FORMAT_VERSION_PRE3_0912_RELEASE, "Remove this operator." );

return stream << static_cast<int32_t>( week.GetType() ) << static_cast<int32_t>( week.GetMonster() );
}
5 changes: 0 additions & 5 deletions src/fheroes2/kingdom/week.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,9 @@ struct Week

static Week RandomWeek( const World & world, const bool isNewMonth, const uint32_t weekSeed );

friend StreamBase & operator>>( StreamBase & stream, Week & week );

private:
WeekName _week;
Monster::monster_t _monster;
};

StreamBase & operator>>( StreamBase & stream, Week & week );
StreamBase & operator<<( StreamBase & stream, const Week & week );

#endif
8 changes: 4 additions & 4 deletions src/fheroes2/system/save_format_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@

enum SaveFileFormat : uint16_t
{
// TODO: if you're adding a new version you must assign it to CURRENT_FORMAT_VERSION located at the bottom.
// !!! IMPORTANT !!!
// If you're adding a new version you must assign it to CURRENT_FORMAT_VERSION located at the bottom.
// If you're removing an old version you must assign the oldest available to LAST_SUPPORTED_FORMAT_VERSION located at the bottom.
FORMAT_VERSION_0918_RELEASE = 9921,
FORMAT_VERSION_PRE_0918_RELEASE = 9920,
FORMAT_VERSION_0917_RELEASE = 9911,
FORMAT_VERSION_PRE_0917_RELEASE = 9910,
FORMAT_VERSION_0916_RELEASE = 9901,
FORMAT_VERSION_PRE_0916_RELEASE = 9900,
FORMAT_VERSION_0912_RELEASE = 9803,
FORMAT_VERSION_PRE3_0912_RELEASE = 9802,
FORMAT_VERSION_PRE2_0912_RELEASE = 9801,

LAST_SUPPORTED_FORMAT_VERSION = FORMAT_VERSION_PRE2_0912_RELEASE,
LAST_SUPPORTED_FORMAT_VERSION = FORMAT_VERSION_0912_RELEASE,

CURRENT_FORMAT_VERSION = FORMAT_VERSION_0918_RELEASE
};
11 changes: 1 addition & 10 deletions src/fheroes2/world/world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1494,16 +1494,7 @@ StreamBase & operator>>( StreamBase & msg, World & w )
w.height = height;

msg >> w.vec_tiles >> w.vec_heroes >> w.vec_castles >> w.vec_kingdoms >> w._rumors >> w.vec_eventsday >> w.map_captureobj >> w.ultimate_artifact >> w.day >> w.week
>> w.month;

static_assert( LAST_SUPPORTED_FORMAT_VERSION < FORMAT_VERSION_PRE3_0912_RELEASE, "Remove the check below." );
if ( Game::GetLoadVersion() < FORMAT_VERSION_PRE3_0912_RELEASE ) {
Week dummyWeek;

msg >> dummyWeek >> dummyWeek;
}

msg >> w.heroes_cond_wins >> w.heroes_cond_loss >> w.map_actions >> w.map_objects >> w._seed;
>> w.month >> w.heroes_cond_wins >> w.heroes_cond_loss >> w.map_actions >> w.map_objects >> w._seed;

w.PostLoad( false );

Expand Down