mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-28 23:06:24 +02:00
parent
01776b6a04
commit
9e8d0651f6
@ -1773,7 +1773,7 @@ void CAdvMapInt::tileLClicked(const int3 &mp)
|
||||
}
|
||||
//check if we can select this object
|
||||
bool canSelect = topBlocking && topBlocking->ID == HEROI_TYPE && topBlocking->tempOwner == LOCPLINT->playerID;
|
||||
canSelect |= topBlocking && topBlocking->ID == TOWNI_TYPE && LOCPLINT->cb->getPlayerRelations(topBlocking->tempOwner, LOCPLINT->playerID);
|
||||
canSelect |= topBlocking && topBlocking->ID == TOWNI_TYPE && LOCPLINT->cb->getPlayerRelations(LOCPLINT->playerID, topBlocking->tempOwner);
|
||||
|
||||
if (selection->ID != HEROI_TYPE) //hero is not selected (presumably town)
|
||||
{
|
||||
@ -1881,7 +1881,7 @@ void CAdvMapInt::tileHovered(const int3 &tile)
|
||||
{
|
||||
if(objAtTile)
|
||||
{
|
||||
if(objAtTile->ID == TOWNI_TYPE && LOCPLINT->cb->getPlayerRelations(objAtTile->tempOwner, LOCPLINT->playerID))
|
||||
if(objAtTile->ID == TOWNI_TYPE && LOCPLINT->cb->getPlayerRelations(LOCPLINT->playerID, objAtTile->tempOwner))
|
||||
CGI->curh->changeGraphic(0, 3);
|
||||
else if(objAtTile->ID == HEROI_TYPE && objAtTile->tempOwner == LOCPLINT->playerID)
|
||||
CGI->curh->changeGraphic(0, 2);
|
||||
@ -1895,7 +1895,7 @@ void CAdvMapInt::tileHovered(const int3 &tile)
|
||||
{
|
||||
if(objAtTile->ID == HEROI_TYPE)
|
||||
{
|
||||
if(!LOCPLINT->cb->getPlayerRelations( objAtTile->tempOwner, LOCPLINT->playerID)) //enemy hero
|
||||
if(!LOCPLINT->cb->getPlayerRelations( LOCPLINT->playerID, objAtTile->tempOwner)) //enemy hero
|
||||
{
|
||||
if(accessible)
|
||||
CGI->curh->changeGraphic(0, 5 + turns*6);
|
||||
@ -1914,7 +1914,7 @@ void CAdvMapInt::tileHovered(const int3 &tile)
|
||||
}
|
||||
else if(objAtTile->ID == TOWNI_TYPE)
|
||||
{
|
||||
if(!LOCPLINT->cb->getPlayerRelations( objAtTile->tempOwner, LOCPLINT->playerID)) //enemy town
|
||||
if(!LOCPLINT->cb->getPlayerRelations( LOCPLINT->playerID, objAtTile->tempOwner)) //enemy town
|
||||
{
|
||||
if(accessible)
|
||||
{
|
||||
@ -1955,7 +1955,7 @@ void CAdvMapInt::tileHovered(const int3 &tile)
|
||||
|
||||
// Show battle cursor for guarded enemy garrisons, otherwise movement cursor.
|
||||
if (garrObj&& garrObj->stacksCount()
|
||||
&& !LOCPLINT->cb->getPlayerRelations( garrObj->tempOwner, LOCPLINT->playerID) )
|
||||
&& !LOCPLINT->cb->getPlayerRelations( LOCPLINT->playerID, garrObj->tempOwner) )
|
||||
CGI->curh->changeGraphic(0, 5 + turns*6);
|
||||
else
|
||||
CGI->curh->changeGraphic(0, 9 + turns*6);
|
||||
|
@ -3748,7 +3748,7 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult &br, const SDL_Rect
|
||||
}
|
||||
if(owner->defendingHeroInstance) //a hero defended
|
||||
{
|
||||
SDL_BlitSurface(graphics->portraitLarge[owner->defendingHeroInstance->portrait], NULL, background, &genRect(64, 58, 391, 38));
|
||||
SDL_BlitSurface(graphics->portraitLarge[owner->defendingHeroInstance->portrait], NULL, background, &genRect(64, 58, 392, 38));
|
||||
//setting defenderName
|
||||
defenderName = owner->defendingHeroInstance->name;
|
||||
}
|
||||
@ -3764,7 +3764,7 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult &br, const SDL_Rect
|
||||
bestMonsterID = it->second.type->idNumber;
|
||||
}
|
||||
}
|
||||
SDL_BlitSurface(graphics->bigImgs[bestMonsterID], NULL, background, &genRect(64, 58, 391, 38));
|
||||
SDL_BlitSurface(graphics->bigImgs[bestMonsterID], NULL, background, &genRect(64, 58, 392, 38));
|
||||
//setting defenderName
|
||||
defenderName = CGI->creh->creatures[bestMonsterID]->namePl;
|
||||
}
|
||||
@ -3795,62 +3795,59 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult &br, const SDL_Rect
|
||||
}
|
||||
//printing result description
|
||||
bool weAreAttacker = (owner->curInt->playerID == owner->attackingHeroInstance->tempOwner);
|
||||
switch(br.result)
|
||||
if((br.winner == 0 && weAreAttacker) || (br.winner == 1 && !weAreAttacker)) //we've won
|
||||
{
|
||||
case 0: //normal victory
|
||||
if((br.winner == 0 && weAreAttacker) || (br.winner == 1 && !weAreAttacker)) //we've won
|
||||
int text;
|
||||
switch(br.result)
|
||||
{
|
||||
CGI->musich->playMusic(musicBase::winBattle);
|
||||
#ifdef _WIN32
|
||||
CGI->videoh->open(VIDEO_WIN);
|
||||
#else
|
||||
CGI->videoh->open(VIDEO_WIN, true);
|
||||
#endif
|
||||
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[304], 235, 235, FONT_SMALL, zwykly, background);
|
||||
case 0: text = 304; break;
|
||||
case 1: text = 303; break;
|
||||
case 2: text = 302; break;
|
||||
}
|
||||
else
|
||||
|
||||
CGI->musich->playMusic(musicBase::winBattle);
|
||||
#ifdef _WIN32
|
||||
CGI->videoh->open(VIDEO_WIN);
|
||||
#else
|
||||
CGI->videoh->open(VIDEO_WIN, true);
|
||||
#endif
|
||||
std::string str = CGI->generaltexth->allTexts[text];
|
||||
|
||||
const CGHeroInstance * ourHero = weAreAttacker? owner->attackingHeroInstance : owner->defendingHeroInstance;
|
||||
if (ourHero)
|
||||
{
|
||||
str += CGI->generaltexth->allTexts[305];
|
||||
boost::algorithm::replace_first(str,"%s",ourHero->name);
|
||||
boost::algorithm::replace_first(str,"%d",boost::lexical_cast<std::string>(br.exp[weAreAttacker?0:1]));
|
||||
}
|
||||
CSDL_Ext::printAtMiddleWB(str, 235, 235, FONT_SMALL, 55, zwykly, background);
|
||||
}
|
||||
else // we lose
|
||||
{
|
||||
switch(br.result)
|
||||
{
|
||||
case 0: //normal victory
|
||||
{
|
||||
CGI->musich->playMusic(musicBase::loseCombat);
|
||||
CGI->videoh->open(VIDEO_LOSE_BATTLE_START);
|
||||
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[311], 235, 235, FONT_SMALL, zwykly, background);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1: //flee
|
||||
if((br.winner == 0 && weAreAttacker) || (br.winner == 1 && !weAreAttacker)) //we've won
|
||||
{
|
||||
CGI->musich->playMusic(musicBase::winBattle);
|
||||
#ifdef _WIN32
|
||||
CGI->videoh->open(VIDEO_WIN);
|
||||
#else
|
||||
CGI->videoh->open(VIDEO_WIN, true);
|
||||
#endif
|
||||
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[303], 235, 235, FONT_SMALL, zwykly, background);
|
||||
}
|
||||
else
|
||||
case 1: //flee
|
||||
{
|
||||
CGI->musich->playMusic(musicBase::retreatBattle);
|
||||
CGI->videoh->open(VIDEO_RETREAT_START);
|
||||
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[310], 235, 235, FONT_SMALL, zwykly, background);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2: //surrender
|
||||
if((br.winner == 0 && weAreAttacker) || (br.winner == 1 && !weAreAttacker)) //we've won
|
||||
{
|
||||
CGI->musich->playMusic(musicBase::winBattle);
|
||||
#ifdef _WIN32
|
||||
CGI->videoh->open(VIDEO_WIN);
|
||||
#else
|
||||
CGI->videoh->open(VIDEO_WIN, true);
|
||||
#endif
|
||||
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[302], 235, 235, FONT_SMALL, zwykly, background);
|
||||
}
|
||||
else
|
||||
case 2: //surrender
|
||||
{
|
||||
CGI->musich->playMusic(musicBase::surrenderBattle);
|
||||
CGI->videoh->open(VIDEO_SURRENDER);
|
||||
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[309], 235, 235, FONT_SMALL, zwykly, background);
|
||||
CSDL_Ext::printAtMiddle(CGI->generaltexth->allTexts[309], 235, 220, FONT_SMALL, zwykly, background);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ CKingdomInterface::CKingdomInterface()
|
||||
objList[addObjects[curElm]].first += 1;
|
||||
objList[addObjects[curElm]].second = & obj->hoverName;
|
||||
}
|
||||
else if ( obj->ID == 53 )//TODO: abandoned mines
|
||||
else if ( obj->ID == 53 )
|
||||
incomesVal[obj->subID]+=1;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "CSoundBase.h"
|
||||
#include "../lib/HeroBonus.h"
|
||||
#include "../lib/CGameState.h"
|
||||
#include "../lib/CCreatureSet.h"
|
||||
|
||||
/*
|
||||
* CCreatureHandler.h, part of VCMI engine
|
||||
|
@ -135,7 +135,6 @@ void CObjectHandler::readConfigLine(std::ifstream &istr, int g)
|
||||
|
||||
BankConfig &bc = *banksInfo[g].back();
|
||||
std::string buf;
|
||||
char dump;
|
||||
//bc.level is of type char and thus we cannot read directly to it; same for some othre variables
|
||||
istr >> buf;
|
||||
bc.level = atoi(buf.c_str());
|
||||
@ -2954,10 +2953,12 @@ void CGCreature::initObj()
|
||||
si32 &amount = slots[0].count;
|
||||
CCreature &c = *VLC->creh->creatures[subID];
|
||||
if(!amount)
|
||||
{
|
||||
if(c.ammMax == c.ammMin)
|
||||
amount = c.ammMax;
|
||||
else
|
||||
amount = c.ammMin + (ran() % (c.ammMax - c.ammMin));
|
||||
}
|
||||
|
||||
temppower = slots[0].count * 1000;
|
||||
}
|
||||
@ -4511,7 +4512,7 @@ const std::string & CGWitchHut::getHoverText() const
|
||||
void CGBonusingObject::onHeroVisit( const CGHeroInstance * h ) const
|
||||
{
|
||||
bool visited = h->hasBonusFrom(Bonus::OBJECT,ID);
|
||||
int messageID, bonusType, bonusVal;
|
||||
int messageID;
|
||||
int bonusMove = 0, sound = -1;
|
||||
InfoWindow iw;
|
||||
iw.player = h->tempOwner;
|
||||
@ -4872,8 +4873,8 @@ void CGPandoraBox::giveContents( const CGHeroInstance *h, bool afterBattle ) con
|
||||
{
|
||||
int curLev = h->getSecSkillLevel(abilities[i]);
|
||||
|
||||
if(curLev && curLev < abilityLevels[i]
|
||||
|| h->secSkills.size() < SKILL_PER_HERO )
|
||||
if( (curLev && curLev < abilityLevels[i])
|
||||
|| (h->secSkills.size() < SKILL_PER_HERO) )
|
||||
{
|
||||
cb->changeSecSkill(h->id,abilities[i],abilityLevels[i],true);
|
||||
}
|
||||
@ -5556,7 +5557,6 @@ void CBank::reset(ui16 var1) //prevents desync
|
||||
void CBank::initialize() const
|
||||
{
|
||||
cb->setObjProperty (id, 14, ran()); //synchronous reset
|
||||
ui32 artid;
|
||||
for (ui8 i = 0; i <= 3; i++)
|
||||
{
|
||||
for (ui8 n = 0; n < bc->artifacts[i]; n++) //new function using proper randomization algorithm
|
||||
@ -6119,7 +6119,6 @@ const std::string & CGSirens::getHoverText() const
|
||||
|
||||
void CGSirens::onHeroVisit( const CGHeroInstance * h ) const
|
||||
{
|
||||
int message;
|
||||
InfoWindow iw;
|
||||
iw.soundID = soundBase::DANGER;
|
||||
iw.player = h->tempOwner;
|
||||
@ -6724,6 +6723,7 @@ std::vector<int> IMarket::availableItemsIds(EMarketMode mode) const
|
||||
case CREATURE_RESOURCE:
|
||||
for (int i = 0; i < 7; i++)
|
||||
ret.push_back(i);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
@ -6803,8 +6803,9 @@ bool CGMarket::allowsTrade(EMarketMode mode) const
|
||||
return ID == 2; //TODO? check here for alignment of visiting hero? - would not be coherent with other checks here
|
||||
case RESOURCE_SKILL:
|
||||
return ID == 104;//University
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int CGMarket::availableUnits(EMarketMode mode, int marketItemSerial) const
|
||||
|
@ -205,7 +205,6 @@ void CTownHandler::loadStructures()
|
||||
of.clear();
|
||||
|
||||
//read groups
|
||||
int itr = 0;
|
||||
of.open(DATA_DIR "/config/buildings4.txt");
|
||||
of >> format;
|
||||
if(format!=1)
|
||||
|
Loading…
Reference in New Issue
Block a user