mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-19 00:17:56 +02:00
- fixes #1105
- minor improvement to resolution selection dialog - removed (hopefully) all cases where neutral faction uses id -1
This commit is contained in:
@ -1246,11 +1246,10 @@ CCreaturePic::CCreaturePic(int x, int y, const CCreature *cre, bool Big, bool An
|
|||||||
pos.x+=x;
|
pos.x+=x;
|
||||||
pos.y+=y;
|
pos.y+=y;
|
||||||
|
|
||||||
si8 faction = 0;//FIXME: support neutral faction
|
TFaction faction = cre->faction;
|
||||||
if (vstd::contains(CGI->townh->factions, cre->faction))
|
|
||||||
{
|
assert(vstd::contains(CGI->townh->factions, cre->faction));
|
||||||
faction = cre->faction;
|
|
||||||
}
|
|
||||||
if(Big)
|
if(Big)
|
||||||
bg = new CPicture(CGI->townh->factions[faction].creatureBg130);
|
bg = new CPicture(CGI->townh->factions[faction].creatureBg130);
|
||||||
else
|
else
|
||||||
@ -2866,6 +2865,7 @@ void CMarketplaceWindow::updateTraderText()
|
|||||||
CAltarWindow::CAltarWindow(const IMarket *Market, const CGHeroInstance *Hero /*= NULL*/, EMarketMode::EMarketMode Mode)
|
CAltarWindow::CAltarWindow(const IMarket *Market, const CGHeroInstance *Hero /*= NULL*/, EMarketMode::EMarketMode Mode)
|
||||||
:CTradeWindow((Mode == EMarketMode::CREATURE_EXP ? "ALTARMON.bmp" : "ALTRART2.bmp"), Market, Hero, Mode)
|
:CTradeWindow((Mode == EMarketMode::CREATURE_EXP ? "ALTARMON.bmp" : "ALTRART2.bmp"), Market, Hero, Mode)
|
||||||
{
|
{
|
||||||
|
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
||||||
if(Mode == EMarketMode::CREATURE_EXP)
|
if(Mode == EMarketMode::CREATURE_EXP)
|
||||||
{
|
{
|
||||||
//%s's Creatures
|
//%s's Creatures
|
||||||
@ -3302,7 +3302,7 @@ CSystemOptionsWindow::CSystemOptionsWindow():
|
|||||||
static const std::string fsHelp = "{Fullscreen}\n\n If selected, VCMI will run in fullscreen mode, othervice VCMI will run in window";
|
static const std::string fsHelp = "{Fullscreen}\n\n If selected, VCMI will run in fullscreen mode, othervice VCMI will run in window";
|
||||||
static const std::string cwLabel = "Classic creature window";
|
static const std::string cwLabel = "Classic creature window";
|
||||||
static const std::string cwHelp = "{Classic creature window}\n\n Enable original Heroes 3 creature window instead of new window from VCMI";
|
static const std::string cwHelp = "{Classic creature window}\n\n Enable original Heroes 3 creature window instead of new window from VCMI";
|
||||||
static const std::string rsLabel = "Select resolution";
|
static const std::string rsLabel = "Resolution";
|
||||||
static const std::string rsHelp = "{Select resolution}\n\n Change in-game screen resolution. Will only affect adventure map. Game restart required to apply new resolution.";
|
static const std::string rsHelp = "{Select resolution}\n\n Change in-game screen resolution. Will only affect adventure map. Game restart required to apply new resolution.";
|
||||||
|
|
||||||
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
OBJ_CONSTRUCTION_CAPTURING_ALL;
|
||||||
@ -3403,6 +3403,13 @@ CSystemOptionsWindow::CSystemOptionsWindow():
|
|||||||
fullscreen->select(settings["video"]["fullscreen"].Bool());
|
fullscreen->select(settings["video"]["fullscreen"].Bool());
|
||||||
|
|
||||||
gameResButton = new CAdventureMapButton("", rsHelp, boost::bind(&CSystemOptionsWindow::selectGameRes, this), 28, 275,"SYSOB12", SDLK_g);
|
gameResButton = new CAdventureMapButton("", rsHelp, boost::bind(&CSystemOptionsWindow::selectGameRes, this), 28, 275,"SYSOB12", SDLK_g);
|
||||||
|
|
||||||
|
std::string resText;
|
||||||
|
resText += boost::lexical_cast<std::string>(settings["video"]["screenRes"]["width"].Float());
|
||||||
|
resText += "x";
|
||||||
|
resText += boost::lexical_cast<std::string>(settings["video"]["screenRes"]["height"].Float());
|
||||||
|
gameResLabel = new CLabel(170, 292, FONT_MEDIUM, CENTER, Colors::Jasmine, resText);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSystemOptionsWindow::selectGameRes()
|
void CSystemOptionsWindow::selectGameRes()
|
||||||
@ -3426,9 +3433,8 @@ void CSystemOptionsWindow::selectGameRes()
|
|||||||
|
|
||||||
void CSystemOptionsWindow::setGameRes(int index)
|
void CSystemOptionsWindow::setGameRes(int index)
|
||||||
{
|
{
|
||||||
config::CConfigHandler::GuiOptionsMap::const_iterator iter = conf.guiOptions.begin();
|
auto iter = conf.guiOptions.begin();
|
||||||
while (index--)
|
std::advance(iter, index);
|
||||||
iter++;
|
|
||||||
|
|
||||||
//do not set resolution to illegal one (0x0)
|
//do not set resolution to illegal one (0x0)
|
||||||
assert(iter!=conf.guiOptions.end() && iter->first.first > 0 && iter->first.second > 0);
|
assert(iter!=conf.guiOptions.end() && iter->first.first > 0 && iter->first.second > 0);
|
||||||
@ -3436,6 +3442,12 @@ void CSystemOptionsWindow::setGameRes(int index)
|
|||||||
Settings gameRes = settings.write["video"]["screenRes"];
|
Settings gameRes = settings.write["video"]["screenRes"];
|
||||||
gameRes["width"].Float() = iter->first.first;
|
gameRes["width"].Float() = iter->first.first;
|
||||||
gameRes["height"].Float() = iter->first.second;
|
gameRes["height"].Float() = iter->first.second;
|
||||||
|
|
||||||
|
std::string resText;
|
||||||
|
resText += boost::lexical_cast<std::string>(iter->first.first);
|
||||||
|
resText += "x";
|
||||||
|
resText += boost::lexical_cast<std::string>(iter->first.second);
|
||||||
|
gameResLabel->setTxt(resText);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSystemOptionsWindow::toggleReminder(bool on)
|
void CSystemOptionsWindow::toggleReminder(bool on)
|
||||||
|
@ -729,6 +729,7 @@ private:
|
|||||||
CHighlightableButton * fullscreen;
|
CHighlightableButton * fullscreen;
|
||||||
|
|
||||||
CAdventureMapButton *gameResButton;
|
CAdventureMapButton *gameResButton;
|
||||||
|
CLabel *gameResLabel;
|
||||||
|
|
||||||
void setMusicVolume( int newVolume );
|
void setMusicVolume( int newVolume );
|
||||||
void setSoundVolume( int newVolume );
|
void setSoundVolume( int newVolume );
|
||||||
|
@ -27,8 +27,8 @@ CCreatureHandler::CCreatureHandler()
|
|||||||
// Set the faction alignments to the defaults:
|
// Set the faction alignments to the defaults:
|
||||||
// Good: Castle, Rampart, Tower
|
// Good: Castle, Rampart, Tower
|
||||||
// Evil: Inferno, Necropolis, Dungeon
|
// Evil: Inferno, Necropolis, Dungeon
|
||||||
// Neutral: Stronghold, Fortess, Conflux
|
// Neutral: Stronghold, Fortess, Conflux, neutrals
|
||||||
factionAlignments += 1, 1, 1, -1, -1, -1, 0, 0, 0;
|
factionAlignments += 1, 1, 1, -1, -1, -1, 0, 0, 0, 0;
|
||||||
doubledCreatures += 4, 14, 20, 28, 44, 60, 70, 72, 85, 86, 100, 104; //according to Strategija
|
doubledCreatures += 4, 14, 20, 28, 44, 60, 70, 72, 85, 86, 100, 104; //according to Strategija
|
||||||
|
|
||||||
allCreatures.setDescription("All creatures");
|
allCreatures.setDescription("All creatures");
|
||||||
@ -148,21 +148,7 @@ std::string CCreature::nodeName() const
|
|||||||
|
|
||||||
bool CCreature::isItNativeTerrain(int terrain) const
|
bool CCreature::isItNativeTerrain(int terrain) const
|
||||||
{
|
{
|
||||||
return VLC->townh->factions[0].nativeTerrain == terrain; //FIXME: handle neutral faction properly
|
return VLC->townh->factions[faction].nativeTerrain == terrain;
|
||||||
}
|
|
||||||
|
|
||||||
int readNumber(int & befi, int & i, int andame, std::string & buf) //helper function for void CCreatureHandler::loadCreatures() and loadUnitAnimInfo()
|
|
||||||
{
|
|
||||||
befi=i;
|
|
||||||
for(; i<andame; ++i)
|
|
||||||
{
|
|
||||||
if(buf[i]=='\t')
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
std::string tmp = buf.substr(befi, i-befi);
|
|
||||||
int ret = atoi(buf.substr(befi, i-befi).c_str());
|
|
||||||
++i;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -172,7 +158,7 @@ int readNumber(int & befi, int & i, int andame, std::string & buf) //helper func
|
|||||||
*/
|
*/
|
||||||
bool CCreatureHandler::isGood (si8 faction) const
|
bool CCreatureHandler::isGood (si8 faction) const
|
||||||
{
|
{
|
||||||
return faction != -1 && factionAlignments[faction] == 1;
|
return factionAlignments[faction] == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -182,7 +168,7 @@ bool CCreatureHandler::isGood (si8 faction) const
|
|||||||
*/
|
*/
|
||||||
bool CCreatureHandler::isEvil (si8 faction) const
|
bool CCreatureHandler::isEvil (si8 faction) const
|
||||||
{
|
{
|
||||||
return faction != -1 && factionAlignments[faction] == -1;
|
return factionAlignments[faction] == -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AddAbility(CCreature *cre, const JsonVector &ability_vec)
|
static void AddAbility(CCreature *cre, const JsonVector &ability_vec)
|
||||||
|
@ -123,7 +123,7 @@ CCreature * CModHandler::loadCreature (const JsonNode &node)
|
|||||||
cre->cost = Res::ResourceSet(node["cost"]);
|
cre->cost = Res::ResourceSet(node["cost"]);
|
||||||
|
|
||||||
cre->level = node["level"].Float();
|
cre->level = node["level"].Float();
|
||||||
cre->faction = -1; //neutral faction is 9 for now. Will be replaced by string -> id conversion
|
cre->faction = 9; //neutral faction is 9 for now. Will be replaced by string -> id conversion
|
||||||
//TODO: node["faction"].String() to id
|
//TODO: node["faction"].String() to id
|
||||||
cre->fightValue = node["fightValue"].Float();
|
cre->fightValue = node["fightValue"].Float();
|
||||||
cre->AIValue = node["aiValue"].Float();
|
cre->AIValue = node["aiValue"].Float();
|
||||||
|
Reference in New Issue
Block a user