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

Merge branch 'develop' of https://github.com/vcmi/vcmi into fuzzyFix

This commit is contained in:
DjWarmonger 2014-12-19 14:21:44 +01:00
commit a3a42ae144
11 changed files with 50 additions and 25 deletions

View File

@ -1586,7 +1586,14 @@ int SelectionTab::getLine()
Point clickPos(GH.current->button.x, GH.current->button.y); Point clickPos(GH.current->button.x, GH.current->button.y);
clickPos = clickPos - pos.topLeft(); clickPos = clickPos - pos.topLeft();
if (clickPos.y > 115 && clickPos.y < 564 && clickPos.x > 22 && clickPos.x < 371) // Ignore clicks on save name area
int maxPosY;
if(tabType == CMenuScreen::saveGame)
maxPosY = 516;
else
maxPosY = 564;
if(clickPos.y > 115 && clickPos.y < maxPosY && clickPos.x > 22 && clickPos.x < 371)
{ {
line = (clickPos.y-115) / 25; //which line line = (clickPos.y-115) / 25; //which line
} }
@ -2164,6 +2171,10 @@ void InfoCard::changeSelection( const CMapInfo *to )
else else
mapDescription->setText(to->mapHeader->description); mapDescription->setText(to->mapHeader->description);
mapDescription->label->scrollTextTo(0);
if (mapDescription->slider)
mapDescription->slider->moveToMin();
if(SEL->screenType != CMenuScreen::newGame && SEL->screenType != CMenuScreen::campaignList) { if(SEL->screenType != CMenuScreen::newGame && SEL->screenType != CMenuScreen::campaignList) {
//difficulty->block(true); //difficulty->block(true);
difficulty->setSelected(SEL->sInfo.difficulty); difficulty->setSelected(SEL->sInfo.difficulty);

View File

@ -744,6 +744,11 @@ void CSlider::keyPressed(const SDL_KeyboardEvent & key)
moveTo(moveDest); moveTo(moveDest);
} }
void CSlider::moveToMin()
{
moveTo(0);
}
void CSlider::moveToMax() void CSlider::moveToMax()
{ {
moveTo(amount); moveTo(amount);

View File

@ -230,6 +230,7 @@ public:
void moveRight(); void moveRight();
void moveTo(int value); void moveTo(int value);
void moveBy(int amount); void moveBy(int amount);
void moveToMin();
void moveToMax(); void moveToMax();
/// Amount modifier /// Amount modifier

View File

@ -280,15 +280,20 @@ void CTextBox::resize(Point newSize)
void CTextBox::setText(const std::string &text) void CTextBox::setText(const std::string &text)
{ {
label->pos.w = pos.w; // reset to default before textSize.y check
label->setText(text); label->setText(text);
if(label->textSize.y <= label->pos.h && slider) if(label->textSize.y <= label->pos.h && slider)
{ {
// slider is no longer needed // slider is no longer needed
vstd::clear_pointer(slider); vstd::clear_pointer(slider);
label->pos.w = pos.w; }
else if(slider)
{
// decrease width again if slider still used
label->pos.w = pos.w - 32;
label->setText(text); label->setText(text);
} }
else if (label->textSize.y > label->pos.h && !slider) else if(label->textSize.y > label->pos.h)
{ {
// create slider and update widget // create slider and update widget
label->pos.w = pos.w - 32; label->pos.w = pos.w - 32;

View File

@ -651,7 +651,7 @@ void CStackWindow::CWindowSection::createBonusItem(size_t index, Point position)
BonusInfo & bi = parent->activeBonuses[index]; BonusInfo & bi = parent->activeBonuses[index];
new CPicture(bi.imagePath, position.x, position.y); new CPicture(bi.imagePath, position.x, position.y);
new CLabel(position.x + 60, position.y + 2, FONT_SMALL, TOPLEFT, Colors::WHITE, bi.name); new CLabel(position.x + 60, position.y + 2, FONT_SMALL, TOPLEFT, Colors::WHITE, bi.name);
new CLabel(position.x + 60, position.y + 25, FONT_SMALL, TOPLEFT, Colors::WHITE, bi.description); new CMultiLineLabel(Rect(position.x + 60, position.y + 17, 137,30), FONT_SMALL, TOPLEFT, Colors::WHITE, bi.description);
} }
} }

View File

@ -75,7 +75,7 @@
"DEATH_STARE": "DEATH_STARE":
{ {
"name": "Death Stare (${val}%)", "name": "Death Stare (${val}%)",
"description": "Chance to kill single creature" "description": "${val}% chance to kill single creature"
}, },
"DEFENSIVE_STANCE": "DEFENSIVE_STANCE":
@ -110,14 +110,14 @@
"ENCHANTER": "ENCHANTER":
{ {
"name": "Enchanter (${subtype.spell})", "name": "Enchanter",
"description": "Casts mass spell every turn" "description": "Can cast mass ${subtype.spell} every turn"
}, },
"ENCHANTED": "ENCHANTED":
{ {
"name": "Enchanted (${subtype.spell})", "name": "Enchanted",
"description": "Affected by permanent spell" "description": "Affected by permanent ${subtype.spell}"
}, },
"ENEMY_DEFENCE_REDUCTION": "ENEMY_DEFENCE_REDUCTION":
@ -198,14 +198,17 @@
"KING1": "KING1":
{ {
"name": "King1"
}, },
"KING2": "KING2":
{ {
"name": "King2"
}, },
"KING3": "KING3":
{ {
"name": "King3"
}, },
"LEVEL_SPELL_IMMUNITY": "LEVEL_SPELL_IMMUNITY":
@ -264,6 +267,7 @@
"NO_MORALE": "NO_MORALE":
{ {
}, },
"NO_WALL_PENALTY": "NO_WALL_PENALTY":
@ -320,8 +324,8 @@
}, },
"SPELLCASTER": "SPELLCASTER":
{ {
"name": "Spellcaster (${subtype.spell})", "name": "Spellcaster",
"description": "Can cast spells" "description": "Can cast ${subtype.spell}"
}, },
"SPELL_AFTER_ATTACK": "SPELL_AFTER_ATTACK":

View File

@ -2224,7 +2224,7 @@ SpellID CBattleInfoCallback::getRandomBeneficialSpell(const CStack * subject) co
for(const CSpell *spell : VLC->spellh->objects) for(const CSpell *spell : VLC->spellh->objects)
{ {
if (spell->isPositive()) //only positive if (spell->isPositive() && !spell->isRisingSpell()) //only positive and not rising
{ {
if (subject->hasBonusFrom(Bonus::SPELL_EFFECT, spell->id) if (subject->hasBonusFrom(Bonus::SPELL_EFFECT, spell->id)
|| battleCanCastThisSpellHere(subject->owner, spell, ECastingMode::CREATURE_ACTIVE_CASTING, subject->position) != ESpellCastProblem::OK) || battleCanCastThisSpellHere(subject->owner, spell, ECastingMode::CREATURE_ACTIVE_CASTING, subject->position) != ESpellCastProblem::OK)
@ -2295,6 +2295,7 @@ SpellID CBattleInfoCallback::getRandomBeneficialSpell(const CStack * subject) co
continue; continue;
} }
break; break;
case SpellID::TELEPORT: //issue 1928
case SpellID::CLONE: //not allowed case SpellID::CLONE: //not allowed
continue; continue;
break; break;

View File

@ -1197,6 +1197,7 @@ void BattleResult::applyGs( CGameState *gs )
void BattleStackMoved::applyGs( CGameState *gs ) void BattleStackMoved::applyGs( CGameState *gs )
{ {
CStack *s = gs->curB->getStack(stack); CStack *s = gs->curB->getStack(stack);
assert(s);
BattleHex dest = tilesToMove.back(); BattleHex dest = tilesToMove.back();
//if unit ended movement on quicksands that were created by enemy, that quicksand patch becomes visible for owner //if unit ended movement on quicksands that were created by enemy, that quicksand patch becomes visible for owner

View File

@ -1445,7 +1445,8 @@ void CGShipyard::onHeroVisit( const CGHeroInstance * h ) const
void CCartographer::onHeroVisit( const CGHeroInstance * h ) const void CCartographer::onHeroVisit( const CGHeroInstance * h ) const
{ {
if (!wasVisited (h->getOwner()) ) //if hero has not visited yet this cartographer //if player has not bought map of this subtype yet and underground exist for stalagmite cartographer
if (!wasVisited(h->getOwner()) && (subID != 2 || cb->gameState()->map->twoLevel))
{ {
if (cb->getResource(h->tempOwner, Res::GOLD) >= 1000) //if he can afford a map if (cb->getResource(h->tempOwner, Res::GOLD) >= 1000) //if he can afford a map
{ {

View File

@ -74,7 +74,7 @@ void CMapGenerator::initPrisonsRemaining()
if (isAllowed) if (isAllowed)
prisonsRemaining++; prisonsRemaining++;
} }
prisonsRemaining = std::max<int> (0, prisonsRemaining - 16 * map->players.size()); //so at least 16 heroes will be available for every player prisonsRemaining = std::max<int> (0, prisonsRemaining - 16 * mapGenOptions->getPlayerCount()); //so at least 16 heroes will be available for every player
} }
std::unique_ptr<CMap> CMapGenerator::generate(CMapGenOptions * mapGenOptions, int randomSeed /*= std::time(nullptr)*/) std::unique_ptr<CMap> CMapGenerator::generate(CMapGenOptions * mapGenOptions, int randomSeed /*= std::time(nullptr)*/)

View File

@ -209,17 +209,13 @@ fi
if [[ -n "$data_dir" ]] if [[ -n "$data_dir" ]]
then then
cp -r "$data_dir"/Data "$dest_dir"
cp -r "$data_dir"/Maps "$dest_dir"
# this folder is named differently from time to time # this folder is named differently from time to time
# vcmi can handle any case but script can't # bash also has `shopt -s nocaseglob` but we don't want this to
if [ -d "$data_dir"/MP3 ] # accidentally influence other parts of this script
then # since the directory names are short, we use this pattern matching
cp -r "$data_dir"/MP3 "$dest_dir" cp -r "$data_dir"/[Dd][Aa][Tt][Aa] "$dest_dir"
else cp -r "$data_dir"/[Mm][Aa][Pp][Ss] "$dest_dir"
cp -r "$data_dir"/Mp3 "$dest_dir" cp -r "$data_dir"/[Mm][Pp]3 "$dest_dir"
fi
fi fi
if [[ -n "$download" ]] if [[ -n "$download" ]]