1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

* MSVC compilation fixes

* campaign epilogues and minor fixes
This commit is contained in:
mateuszb 2013-02-23 19:16:14 +00:00
parent f40863b82f
commit 602827d1ae
8 changed files with 36 additions and 11 deletions

View File

@ -4101,9 +4101,9 @@ CPrologEpilogVideo::CPrologEpilogVideo( CCampaignScenario::SScenarioPrologEpilog
auto lines = CMessage::breakText(spe.prologText, 500, EFonts::FONT_BIG);
txt = CSDL_Ext::newSurface(500, 20 * lines.size() + 5);
txt = CSDL_Ext::newSurface(500, 20 * lines.size() + 10);
curTxtH = screen->h;
graphics->fonts[FONT_BIG]->renderTextLinesCenter(txt, lines, Colors::METALLIC_GOLD, Point(txt->w/2, txt->h/2));
graphics->fonts[FONT_BIG]->renderTextLinesCenter(txt, lines, Colors::METALLIC_GOLD, Point(txt->w/2, txt->h/2 + 5));
//SDL_SaveBMP(txt, "txtsrfc.bmp");
}

View File

@ -524,10 +524,7 @@ void CClient::finishCampaign( shared_ptr<CCampaignState> camp )
void CClient::proposeNextMission(shared_ptr<CCampaignState> camp)
{
endGame(false);
LOCPLINT = nullptr; //TODO free res
GH.pushInt(new CBonusSelection(camp));
GH.curInt = CGPreGame::create();
}
void CClient::stopConnection()
@ -679,6 +676,30 @@ int CClient::sendRequest(const CPack *request, TPlayerColor player)
return requestID;
}
void CClient::campaignMapFinished( shared_ptr<CCampaignState> camp )
{
endGame(false);
LOCPLINT = nullptr; //TODO free res
GH.curInt = CGPreGame::create();
auto & epilogue = camp->camp->scenarios[camp->mapsConquered.back()].epilog;
auto finisher = [&]()
{
if(camp->mapsRemaining.size())
proposeNextMission(camp);
else
finishCampaign(camp);
};
if(epilogue.hasPrologEpilog)
{
GH.pushInt(new CPrologEpilogVideo(epilogue, finisher));
}
else
{
finisher();
}
}
template void CClient::serialize( CISer<CLoadFile> &h, const int version );
template void CClient::serialize( COSer<CSaveFile> &h, const int version );

View File

@ -148,6 +148,7 @@ public:
void save(const std::string & fname);
void loadGame(const std::string & fname);
void run();
void campaignMapFinished( shared_ptr<CCampaignState> camp );
void finishCampaign( shared_ptr<CCampaignState> camp );
void proposeNextMission(shared_ptr<CCampaignState> camp);
void invalidatePaths(const CGHeroInstance *h = NULL); //invalidates paths for hero h or for any hero if h is NULL => they'll got recalculated when the next query comes

View File

@ -311,10 +311,7 @@ void RemoveBonus::applyCl( CClient *cl )
void UpdateCampaignState::applyCl( CClient *cl )
{
cl->stopConnection();
if(camp->mapsRemaining.size())
cl->proposeNextMission(camp);
else
cl->finishCampaign(camp);
cl->campaignMapFinished(camp);
}
void PrepareForAdvancingCampaign::applyCl(CClient *cl)

View File

@ -464,7 +464,8 @@ CCampaignState::CCampaignState( unique_ptr<CCampaign> _camp ) : camp(std::move(_
{
for(int i = 0; i < camp->scenarios.size(); i++)
{
mapsRemaining.push_back(i);
if(vstd::contains(camp->mapPieces, i)) //not all maps must be present in a campaign
mapsRemaining.push_back(i);
}
}

View File

@ -1,4 +1,5 @@
#include "StdInc.h"
#define DO_NOT_DISABLE_REGISTER_TYPES_INSTANTIATION
#include "RegisterTypes.h"
#include "Mapping/CMapInfo.h"

View File

@ -264,9 +264,12 @@ void registerTypes(Serializer &s)
registerTypes4(s);
}
#ifndef DO_NOT_DISABLE_REGISTER_TYPES_INSTANTIATION
extern template DLL_LINKAGE void registerTypes<CISer<CConnection>>(CISer<CConnection>& s);
extern template DLL_LINKAGE void registerTypes<COSer<CConnection>>(COSer<CConnection>& s);
extern template DLL_LINKAGE void registerTypes<CSaveFile>(CSaveFile & s);
extern template DLL_LINKAGE void registerTypes<CLoadFile>(CLoadFile & s);
extern template DLL_LINKAGE void registerTypes<CTypeList>(CTypeList & s);
extern template DLL_LINKAGE void registerTypes<CLoadIntegrityValidator>(CLoadIntegrityValidator & s);
extern template DLL_LINKAGE void registerTypes<CLoadIntegrityValidator>(CLoadIntegrityValidator & s);
#endif

View File

@ -200,6 +200,7 @@
<ClCompile Include="Mapping\CMapService.cpp" />
<ClCompile Include="Mapping\CMapEditManager.cpp" />
<ClCompile Include="Mapping\MapFormatH3M.cpp" />
<ClCompile Include="RegisterTypes.cpp" />
<ClCompile Include="RMG\CMapGenOptions.cpp" />
<ClCompile Include="RMG\CMapGenerator.cpp" />
<ClCompile Include="HeroBonus.cpp" />