1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Merge pull request #3208 from IvanSavenko/bugfixing

Bugfixing
This commit is contained in:
DjWarmonger 2023-11-21 09:41:13 +01:00 committed by GitHub
commit b0bd7bdb56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 8 additions and 8 deletions

View File

@ -76,7 +76,7 @@ CLobbyScreen::CLobbyScreen(ESelectionScreen screenType)
card->iconDifficulty->addCallback(std::bind(&IServerAPI::setDifficulty, CSH, _1)); card->iconDifficulty->addCallback(std::bind(&IServerAPI::setDifficulty, CSH, _1));
buttonStart = std::make_shared<CButton>(Point(411, 535), AnimationPath::builtin("SCNRBEG.DEF"), CGI->generaltexth->zelp[103], std::bind(&CLobbyScreen::startScenario, this, true), EShortcut::LOBBY_BEGIN_GAME); buttonStart = std::make_shared<CButton>(Point(411, 535), AnimationPath::builtin("SCNRBEG.DEF"), CGI->generaltexth->zelp[103], std::bind(&CLobbyScreen::startScenario, this, false), EShortcut::LOBBY_BEGIN_GAME);
initLobby(); initLobby();
break; break;
} }
@ -84,7 +84,7 @@ CLobbyScreen::CLobbyScreen(ESelectionScreen screenType)
{ {
tabOpt = std::make_shared<OptionsTab>(); tabOpt = std::make_shared<OptionsTab>();
tabTurnOptions = std::make_shared<TurnOptionsTab>(); tabTurnOptions = std::make_shared<TurnOptionsTab>();
buttonStart = std::make_shared<CButton>(Point(411, 535), AnimationPath::builtin("SCNRLOD.DEF"), CGI->generaltexth->zelp[103], std::bind(&CLobbyScreen::startScenario, this, true), EShortcut::LOBBY_LOAD_GAME); buttonStart = std::make_shared<CButton>(Point(411, 535), AnimationPath::builtin("SCNRLOD.DEF"), CGI->generaltexth->zelp[103], std::bind(&CLobbyScreen::startScenario, this, false), EShortcut::LOBBY_LOAD_GAME);
initLobby(); initLobby();
break; break;
} }

View File

@ -959,7 +959,7 @@ void OptionsTab::PlayerOptionsEntry::updateName() {
void OptionsTab::onSetPlayerClicked(const PlayerSettings & ps) const void OptionsTab::onSetPlayerClicked(const PlayerSettings & ps) const
{ {
if(ps.isControlledByAI() || humanPlayers > 0) if(ps.isControlledByAI() || humanPlayers > 1)
CSH->setPlayer(ps.color); CSH->setPlayer(ps.color);
} }

View File

@ -255,7 +255,7 @@
}, },
"quickCombat" : { "quickCombat" : {
"type" : "boolean", "type" : "boolean",
"default" : true "default" : false
}, },
"objectAnimation" : { "objectAnimation" : {
"type" : "boolean", "type" : "boolean",

View File

@ -371,7 +371,7 @@ si32 BattleField::decode(const std::string & identifier)
std::string BattleField::encode(const si32 index) std::string BattleField::encode(const si32 index)
{ {
return VLC->spells()->getByIndex(index)->getJsonKey(); return VLC->battlefields()->getByIndex(index)->getJsonKey();
} }
std::string SpellID::entityType() std::string SpellID::entityType()

View File

@ -50,6 +50,7 @@ namespace GameConstants
constexpr int CREATURES_COUNT = 197; constexpr int CREATURES_COUNT = 197;
constexpr ui32 BASE_MOVEMENT_COST = 100; //default cost for non-diagonal movement constexpr ui32 BASE_MOVEMENT_COST = 100; //default cost for non-diagonal movement
constexpr int64_t PLAYER_RESOURCES_CAP = 1000 * 1000 * 1000;
} }
VCMI_LIB_NAMESPACE_END VCMI_LIB_NAMESPACE_END

View File

@ -329,7 +329,6 @@ void CGHeroInstance::initHero(CRandomGenerator & rand)
if(!getArt(ArtifactPosition::SPELLBOOK) && type->haveSpellBook) if(!getArt(ArtifactPosition::SPELLBOOK) && type->haveSpellBook)
{ {
auto artifact = ArtifactUtils::createNewArtifactInstance(ArtifactID::SPELLBOOK); auto artifact = ArtifactUtils::createNewArtifactInstance(ArtifactID::SPELLBOOK);
cb->gameState()->map->addNewArtifactInstance(artifact);
putArtifact(ArtifactPosition::SPELLBOOK, artifact); putArtifact(ArtifactPosition::SPELLBOOK, artifact);
} }
} }
@ -339,7 +338,6 @@ void CGHeroInstance::initHero(CRandomGenerator & rand)
if(!getArt(ArtifactPosition::MACH4)) if(!getArt(ArtifactPosition::MACH4))
{ {
auto artifact = ArtifactUtils::createNewArtifactInstance(ArtifactID::CATAPULT); auto artifact = ArtifactUtils::createNewArtifactInstance(ArtifactID::CATAPULT);
cb->gameState()->map->addNewArtifactInstance(artifact);
putArtifact(ArtifactPosition::MACH4, artifact); //everyone has a catapult putArtifact(ArtifactPosition::MACH4, artifact); //everyone has a catapult
} }
@ -458,7 +456,6 @@ void CGHeroInstance::initArmy(CRandomGenerator & rand, IArmyDescriptor * dst)
if(!getArt(slot)) if(!getArt(slot))
{ {
auto artifact = ArtifactUtils::createNewArtifactInstance(aid); auto artifact = ArtifactUtils::createNewArtifactInstance(aid);
cb->gameState()->map->addNewArtifactInstance(artifact);
putArtifact(slot, artifact); putArtifact(slot, artifact);
} }
else else

View File

@ -797,6 +797,7 @@ void SetResources::applyGs(CGameState * gs) const
gs->getPlayerState(player)->resources = res; gs->getPlayerState(player)->resources = res;
else else
gs->getPlayerState(player)->resources += res; gs->getPlayerState(player)->resources += res;
gs->getPlayerState(player)->resources.amin(GameConstants::PLAYER_RESOURCES_CAP);
//just ensure that player resources are not negative //just ensure that player resources are not negative
//server is responsible to check if player can afford deal //server is responsible to check if player can afford deal
@ -2022,6 +2023,7 @@ void NewTurn::applyGs(CGameState *gs)
{ {
assert(re.first.isValidPlayer()); assert(re.first.isValidPlayer());
gs->getPlayerState(re.first)->resources = re.second; gs->getPlayerState(re.first)->resources = re.second;
gs->getPlayerState(re.first)->resources.amin(GameConstants::PLAYER_RESOURCES_CAP);
} }
for(const auto & creatureSet : cres) //set available creatures in towns for(const auto & creatureSet : cres) //set available creatures in towns