1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-24 03:47:18 +02:00

Minor fixes:

- properly re-enable necessary mods during update
- do not crash if building border is fully-colored
This commit is contained in:
Ivan Savenko 2013-12-08 10:07:06 +00:00
parent f2cc630e2c
commit 5de70ba235
3 changed files with 36 additions and 21 deletions

View File

@ -168,27 +168,29 @@ void CBuildingRect::show(SDL_Surface * to)
blitAtLoc(border,0,0,to);
return;
}
// key colors in glowing border
SDL_Color c1 = {200, 200, 200, 255};
SDL_Color c2 = {120, 100, 60, 255};
SDL_Color c3 = {200, 180, 110, 255};
if (border->format->palette != nullptr)
{
// key colors in glowing border
SDL_Color c1 = {200, 200, 200, 255};
SDL_Color c2 = {120, 100, 60, 255};
SDL_Color c3 = {200, 180, 110, 255};
ui32 colorID = SDL_MapRGB(border->format, c3.r, c3.g, c3.b);
SDL_Color oldColor = border->format->palette->colors[colorID];
SDL_Color newColor;
ui32 colorID = SDL_MapRGB(border->format, c3.r, c3.g, c3.b);
SDL_Color oldColor = border->format->palette->colors[colorID];
SDL_Color newColor;
if (stateCounter < S2_WHITE_B)
newColor = multiplyColors(c1, c2, static_cast<double>(stateCounter % stageDelay) / stageDelay);
else
if (stateCounter < S3_YELLOW_B)
newColor = multiplyColors(c2, c3, static_cast<double>(stateCounter % stageDelay) / stageDelay);
else
newColor = oldColor;
SDL_SetColors(border, &newColor, colorID, 1);
blitAtLoc(border,0,0,to);
SDL_SetColors(border, &oldColor, colorID, 1);
if (stateCounter < S2_WHITE_B)
newColor = multiplyColors(c1, c2, static_cast<double>(stateCounter % stageDelay) / stageDelay);
else
if (stateCounter < S3_YELLOW_B)
newColor = multiplyColors(c2, c3, static_cast<double>(stateCounter % stageDelay) / stageDelay);
else
newColor = oldColor;
SDL_SetColors(border, &newColor, colorID, 1);
blitAtLoc(border,0,0,to);
SDL_SetColors(border, &oldColor, colorID, 1);
}
}
if (stateCounter < BUILDED)
stateCounter++;

View File

@ -506,11 +506,24 @@ void CModListView::installMods(QStringList archives)
modNames.push_back(modName);
}
QStringList modsToEnable;
// disable mod(s), to properly recalculate dependencies, if changed
for (QString mod : boost::adaptors::reverse(modNames))
{
if (modModel->getMod(mod).isInstalled())
manager->disableMod(mod);
CModEntry entry = modModel->getMod(mod);
if (entry.isInstalled())
{
// enable mod if installed and enabled
if (entry.isEnabled())
modsToEnable.push_back(mod);
}
else
{
// enable mod if m
if (settings["launcher"]["enableInstalledMods"].Bool())
modsToEnable.push_back(mod);
}
}
// uninstall old version of mod, if installed

View File

@ -369,7 +369,7 @@ void CTownHandler::loadStructure(CTown &town, const std::string & stringID, cons
}
else
{
VLC->modh->identifiers.tryRequestIdentifier("building." + town.faction->identifier, source["builds"], [=, &town](si32 identifier) mutable
VLC->modh->identifiers.requestIdentifier("building." + town.faction->identifier, source["builds"], [=, &town](si32 identifier) mutable
{
ret->buildable = town.buildings[BuildingID(identifier)];
});