Sfoglia il codice sorgente

Merge pull request #3208 from IvanSavenko/bugfixing

Bugfixing
DjWarmonger 1 anno fa
parent
commit
b0bd7bdb56

+ 2 - 2
client/lobby/CLobbyScreen.cpp

@@ -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;
 	}
 	}

+ 1 - 1
client/lobby/OptionsTab.cpp

@@ -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);
 }
 }
 
 

+ 1 - 1
config/schemas/settings.json

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

+ 1 - 1
lib/constants/EntityIdentifiers.cpp

@@ -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()

+ 1 - 0
lib/constants/NumericConstants.h

@@ -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

+ 0 - 3
lib/mapObjects/CGHeroInstance.cpp

@@ -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

+ 2 - 0
lib/networkPacks/NetPacksLib.cpp

@@ -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