1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +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.turns = carrierParentNode->turns;
candidate.setCost(carrierParentNode->getCost() + otherParentNode->getCost() / 1000.0); candidate.setCost(carrierParentNode->getCost() + otherParentNode->getCost() / 1000.0);
candidate.moveRemains = carrierParentNode->moveRemains; candidate.moveRemains = carrierParentNode->moveRemains;
candidate.danger = carrierParentNode->danger;
if(carrierParentNode->turns < otherParentNode->turns) if(carrierParentNode->turns < otherParentNode->turns)
{ {

View File

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

View File

@@ -537,7 +537,7 @@ void CClient::handlePack(CPack * pack)
int CClient::sendRequest(const CPackForServer * request, PlayerColor player) int CClient::sendRequest(const CPackForServer * request, PlayerColor player)
{ {
static ui32 requestCounter = 0; static ui32 requestCounter = 1;
ui32 requestID = requestCounter++; ui32 requestID = requestCounter++;
logNetwork->trace("Sending a request \"%s\". It'll have an ID=%d.", typeid(*request).name(), requestID); 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 struct DLL_LINKAGE CPackForServer : public CPack
{ {
mutable PlayerColor player = PlayerColor::NEUTRAL; mutable PlayerColor player = PlayerColor::NEUTRAL;
mutable si32 requestID; mutable uint32_t requestID = 0;
template <typename Handler> void serialize(Handler &h) template <typename Handler> void serialize(Handler &h)
{ {