mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix some of the new warnings from sonarcloud
This commit is contained in:
parent
1fc0267ad1
commit
a8e84c55f6
@ -58,7 +58,7 @@ void DamageCache::buildObstacleDamageCache(std::shared_ptr<HypotheticBattle> hb,
|
|||||||
return u->alive() && !u->isTurret() && u->getPosition().isValid();
|
return u->alive() && !u->isTurret() && u->getPosition().isValid();
|
||||||
});
|
});
|
||||||
|
|
||||||
std::shared_ptr<HypotheticBattle> inner = std::make_shared<HypotheticBattle>(hb->env, hb);
|
auto inner = std::make_shared<HypotheticBattle>(hb->env, hb);
|
||||||
|
|
||||||
for(auto stack : stacks)
|
for(auto stack : stacks)
|
||||||
{
|
{
|
||||||
|
@ -649,12 +649,12 @@ void AIGateway::showBlockingDialog(const std::string & text, const std::vector<C
|
|||||||
auto danger = nullkiller->dangerEvaluator->evaluateDanger(target, hero.get());
|
auto danger = nullkiller->dangerEvaluator->evaluateDanger(target, hero.get());
|
||||||
auto ratio = static_cast<float>(danger) / hero->getTotalStrength();
|
auto ratio = static_cast<float>(danger) / hero->getTotalStrength();
|
||||||
|
|
||||||
answer = 1;
|
answer = true;
|
||||||
|
|
||||||
if(topObj->id != goalObjectID && nullkiller->dangerEvaluator->evaluateDanger(topObj) > 0)
|
if(topObj->id != goalObjectID && nullkiller->dangerEvaluator->evaluateDanger(topObj) > 0)
|
||||||
{
|
{
|
||||||
// no if we do not aim to visit this object
|
// no if we do not aim to visit this object
|
||||||
answer = 0;
|
answer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logAi->trace("Query hook: %s(%s) by %s danger ratio %f", target.toString(), topObj->getObjectName(), hero.name(), ratio);
|
logAi->trace("Query hook: %s(%s) by %s danger ratio %f", target.toString(), topObj->getObjectName(), hero.name(), ratio);
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include "Rules/AIMovementAfterDestinationRule.h"
|
#include "Rules/AIMovementAfterDestinationRule.h"
|
||||||
#include "Rules/AIMovementToDestinationRule.h"
|
#include "Rules/AIMovementToDestinationRule.h"
|
||||||
#include "Rules/AIPreviousNodeRule.h"
|
#include "Rules/AIPreviousNodeRule.h"
|
||||||
#include "../Engine//Nullkiller.h"
|
#include "../Engine/Nullkiller.h"
|
||||||
|
|
||||||
#include "../../../lib/pathfinder/CPathfinder.h"
|
#include "../../../lib/pathfinder/CPathfinder.h"
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ ExchangeResult HeroActor::tryExchangeNoLock(const ChainActor * specialActor, con
|
|||||||
return &actor == specialActor;
|
return &actor == specialActor;
|
||||||
});
|
});
|
||||||
|
|
||||||
result.actor = &(dynamic_cast<HeroActor *>(result.actor)->specialActors[index]);
|
result.actor = &(dynamic_cast<HeroActor *>(result.actor)->specialActors.at(index));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ public:
|
|||||||
static const int SPECIAL_ACTORS_COUNT = 7;
|
static const int SPECIAL_ACTORS_COUNT = 7;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ChainActor specialActors[SPECIAL_ACTORS_COUNT];
|
std::array<ChainActor, SPECIAL_ACTORS_COUNT> specialActors;
|
||||||
std::unique_ptr<HeroExchangeMap> exchangeMap;
|
std::unique_ptr<HeroExchangeMap> exchangeMap;
|
||||||
|
|
||||||
void setupSpecialActors();
|
void setupSpecialActors();
|
||||||
|
@ -158,7 +158,7 @@ public:
|
|||||||
friend class CBattleCallback; //handling players actions
|
friend class CBattleCallback; //handling players actions
|
||||||
|
|
||||||
void changeSpells(const CGHeroInstance * hero, bool give, const std::set<SpellID> & spells) override {};
|
void changeSpells(const CGHeroInstance * hero, bool give, const std::set<SpellID> & spells) override {};
|
||||||
void setResearchedSpells(const CGTownInstance * town, int level, const std::vector<SpellID> spells, bool accepted) override {};
|
void setResearchedSpells(const CGTownInstance * town, int level, const std::vector<SpellID> & spells, bool accepted) override {};
|
||||||
bool removeObject(const CGObjectInstance * obj, const PlayerColor & initiator) override {return false;};
|
bool removeObject(const CGObjectInstance * obj, const PlayerColor & initiator) override {return false;};
|
||||||
void createBoat(const int3 & visitablePosition, BoatId type, PlayerColor initiator) override {};
|
void createBoat(const int3 & visitablePosition, BoatId type, PlayerColor initiator) override {};
|
||||||
void setOwner(const CGObjectInstance * obj, PlayerColor owner) override {};
|
void setOwner(const CGObjectInstance * obj, PlayerColor owner) override {};
|
||||||
|
@ -24,7 +24,7 @@ PlayerLocalState::PlayerLocalState(CPlayerInterface & owner)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const PlayerSpellbookSetting & PlayerLocalState::getSpellbookSettings()
|
const PlayerSpellbookSetting & PlayerLocalState::getSpellbookSettings() const
|
||||||
{
|
{
|
||||||
return spellbookSettings;
|
return spellbookSettings;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
void setHeroAsleep(const CGHeroInstance * hero);
|
void setHeroAsleep(const CGHeroInstance * hero);
|
||||||
void setHeroAwaken(const CGHeroInstance * hero);
|
void setHeroAwaken(const CGHeroInstance * hero);
|
||||||
|
|
||||||
const PlayerSpellbookSetting & getSpellbookSettings();
|
const PlayerSpellbookSetting & getSpellbookSettings() const;
|
||||||
void setSpellbookSettings(const PlayerSpellbookSetting & newSettings);
|
void setSpellbookSettings(const PlayerSpellbookSetting & newSettings);
|
||||||
|
|
||||||
const std::vector<const CGTownInstance *> & getOwnedTowns();
|
const std::vector<const CGTownInstance *> & getOwnedTowns();
|
||||||
|
@ -545,7 +545,7 @@ std::pair<std::unique_ptr<ui8 []>, si64> CAudioInstance::extractAudio(const Vide
|
|||||||
frameSamplesBuffer.resize(std::max(frameSamplesBuffer.size(), bytesToRead));
|
frameSamplesBuffer.resize(std::max(frameSamplesBuffer.size(), bytesToRead));
|
||||||
uint8_t * frameSamplesPtr = frameSamplesBuffer.data();
|
uint8_t * frameSamplesPtr = frameSamplesBuffer.data();
|
||||||
|
|
||||||
int result = swr_convert(swr_ctx, &frameSamplesPtr, frame->nb_samples, (const uint8_t **)frame->data, frame->nb_samples);
|
int result = swr_convert(swr_ctx, &frameSamplesPtr, frame->nb_samples, const_cast<const uint8_t **>(frame->data), frame->nb_samples);
|
||||||
|
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
throwFFmpegError(result);
|
throwFFmpegError(result);
|
||||||
|
@ -158,7 +158,7 @@ void AssetGenerator::createPlayerColoredBackground(const PlayerColor & player)
|
|||||||
assert(player.isValidPlayer());
|
assert(player.isValidPlayer());
|
||||||
if (!player.isValidPlayer())
|
if (!player.isValidPlayer())
|
||||||
{
|
{
|
||||||
logGlobal->error("Unable to colorize to invalid player color %d!", static_cast<int>(player.getNum()));
|
logGlobal->error("Unable to colorize to invalid player color %d!", player.getNum());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,9 +64,9 @@ int CTrueTypeFont::getFontStyle(const JsonNode &config) const
|
|||||||
CTrueTypeFont::CTrueTypeFont(const JsonNode & fontConfig):
|
CTrueTypeFont::CTrueTypeFont(const JsonNode & fontConfig):
|
||||||
data(loadData(fontConfig)),
|
data(loadData(fontConfig)),
|
||||||
font(loadFont(fontConfig), TTF_CloseFont),
|
font(loadFont(fontConfig), TTF_CloseFont),
|
||||||
dropShadow(!fontConfig["noShadow"].Bool()),
|
blended(true),
|
||||||
outline(fontConfig["outline"].Bool()),
|
outline(fontConfig["outline"].Bool()),
|
||||||
blended(true)
|
dropShadow(!fontConfig["noShadow"].Bool())
|
||||||
{
|
{
|
||||||
assert(font);
|
assert(font);
|
||||||
|
|
||||||
@ -95,14 +95,14 @@ size_t CTrueTypeFont::getLineHeightScaled() const
|
|||||||
return TTF_FontHeight(font.get());
|
return TTF_FontHeight(font.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t CTrueTypeFont::getGlyphWidthScaled(const char *data) const
|
size_t CTrueTypeFont::getGlyphWidthScaled(const char *text) const
|
||||||
{
|
{
|
||||||
return getStringWidthScaled(std::string(data, TextOperations::getUnicodeCharacterSize(*data)));
|
return getStringWidthScaled(std::string(text, TextOperations::getUnicodeCharacterSize(*text)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CTrueTypeFont::canRepresentCharacter(const char * data) const
|
bool CTrueTypeFont::canRepresentCharacter(const char * text) const
|
||||||
{
|
{
|
||||||
uint32_t codepoint = TextOperations::getUnicodeCodepoint(data, TextOperations::getUnicodeCharacterSize(*data));
|
uint32_t codepoint = TextOperations::getUnicodeCodepoint(text, TextOperations::getUnicodeCharacterSize(*text));
|
||||||
#if SDL_TTF_VERSION_ATLEAST(2, 0, 18)
|
#if SDL_TTF_VERSION_ATLEAST(2, 0, 18)
|
||||||
return TTF_GlyphIsProvided32(font.get(), codepoint);
|
return TTF_GlyphIsProvided32(font.get(), codepoint);
|
||||||
#elif SDL_TTF_VERSION_ATLEAST(2, 0, 12)
|
#elif SDL_TTF_VERSION_ATLEAST(2, 0, 12)
|
||||||
@ -114,10 +114,10 @@ bool CTrueTypeFont::canRepresentCharacter(const char * data) const
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t CTrueTypeFont::getStringWidthScaled(const std::string & data) const
|
size_t CTrueTypeFont::getStringWidthScaled(const std::string & text) const
|
||||||
{
|
{
|
||||||
int width;
|
int width;
|
||||||
TTF_SizeUTF8(font.get(), data.c_str(), &width, nullptr);
|
TTF_SizeUTF8(font.get(), text.c_str(), &width, nullptr);
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ void CMultiLineLabel::splitText(const std::string & Txt, bool redrawAfter)
|
|||||||
lines.clear();
|
lines.clear();
|
||||||
|
|
||||||
const auto & fontPtr = GH.renderHandler().loadFont(font);
|
const auto & fontPtr = GH.renderHandler().loadFont(font);
|
||||||
int lineHeight = static_cast<int>(fontPtr->getLineHeight());
|
int lineHeight = fontPtr->getLineHeight();
|
||||||
|
|
||||||
lines = CMessage::breakText(Txt, pos.w, font);
|
lines = CMessage::breakText(Txt, pos.w, font);
|
||||||
|
|
||||||
@ -330,16 +330,16 @@ Rect CMultiLineLabel::getTextLocation()
|
|||||||
return pos;
|
return pos;
|
||||||
|
|
||||||
const auto & fontPtr = GH.renderHandler().loadFont(font);
|
const auto & fontPtr = GH.renderHandler().loadFont(font);
|
||||||
Point textSize(pos.w, fontPtr->getLineHeight() * (int)lines.size());
|
Point textSizeComputed(pos.w, fontPtr->getLineHeight() * lines.size()); //FIXME: how is this different from textSize member?
|
||||||
Point textOffset(pos.w - textSize.x, pos.h - textSize.y);
|
Point textOffset(pos.w - textSizeComputed.x, pos.h - textSizeComputed.y);
|
||||||
|
|
||||||
switch(alignment)
|
switch(alignment)
|
||||||
{
|
{
|
||||||
case ETextAlignment::TOPLEFT: return Rect(pos.topLeft(), textSize);
|
case ETextAlignment::TOPLEFT: return Rect(pos.topLeft(), textSizeComputed);
|
||||||
case ETextAlignment::TOPCENTER: return Rect(pos.topLeft(), textSize);
|
case ETextAlignment::TOPCENTER: return Rect(pos.topLeft(), textSizeComputed);
|
||||||
case ETextAlignment::CENTER: return Rect(pos.topLeft() + textOffset / 2, textSize);
|
case ETextAlignment::CENTER: return Rect(pos.topLeft() + textOffset / 2, textSizeComputed);
|
||||||
case ETextAlignment::CENTERRIGHT: return Rect(pos.topLeft() + Point(textOffset.x, textOffset.y / 2), textSize);
|
case ETextAlignment::CENTERRIGHT: return Rect(pos.topLeft() + Point(textOffset.x, textOffset.y / 2), textSizeComputed);
|
||||||
case ETextAlignment::BOTTOMRIGHT: return Rect(pos.topLeft() + textOffset, textSize);
|
case ETextAlignment::BOTTOMRIGHT: return Rect(pos.topLeft() + textOffset, textSizeComputed);
|
||||||
}
|
}
|
||||||
assert(0);
|
assert(0);
|
||||||
return Rect();
|
return Rect();
|
||||||
|
@ -2007,10 +2007,10 @@ void CMageGuildScreen::updateSpells(ObjectInstanceID tID)
|
|||||||
|
|
||||||
const CGTownInstance * town = LOCPLINT->cb->getTown(townId);
|
const CGTownInstance * town = LOCPLINT->cb->getTown(townId);
|
||||||
|
|
||||||
for(size_t i=0; i<town->getTown()->mageLevel; i++)
|
for(uint32_t i=0; i<town->getTown()->mageLevel; i++)
|
||||||
{
|
{
|
||||||
size_t spellCount = town->spellsAtLevel((int)i+1,false); //spell at level with -1 hmmm?
|
uint32_t spellCount = town->spellsAtLevel(i+1,false); //spell at level with -1 hmmm?
|
||||||
for(size_t j=0; j<spellCount; j++)
|
for(uint32_t j=0; j<spellCount; j++)
|
||||||
{
|
{
|
||||||
if(i<town->mageGuildLevel() && town->spells[i].size()>j)
|
if(i<town->mageGuildLevel() && town->spells[i].size()>j)
|
||||||
spells.push_back(std::make_shared<Scroll>(positions[i][j], town->spells[i][j].toSpell(), townId));
|
spells.push_back(std::make_shared<Scroll>(positions[i][j], town->spells[i][j].toSpell(), townId));
|
||||||
@ -2063,7 +2063,6 @@ void CMageGuildScreen::Scroll::clickPressed(const Point & cursorPosition)
|
|||||||
resComps.push_back(std::make_shared<CComponent>(ComponentType::RESOURCE, i->resType, i->resVal, CComponent::ESize::medium));
|
resComps.push_back(std::make_shared<CComponent>(ComponentType::RESOURCE, i->resType, i->resVal, CComponent::ESize::medium));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto showSpellResearchDialog = [this, resComps, town, cost, newSpell](){
|
|
||||||
std::vector<std::pair<AnimationPath, CFunctionList<void()>>> pom;
|
std::vector<std::pair<AnimationPath, CFunctionList<void()>>> pom;
|
||||||
for(int i = 0; i < 3; i++)
|
for(int i = 0; i < 3; i++)
|
||||||
pom.emplace_back(AnimationPath::builtin("settingsWindow/button80"), nullptr);
|
pom.emplace_back(AnimationPath::builtin("settingsWindow/button80"), nullptr);
|
||||||
@ -2084,9 +2083,6 @@ void CMageGuildScreen::Scroll::clickPressed(const Point & cursorPosition)
|
|||||||
temp->buttons[2]->addPopupCallback([](){ CRClickPopup::createAndPush(CGI->generaltexth->translate("vcmi.spellResearch.abort")); });
|
temp->buttons[2]->addPopupCallback([](){ CRClickPopup::createAndPush(CGI->generaltexth->translate("vcmi.spellResearch.abort")); });
|
||||||
|
|
||||||
GH.windows().pushWindow(temp);
|
GH.windows().pushWindow(temp);
|
||||||
};
|
|
||||||
|
|
||||||
showSpellResearchDialog();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
LOCPLINT->showInfoDialog(spell->getDescriptionTranslated(0), std::make_shared<CComponent>(ComponentType::SPELL, spell->id));
|
LOCPLINT->showInfoDialog(spell->getDescriptionTranslated(0), std::make_shared<CComponent>(ComponentType::SPELL, spell->id));
|
||||||
|
@ -1611,7 +1611,7 @@ void CObjectListWindow::keyPressed(EShortcut key)
|
|||||||
changeSelection(sel);
|
changeSelection(sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoWindow::VideoWindow(VideoPath video, ImagePath rim, bool showBackground, float scaleFactor, std::function<void(bool skipped)> closeCb)
|
VideoWindow::VideoWindow(const VideoPath & video, const ImagePath & rim, bool showBackground, float scaleFactor, const std::function<void(bool skipped)> & closeCb)
|
||||||
: CWindowObject(BORDERED | SHADOW_DISABLED | NEEDS_ANIMATED_BACKGROUND), closeCb(closeCb)
|
: CWindowObject(BORDERED | SHADOW_DISABLED | NEEDS_ANIMATED_BACKGROUND), closeCb(closeCb)
|
||||||
{
|
{
|
||||||
OBJECT_CONSTRUCTION;
|
OBJECT_CONSTRUCTION;
|
||||||
|
@ -513,7 +513,7 @@ class VideoWindow : public CWindowObject
|
|||||||
|
|
||||||
void exit(bool skipped);
|
void exit(bool skipped);
|
||||||
public:
|
public:
|
||||||
VideoWindow(VideoPath video, ImagePath rim, bool showBackground, float scaleFactor, std::function<void(bool)> closeCb);
|
VideoWindow(const VideoPath & video, const ImagePath & rim, bool showBackground, float scaleFactor, const std::function<void(bool)> & closeCb);
|
||||||
|
|
||||||
void clickPressed(const Point & cursorPosition) override;
|
void clickPressed(const Point & cursorPosition) override;
|
||||||
void keyPressed(EShortcut key) override;
|
void keyPressed(EShortcut key) override;
|
||||||
|
@ -187,11 +187,6 @@ bool CRClickPopup::isPopupWindow() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRClickPopup::close()
|
|
||||||
{
|
|
||||||
WindowBase::close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRClickPopup::createAndPush(const std::string & txt, const CInfoWindow::TCompsInfo & comps)
|
void CRClickPopup::createAndPush(const std::string & txt, const CInfoWindow::TCompsInfo & comps)
|
||||||
{
|
{
|
||||||
PlayerColor player = LOCPLINT ? LOCPLINT->playerID : PlayerColor(1); //if no player, then use blue
|
PlayerColor player = LOCPLINT ? LOCPLINT->playerID : PlayerColor(1); //if no player, then use blue
|
||||||
|
@ -64,7 +64,6 @@ public:
|
|||||||
class CRClickPopup : public WindowBase
|
class CRClickPopup : public WindowBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void close() override;
|
|
||||||
bool isPopupWindow() const override;
|
bool isPopupWindow() const override;
|
||||||
|
|
||||||
static std::shared_ptr<WindowBase> createCustomInfoWindow(Point position, const CGObjectInstance * specific);
|
static std::shared_ptr<WindowBase> createCustomInfoWindow(Point position, const CGObjectInstance * specific);
|
||||||
|
@ -22,9 +22,9 @@ VCMI_LIB_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
PlayerState::PlayerState()
|
PlayerState::PlayerState()
|
||||||
: color(-1)
|
: color(-1)
|
||||||
, playerLocalSettings(std::make_unique<JsonNode>())
|
|
||||||
, human(false)
|
, human(false)
|
||||||
, cheated(false)
|
, cheated(false)
|
||||||
|
, playerLocalSettings(std::make_unique<JsonNode>())
|
||||||
, enteredWinningCheatCode(false)
|
, enteredWinningCheatCode(false)
|
||||||
, enteredLosingCheatCode(false)
|
, enteredLosingCheatCode(false)
|
||||||
, status(EPlayerStatus::INGAME)
|
, status(EPlayerStatus::INGAME)
|
||||||
|
@ -94,7 +94,7 @@ public:
|
|||||||
virtual void showInfoDialog(InfoWindow * iw) = 0;
|
virtual void showInfoDialog(InfoWindow * iw) = 0;
|
||||||
|
|
||||||
virtual void changeSpells(const CGHeroInstance * hero, bool give, const std::set<SpellID> &spells)=0;
|
virtual void changeSpells(const CGHeroInstance * hero, bool give, const std::set<SpellID> &spells)=0;
|
||||||
virtual void setResearchedSpells(const CGTownInstance * town, int level, const std::vector<SpellID> spells, bool accepted)=0;
|
virtual void setResearchedSpells(const CGTownInstance * town, int level, const std::vector<SpellID> & spells, bool accepted)=0;
|
||||||
virtual bool removeObject(const CGObjectInstance * obj, const PlayerColor & initiator) = 0;
|
virtual bool removeObject(const CGObjectInstance * obj, const PlayerColor & initiator) = 0;
|
||||||
virtual void createBoat(const int3 & visitablePosition, BoatId type, PlayerColor initiator) = 0;
|
virtual void createBoat(const int3 & visitablePosition, BoatId type, PlayerColor initiator) = 0;
|
||||||
virtual void setOwner(const CGObjectInstance * objid, PlayerColor owner)=0;
|
virtual void setOwner(const CGObjectInstance * objid, PlayerColor owner)=0;
|
||||||
|
@ -74,7 +74,7 @@ static int getLevenshteinDistance(const std::string & s, const std::string & t)
|
|||||||
|
|
||||||
/// Searches for keys similar to 'target' in 'candidates' map
|
/// Searches for keys similar to 'target' in 'candidates' map
|
||||||
/// Returns closest match or empty string if no suitable candidates are found
|
/// Returns closest match or empty string if no suitable candidates are found
|
||||||
static std::string findClosestMatch(JsonMap candidates, std::string target)
|
static std::string findClosestMatch(const JsonMap & candidates, const std::string & target)
|
||||||
{
|
{
|
||||||
// Maximum distance at which we can consider strings to be similar
|
// Maximum distance at which we can consider strings to be similar
|
||||||
// If strings have more different symbols than this number then it is not a typo, but a completely different word
|
// If strings have more different symbols than this number then it is not a typo, but a completely different word
|
||||||
|
@ -197,8 +197,8 @@ void ContentTypeHandler::afterLoadFinalization()
|
|||||||
std::set<std::string> conflictingMods;
|
std::set<std::string> conflictingMods;
|
||||||
std::set<std::string> resolvedConflicts;
|
std::set<std::string> resolvedConflicts;
|
||||||
|
|
||||||
for (auto const & conflictModData : conflictModData.Struct())
|
for (auto const & conflictModEntry: conflictModData.Struct())
|
||||||
conflictingMods.insert(conflictModData.first);
|
conflictingMods.insert(conflictModEntry.first);
|
||||||
|
|
||||||
for (auto const & modID : conflictingMods)
|
for (auto const & modID : conflictingMods)
|
||||||
resolvedConflicts.merge(VLC->modh->getModDependencies(modID));
|
resolvedConflicts.merge(VLC->modh->getModDependencies(modID));
|
||||||
|
@ -152,11 +152,9 @@ void TextLocalizationContainer::exportAllTexts(std::map<std::string, std::map<st
|
|||||||
std::string textToWrite;
|
std::string textToWrite;
|
||||||
std::string modName = entry.second.baseStringModContext;
|
std::string modName = entry.second.baseStringModContext;
|
||||||
|
|
||||||
if (entry.second.baseStringModContext == entry.second.identifierModContext)
|
if (entry.second.baseStringModContext == entry.second.identifierModContext && modName.find('.') != std::string::npos)
|
||||||
{
|
|
||||||
if (modName.find('.') != std::string::npos)
|
|
||||||
modName = modName.substr(0, modName.find('.'));
|
modName = modName.substr(0, modName.find('.'));
|
||||||
}
|
|
||||||
boost::range::replace(modName, '.', '_');
|
boost::range::replace(modName, '.', '_');
|
||||||
|
|
||||||
textToWrite = entry.second.translatedText;
|
textToWrite = entry.second.translatedText;
|
||||||
|
@ -1253,7 +1253,7 @@ void CGameHandler::changeSpells(const CGHeroInstance * hero, bool give, const st
|
|||||||
sendAndApply(cs);
|
sendAndApply(cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameHandler::setResearchedSpells(const CGTownInstance * town, int level, const std::vector<SpellID> spells, bool accepted)
|
void CGameHandler::setResearchedSpells(const CGTownInstance * town, int level, const std::vector<SpellID> & spells, bool accepted)
|
||||||
{
|
{
|
||||||
SetResearchedSpells cs;
|
SetResearchedSpells cs;
|
||||||
cs.tid = town->id;
|
cs.tid = town->id;
|
||||||
|
@ -107,7 +107,7 @@ public:
|
|||||||
//from IGameCallback
|
//from IGameCallback
|
||||||
//do sth
|
//do sth
|
||||||
void changeSpells(const CGHeroInstance * hero, bool give, const std::set<SpellID> &spells) override;
|
void changeSpells(const CGHeroInstance * hero, bool give, const std::set<SpellID> &spells) override;
|
||||||
void setResearchedSpells(const CGTownInstance * town, int level, const std::vector<SpellID> spells, bool accepted) override;
|
void setResearchedSpells(const CGTownInstance * town, int level, const std::vector<SpellID> & spells, bool accepted) override;
|
||||||
bool removeObject(const CGObjectInstance * obj, const PlayerColor & initiator) override;
|
bool removeObject(const CGObjectInstance * obj, const PlayerColor & initiator) override;
|
||||||
void setOwner(const CGObjectInstance * obj, PlayerColor owner) override;
|
void setOwner(const CGObjectInstance * obj, PlayerColor owner) override;
|
||||||
void giveExperience(const CGHeroInstance * hero, TExpType val) override;
|
void giveExperience(const CGHeroInstance * hero, TExpType val) override;
|
||||||
|
@ -299,18 +299,13 @@ void CVCMIServer::onDisconnected(const std::shared_ptr<INetworkConnection> & con
|
|||||||
std::shared_ptr<CConnection> c = findConnection(connection);
|
std::shared_ptr<CConnection> c = findConnection(connection);
|
||||||
|
|
||||||
// player may have already disconnected via clientDisconnected call
|
// player may have already disconnected via clientDisconnected call
|
||||||
if (c)
|
if (c && gh && getState() == EServerState::GAMEPLAY)
|
||||||
{
|
|
||||||
//clientDisconnected(c);
|
|
||||||
|
|
||||||
if(gh && getState() == EServerState::GAMEPLAY)
|
|
||||||
{
|
{
|
||||||
LobbyClientDisconnected lcd;
|
LobbyClientDisconnected lcd;
|
||||||
lcd.c = c;
|
lcd.c = c;
|
||||||
lcd.clientId = c->connectionID;
|
lcd.clientId = c->connectionID;
|
||||||
handleReceivedPack(lcd);
|
handleReceivedPack(lcd);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVCMIServer::handleReceivedPack(CPackForLobby & pack)
|
void CVCMIServer::handleReceivedPack(CPackForLobby & pack)
|
||||||
|
@ -50,7 +50,6 @@ void MapObjectVisitQuery::onRemoval(PlayerColor color)
|
|||||||
{
|
{
|
||||||
gh->objectVisitEnded(visitingHero, players.front());
|
gh->objectVisitEnded(visitingHero, players.front());
|
||||||
|
|
||||||
//TODO or should it be destructor?
|
|
||||||
//Can object visit affect 2 players and what would be desired behavior?
|
//Can object visit affect 2 players and what would be desired behavior?
|
||||||
if(removeObjectAfterVisit)
|
if(removeObjectAfterVisit)
|
||||||
gh->removeObject(visitedObject, color);
|
gh->removeObject(visitedObject, color);
|
||||||
@ -78,7 +77,7 @@ void TownBuildingVisitQuery::onAdded(PlayerColor color)
|
|||||||
while (!visitedBuilding.empty() && owner->topQuery(color).get() == this)
|
while (!visitedBuilding.empty() && owner->topQuery(color).get() == this)
|
||||||
{
|
{
|
||||||
visitingHero = visitedBuilding.back().hero;
|
visitingHero = visitedBuilding.back().hero;
|
||||||
auto * building = visitedTown->rewardableBuildings.at(visitedBuilding.back().building);
|
const auto * building = visitedTown->rewardableBuildings.at(visitedBuilding.back().building);
|
||||||
building->onHeroVisit(visitingHero);
|
building->onHeroVisit(visitingHero);
|
||||||
visitedBuilding.pop_back();
|
visitedBuilding.pop_back();
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
void showInfoDialog(InfoWindow * iw) override {}
|
void showInfoDialog(InfoWindow * iw) override {}
|
||||||
|
|
||||||
void changeSpells(const CGHeroInstance * hero, bool give, const std::set<SpellID> &spells) override {}
|
void changeSpells(const CGHeroInstance * hero, bool give, const std::set<SpellID> &spells) override {}
|
||||||
void setResearchedSpells(const CGTownInstance * town, int level, const std::vector<SpellID> spells, bool accepted) override {}
|
void setResearchedSpells(const CGTownInstance * town, int level, const std::vector<SpellID> & spells, bool accepted) override {}
|
||||||
bool removeObject(const CGObjectInstance * obj, const PlayerColor & initiator) override {return false;}
|
bool removeObject(const CGObjectInstance * obj, const PlayerColor & initiator) override {return false;}
|
||||||
void createBoat(const int3 & visitablePosition, BoatId type, PlayerColor initiator) override {}
|
void createBoat(const int3 & visitablePosition, BoatId type, PlayerColor initiator) override {}
|
||||||
void setOwner(const CGObjectInstance * objid, PlayerColor owner) override {}
|
void setOwner(const CGObjectInstance * objid, PlayerColor owner) override {}
|
||||||
|
Loading…
Reference in New Issue
Block a user