Просмотр исходного кода

Fixed a bad fix. Fixed more warnings.

These warnings have not been fixed because the are legitimate and/or I don't know how to fix them:

test\googletest\googletest\include\gtest/gtest-printers.h(888,43): warning C4996: 'std::tr1': warning STL4002: The non-Standard std::tr1 namespace and TR1-only machinery are deprecated and will be REMOVED.
lib\serializer\JsonSerializeFormat.h(523,26): warning C4244: 'argument': conversion from 'type1' to 'type2', possible loss of data
include\boost/iostreams/positioning.hpp(96,15): warning C4996: 'std::fpos<_Mbstatet>::seekpos': warning STL4019: The member std::fpos::seekpos() is non-Standard, ...
source\lib\filesystem\FileStream.h(39,69): warning C4910: 'boost::iostreams::stream<FileBuf,std::char_traits<char>,std::allocator<char>>': '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
include\boost/optional/optional.hpp(274,53): warning C4244: 'argument': conversion from 'T' to 'T', possible loss of data
client\widgets\../gui/SDL_Extensions.h(112,14): warning C4244: 'initializing': conversion from 'type1' to 'type2', possible loss of data
client\CServerHandler.cpp(421,24): warning C4834: discarding return value of function with 'nodiscard' attribute (see https://bugs.vcmi.eu/view.php?id=3144)
client\CVideoHandler.cpp(130,25): warning C4996: 'AVStream::codec': was declared deprecated
John Bolton 5 лет назад
Родитель
Сommit
d7e82c1087

+ 1 - 1
lib/CTownHandler.cpp

@@ -364,7 +364,7 @@ void CTownHandler::loadBuilding(CTown * town, const std::string & stringID, cons
 
 	ret->identifier = stringID;
 	ret->town = town;
-	ret->bid = BuildingID((BuildingID::EBuildingID)source["id"].Float());
+	ret->bid = BuildingID((si32)source["id"].Float());
 	ret->name = source["name"].String();
 	ret->description = source["description"].String();
 	ret->resources = TResources(source["cost"]);

+ 1 - 1
test/battle/CUnitStateTest.cpp

@@ -178,7 +178,7 @@ TEST_F(UnitStateTest, attackWithFrenzy)
 
 	bonusMock.addNewBonus(std::make_shared<Bonus>(Bonus::PERMANENT, Bonus::IN_FRENZY, Bonus::SPELL_EFFECT, 50, 0));
 
-	int expectedAttack = DEFAULT_ATTACK + 0.5 * DEFAULT_DEFENCE;
+	int expectedAttack = static_cast<int>(DEFAULT_ATTACK + 0.5 * DEFAULT_DEFENCE);
 
 	EXPECT_EQ(subject.getAttack(false), expectedAttack);
 	EXPECT_EQ(subject.getAttack(true), expectedAttack);

+ 1 - 1
test/map/CMapEditManagerTest.cpp

@@ -141,7 +141,7 @@ TEST(MapManager, DrawTerrain_View)
 			{
 				const auto & posVector = posNode.Vector();
 				if(posVector.size() != 3) throw std::runtime_error("A position should consist of three values x,y,z. Continue with next position.");
-				int3 pos(posVector[0].Float(), posVector[1].Float(), posVector[2].Float());
+				int3 pos((si32)posVector[0].Float(), (si32)posVector[1].Float(), (si32)posVector[2].Float());
 				const auto & originalTile = originalMap->getTile(pos);
 				editManager->getTerrainSelection().selectRange(MapRect(pos, 1, 1));
 				editManager->drawTerrain(originalTile.terType, &gen);

+ 1 - 1
test/vcai/ResurceManagerTest.cpp

@@ -205,7 +205,7 @@ TEST_F(ResourceManagerTest, reservedResources)
 TEST_F(ResourceManagerTest, freeResources)
 {
 	ON_CALL(gcm, getResourceAmount()) //in case callback or gs gets crazy
-		.WillByDefault(Return(TResources(-1, 0, -13.0f, -38763, -93764, -464, -12, -98765)));
+		.WillByDefault(Return(TResources(-1, 0, -13, -38763, -93764, -464, -12, -98765)));
 
 	auto res = rm->freeResources();
 	ASSERT_GE(res[Res::WOOD], 0);