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

Fix potentially uninitialized values

This commit is contained in:
Ivan Savenko 2024-02-12 12:31:27 +02:00
parent dc8d48a3b6
commit c577ea3e8d
4 changed files with 16 additions and 15 deletions

View File

@ -843,6 +843,7 @@ ExchangeCandidate HeroChainCalculationTask::calculateExchange(
candidate.turns = carrierParentNode->turns;
candidate.setCost(carrierParentNode->getCost() + otherParentNode->getCost() / 1000.0);
candidate.moveRemains = carrierParentNode->moveRemains;
candidate.danger = carrierParentNode->danger;
if(carrierParentNode->turns < otherParentNode->turns)
{

View File

@ -51,24 +51,24 @@ protected:
public:
uint64_t chainMask;
bool isMovable;
bool allowUseResources;
bool allowBattle;
bool allowSpellCast;
bool isMovable = false;
bool allowUseResources = false;
bool allowBattle = false;
bool allowSpellCast = false;
std::shared_ptr<SpecialAction> actorAction;
const CGHeroInstance * hero;
HeroRole heroRole;
const CCreatureSet * creatureSet;
const ChainActor * battleActor;
const ChainActor * castActor;
const ChainActor * resourceActor;
const ChainActor * carrierParent;
const ChainActor * otherParent;
const ChainActor * baseActor;
const CCreatureSet * creatureSet = nullptr;
const ChainActor * battleActor = nullptr;
const ChainActor * castActor = nullptr;
const ChainActor * resourceActor = nullptr;
const ChainActor * carrierParent = nullptr;
const ChainActor * otherParent = nullptr;
const ChainActor * baseActor = nullptr;
int3 initialPosition;
EPathfindingLayer layer;
uint32_t initialMovement;
uint32_t initialTurn;
uint32_t initialMovement = 0;
uint32_t initialTurn = 0;
uint64_t armyValue;
float heroFightingStrength;
uint8_t actorExchangeCount;

View File

@ -537,7 +537,7 @@ void CClient::handlePack(CPack * pack)
int CClient::sendRequest(const CPackForServer * request, PlayerColor player)
{
static ui32 requestCounter = 0;
static ui32 requestCounter = 1;
ui32 requestID = requestCounter++;
logNetwork->trace("Sending a request \"%s\". It'll have an ID=%d.", typeid(*request).name(), requestID);

View File

@ -64,7 +64,7 @@ struct DLL_LINKAGE Query : public CPackForClient
struct DLL_LINKAGE CPackForServer : public CPack
{
mutable PlayerColor player = PlayerColor::NEUTRAL;
mutable si32 requestID;
mutable uint32_t requestID = 0;
template <typename Handler> void serialize(Handler &h)
{