1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

vcmi: use MODAL by default

Convert only some objects to AUTO, need futher testing
than no non-adventure objects will not use AUTO or INFO
This commit is contained in:
Konstantin 2023-03-07 04:09:19 +03:00
parent a6cb7fd192
commit 8edba4fb06
6 changed files with 21 additions and 2 deletions

View File

@ -132,6 +132,7 @@ void CBank::doVisit(const CGHeroInstance * hero) const
{
int textID = -1;
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.player = hero->getOwner();
MetaString loot;

View File

@ -876,6 +876,7 @@ CStackBasicDescriptor CGHeroInstance::calculateNecromancy (const BattleResult &b
void CGHeroInstance::showNecromancyDialog(const CStackBasicDescriptor &raisedStack, CRandomGenerator & rand) const
{
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.soundID = soundBase::pickup01 + rand.nextInt(6);
iw.player = tempOwner;
iw.components.emplace_back(raisedStack);

View File

@ -29,6 +29,7 @@ VCMI_LIB_NAMESPACE_BEGIN
static void showInfoDialog(const PlayerColor & playerID, const ui32 txtID, const ui16 soundID)
{
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.soundID = soundID;
iw.player = playerID;
iw.text.addTxt(MetaString::ADVOB_TXT,txtID);
@ -60,6 +61,7 @@ void CGPandoraBox::giveContentsUpToExp(const CGHeroInstance *h) const
afterSuccessfulVisit();
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.player = h->getOwner();
bool changesPrimSkill = false;
@ -139,6 +141,7 @@ void CGPandoraBox::giveContentsAfterExp(const CGHeroInstance *h) const
std::string msg = message; //in case box is removed in the meantime
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.player = h->getOwner();
//TODO: reuse this code for Scholar skill

View File

@ -173,6 +173,7 @@ void CGDwelling::onHeroVisit( const CGHeroInstance * h ) const
if(ID == Obj::REFUGEE_CAMP && !creatures[0].first) //Refugee Camp, no available cres
{
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.player = h->tempOwner;
iw.text.addTxt(MetaString::ADVOB_TXT, 44); //{%s} \n\n The camp is deserted. Perhaps you should try next week.
iw.text.addReplacement(MetaString::OBJ_NAMES, ID);
@ -328,6 +329,7 @@ void CGDwelling::heroAcceptsCreatures( const CGHeroInstance *h) const
if(!slot.validSlot()) //no available slot
{
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.player = h->tempOwner;
iw.text.addTxt(MetaString::GENERAL_TXT, 425);//The %s would join your hero, but there aren't enough provisions to support them.
iw.text.addReplacement(MetaString::CRE_PL_NAMES, crid);
@ -342,6 +344,7 @@ void CGDwelling::heroAcceptsCreatures( const CGHeroInstance *h) const
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.player = h->tempOwner;
iw.text.addTxt(MetaString::GENERAL_TXT, 423); //%d %s join your army.
iw.text.addReplacement(count);
@ -355,6 +358,7 @@ void CGDwelling::heroAcceptsCreatures( const CGHeroInstance *h) const
else //there no creatures
{
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.text.addTxt(MetaString::GENERAL_TXT, 422); //There are no %s here to recruit.
iw.text.addReplacement(MetaString::CRE_PL_NAMES, crid);
iw.player = h->tempOwner;

View File

@ -46,6 +46,7 @@ static void openWindow(const OpenWindow::EWindow type, const int id1, const int
static void showInfoDialog(const PlayerColor & playerID, const ui32 txtID, const ui16 soundID = 0)
{
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
if(soundID)
iw.soundID = soundID;
iw.player = playerID;
@ -740,6 +741,7 @@ void CGMine::flagMine(const PlayerColor & player) const
cb->setOwner(this, player); //not ours? flag it!
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.soundID = soundBase::FLAGMINE;
iw.text.addTxt(MetaString::MINE_EVNTS,producedResource); //not use subID, abandoned mines uses default mine texts
iw.player = player;
@ -901,8 +903,6 @@ void CGResource::collectRes(const PlayerColor & player) const
sii.text.addReplacement(MetaString::RES_NAMES, subID);
}
sii.components.emplace_back(Component::RESOURCE,subID,amount,0);
sii.text.addTxt(MetaString::ADVOB_TXT,113);
sii.text.addReplacement(MetaString::RES_NAMES, subID);
sii.soundID = soundBase::pickup01 + CRandomGenerator::getDefault().nextInt(6);
cb->showInfoDialog(&sii);
cb->removeObject(this);
@ -1239,6 +1239,7 @@ void CGWhirlpool::onHeroVisit( const CGHeroInstance * h ) const
vstd::amax(countToTake, 1);
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.player = h->tempOwner;
iw.text.addTxt(MetaString::ADVOB_TXT, 168);
iw.components.emplace_back(CStackBasicDescriptor(h->getCreature(targetstack), countToTake));
@ -1321,6 +1322,7 @@ void CGArtifact::onHeroVisit(const CGHeroInstance * h) const
if(!stacksCount())
{
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.player = h->tempOwner;
switch(ID)
{
@ -1449,6 +1451,7 @@ void CGWitchHut::initObj(CRandomGenerator & rand)
void CGWitchHut::onHeroVisit( const CGHeroInstance * h ) const
{
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.player = h->getOwner();
if(!wasVisited(h->tempOwner))
cb->setObjProperty(id, CGWitchHut::OBJPROP_VISITED, h->tempOwner.getNum());
@ -1523,6 +1526,7 @@ void CGWitchHut::serializeJsonOptions(JsonSerializeFormat & handler)
void CGObservatory::onHeroVisit( const CGHeroInstance * h ) const
{
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.player = h->tempOwner;
switch (ID)
{
@ -1565,6 +1569,7 @@ void CGShrine::onHeroVisit( const CGHeroInstance * h ) const
cb->setObjProperty(id, CGShrine::OBJPROP_VISITED, h->tempOwner.getNum());
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.player = h->getOwner();
iw.text.addTxt(MetaString::ADVOB_TXT,127 + ID - 88);
iw.text.addTxt(MetaString::SPELL_NAME,spell);
@ -1682,6 +1687,7 @@ void CGScholar::onHeroVisit( const CGHeroInstance * h ) const
}
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.player = h->getOwner();
iw.text.addTxt(MetaString::ADVOB_TXT,115);
@ -1909,6 +1915,7 @@ void CGSirens::onHeroVisit( const CGHeroInstance * h ) const
iw.player = h->tempOwner;
if(h->hasBonusFrom(Bonus::OBJECT,ID)) //has already visited Sirens
{
iw.type = EInfoWindowMode::AUTO;
iw.text.addTxt(MetaString::ADVOB_TXT,133);
}
else
@ -1974,6 +1981,7 @@ void CGShipyard::onHeroVisit( const CGHeroInstance * h ) const
if(s != IBoatGenerator::GOOD)
{
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.player = tempOwner;
getProblemText(iw.text, h);
cb->showInfoDialog(&iw);
@ -2070,6 +2078,7 @@ void CGDenOfthieves::onHeroVisit (const CGHeroInstance * h) const
void CGObelisk::onHeroVisit( const CGHeroInstance * h ) const
{
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.player = h->tempOwner;
TeamState *ts = cb->gameState()->getPlayerTeam(h->tempOwner);
assert(ts);

View File

@ -6046,6 +6046,7 @@ bool CGameHandler::dig(const CGHeroInstance *h)
sendAndApply(&smp);
InfoWindow iw;
iw.type = EInfoWindowMode::AUTO;
iw.player = h->tempOwner;
if (gs->map->grailPos == h->visitablePos())
{