mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Eliminate warnings / errors. Pull request #388
This commit is contained in:
parent
3c1c72319b
commit
3795985de9
@ -1152,7 +1152,7 @@ TGoalVec GatherArmy::getAllPossibleSubgoals()
|
||||
|
||||
if (ret.empty())
|
||||
{
|
||||
if (hero == ai->primaryHero() || value >= 1.1f)
|
||||
if (hero == ai->primaryHero() || value >= 1.1f) // FIXME: check PR388
|
||||
ret.push_back (sptr(Goals::Explore()));
|
||||
else //workaround to break loop - seemingly there are no ways to explore left
|
||||
throw goalFulfilledException (sptr(Goals::GatherArmy(0).sethero(hero)));
|
||||
|
@ -2261,7 +2261,7 @@ void InfoCard::changeSelection( const CMapInfo *to )
|
||||
void InfoCard::clickRight( tribool down, bool previousState )
|
||||
{
|
||||
static const Rect flagArea(19, 397, 335, 23);
|
||||
if(SEL->current && down && SEL->current && isItInLoc(flagArea, GH.current->motion.x, GH.current->motion.y))
|
||||
if(SEL->current && down && isItInLoc(flagArea, GH.current->motion.x, GH.current->motion.y))
|
||||
showTeamsPopup();
|
||||
}
|
||||
|
||||
|
@ -602,8 +602,8 @@ void CBattleInterface::setBattleCursor(const int myNumber)
|
||||
CCursorHandler *cursor = CCS->curh;
|
||||
|
||||
const double subdividingAngle = 2.0*M_PI/6.0; // Divide a hex into six sectors.
|
||||
const double hexMidX = hoveredHex.pos.x + hoveredHex.pos.w/2;
|
||||
const double hexMidY = hoveredHex.pos.y + hoveredHex.pos.h/2;
|
||||
const double hexMidX = hoveredHex.pos.x + hoveredHex.pos.w/2.0;
|
||||
const double hexMidY = hoveredHex.pos.y + hoveredHex.pos.h/2.0;
|
||||
const double cursorHexAngle = M_PI - atan2(hexMidY - cursor->ypos, cursor->xpos - hexMidX) + subdividingAngle/2; //TODO: refactor this nightmare
|
||||
const double sector = fmod(cursorHexAngle/subdividingAngle, 6.0);
|
||||
const int zigzagCorrection = !((myNumber/GameConstants::BFIELD_WIDTH)%2); // Off-by-one correction needed to deal with the odd battlefield rows.
|
||||
|
@ -566,7 +566,7 @@ void CClickableHex::hover(bool on)
|
||||
}
|
||||
}
|
||||
|
||||
CClickableHex::CClickableHex() : setAlterText(false), myNumber(-1), accessible(true), hovered(false), strictHovered(false), myInterface(nullptr)
|
||||
CClickableHex::CClickableHex() : setAlterText(false), myNumber(-1), accessible(true), strictHovered(false), myInterface(nullptr)
|
||||
{
|
||||
addUsedEvents(LCLICK | RCLICK | HOVER | MOVE);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ public:
|
||||
ui32 myNumber; //number of hex in commonly used format
|
||||
bool accessible; //if true, this hex is accessible for units
|
||||
//CStack * ourStack;
|
||||
bool hovered, strictHovered; //for determining if hex is hovered by mouse (this is different problem than hex's graphic hovering)
|
||||
bool strictHovered; //for determining if hex is hovered by mouse (this is different problem than hex's graphic hovering)
|
||||
CBattleInterface * myInterface; //interface that owns me
|
||||
static Point getXYUnitAnim(BattleHex hexNum, const CStack * creature, CBattleInterface * cbi); //returns (x, y) of left top corner of animation
|
||||
|
||||
|
@ -70,7 +70,7 @@ struct NeighborTilesInfo
|
||||
|
||||
bool areAllHidden() const
|
||||
{
|
||||
return !(d1 || d2 || d3 || d4 || d5 || d6 || d7 || d8 || d8 );
|
||||
return !(d1 || d2 || d3 || d4 || d5 || d6 || d7 || d8 || d9);
|
||||
}
|
||||
|
||||
int getBitmapID() const
|
||||
|
@ -1062,7 +1062,7 @@ void CInGameConsole::keyPressed (const SDL_KeyboardEvent & key)
|
||||
captureAllKeys = false;
|
||||
endEnteringText(false);
|
||||
}
|
||||
else if(SDLK_TAB)
|
||||
else if(SDLK_TAB == key.keysym.sym)
|
||||
{
|
||||
captureAllKeys = true;
|
||||
startEnteringText();
|
||||
|
@ -237,7 +237,7 @@ bool CHeroArtPlace::askToAssemble(const CArtifactInstance *art, ArtifactPosition
|
||||
|
||||
void CHeroArtPlace::clickRight(tribool down, bool previousState)
|
||||
{
|
||||
if(ourArt && down && ourArt && !locked && text.size() && !picked) //if there is no description or it's a lock, do nothing ;]
|
||||
if(ourArt && down && !locked && text.size() && !picked) //if there is no description or it's a lock, do nothing ;]
|
||||
{
|
||||
if (slotID < GameConstants::BACKPACK_START)
|
||||
{
|
||||
|
@ -93,8 +93,9 @@ void LRClickableAreaWTextComp::clickLeft(tribool down, bool previousState)
|
||||
}
|
||||
|
||||
LRClickableAreaWTextComp::LRClickableAreaWTextComp(const Rect &Pos, int BaseType)
|
||||
: LRClickableAreaWText(Pos), baseType(BaseType), bonusValue(-1), type(-1)
|
||||
: LRClickableAreaWText(Pos), baseType(BaseType), bonusValue(-1)
|
||||
{
|
||||
type = -1;
|
||||
}
|
||||
|
||||
CComponent * LRClickableAreaWTextComp::createComponent() const
|
||||
|
@ -123,7 +123,7 @@ class LRClickableAreaWTextComp: public LRClickableAreaWText
|
||||
{
|
||||
public:
|
||||
int baseType;
|
||||
int bonusValue, type;
|
||||
int bonusValue;
|
||||
virtual void clickLeft(tribool down, bool previousState) override;
|
||||
virtual void clickRight(tribool down, bool previousState) override;
|
||||
|
||||
|
@ -116,18 +116,31 @@ public:
|
||||
{
|
||||
h & meta;
|
||||
h & type;
|
||||
switch (type) {
|
||||
break; case JsonType::DATA_NULL:
|
||||
break; case JsonType::DATA_BOOL: h & data.Bool;
|
||||
break; case JsonType::DATA_FLOAT: h & data.Float;
|
||||
break; case JsonType::DATA_STRING: h & data.String;
|
||||
break; case JsonType::DATA_VECTOR: h & data.Vector;
|
||||
break; case JsonType::DATA_STRUCT: h & data.Struct;
|
||||
}
|
||||
if(version >= 770)
|
||||
switch(type)
|
||||
{
|
||||
if(type == JsonType::DATA_INTEGER)
|
||||
case JsonType::DATA_NULL:
|
||||
break;
|
||||
case JsonType::DATA_BOOL:
|
||||
h & data.Bool;
|
||||
break;
|
||||
case JsonType::DATA_FLOAT:
|
||||
h & data.Float;
|
||||
break;
|
||||
case JsonType::DATA_STRING:
|
||||
h & data.String;
|
||||
break;
|
||||
case JsonType::DATA_VECTOR:
|
||||
h & data.Vector;
|
||||
break;
|
||||
case JsonType::DATA_STRUCT:
|
||||
h & data.Struct;
|
||||
break;
|
||||
case JsonType::DATA_INTEGER:
|
||||
if(version >= 770)
|
||||
{
|
||||
h & data.Integer;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -2201,7 +2201,7 @@ void CMapLoaderH3M::readBitmask(std::vector<bool>& dest, const int byteCount, co
|
||||
if(byte * 8 + bit < limit)
|
||||
{
|
||||
const bool flag = mask & (1 << bit);
|
||||
if((negate && flag) || (!negate && !flag))
|
||||
if((negate && flag) || (!negate && !flag)) // FIXME: check PR388
|
||||
dest[byte * 8 + bit] = false;
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class CTileInfo;
|
||||
|
||||
typedef std::vector<JsonNode> JsonVector;
|
||||
|
||||
class rmgException : std::exception
|
||||
class rmgException : public std::exception
|
||||
{
|
||||
std::string msg;
|
||||
public:
|
||||
|
@ -117,7 +117,10 @@ void CRmgTemplateStorage::loadObject(std::string scope, std::string name, const
|
||||
else if (monsterStrength == "strong")
|
||||
zone->setMonsterStrength(EMonsterStrength::ZONE_STRONG);
|
||||
else
|
||||
{
|
||||
delete zone;
|
||||
throw (rmgException("incorrect monster power"));
|
||||
}
|
||||
|
||||
if (!zoneNode["mines"].isNull())
|
||||
{
|
||||
|
@ -287,7 +287,7 @@ void CZonePlacer::attractConnectedZones(TZoneMap &zones, TForceVector &forces, T
|
||||
{
|
||||
//WARNING: compiler used to 'optimize' that line so it never actually worked
|
||||
float overlapMultiplier = (pos.z == otherZoneCenter.z) ? (minDistance / distance) : 1.0f;
|
||||
forceVector += (((otherZoneCenter - pos)* overlapMultiplier / getDistance(distance))) * gravityConstant; //positive value
|
||||
forceVector += ((otherZoneCenter - pos)* overlapMultiplier / getDistance(distance)) * gravityConstant; //positive value
|
||||
totalDistance += (distance - minDistance);
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,8 @@ void CPregameServer::run()
|
||||
if(state != RUNNING)
|
||||
{
|
||||
logNetwork->info("Stopping listening for connections...");
|
||||
acceptor->close();
|
||||
if(acceptor)
|
||||
acceptor->close();
|
||||
}
|
||||
|
||||
if(acceptor)
|
||||
|
Loading…
Reference in New Issue
Block a user