diff --git a/Mods/vcmi/config/vcmi/english.json b/Mods/vcmi/config/vcmi/english.json index 18e6641f1..b62ee25d2 100644 --- a/Mods/vcmi/config/vcmi/english.json +++ b/Mods/vcmi/config/vcmi/english.json @@ -21,6 +21,7 @@ "vcmi.adventureMap.playerAttacked" : "Player has been attacked: %s", "vcmi.adventureMap.moveCostDetails" : "Movement points - Cost: %TURNS turns + %POINTS points, Remaining points: %REMAINING", "vcmi.adventureMap.moveCostDetailsNoTurns" : "Movement points - Cost: %POINTS points, Remaining points: %REMAINING", + "vcmi.adventureMap.movementPointsHeroInfo" : "(Movement points: %REMAINING / %POINTS)", "vcmi.adventureMap.replayOpponentTurnNotImplemented" : "Sorry, replay opponent turn is not implemented yet!", "vcmi.capitalColors.0" : "Red", diff --git a/Mods/vcmi/config/vcmi/polish.json b/Mods/vcmi/config/vcmi/polish.json index 1ab65c8e3..2f8d0ce87 100644 --- a/Mods/vcmi/config/vcmi/polish.json +++ b/Mods/vcmi/config/vcmi/polish.json @@ -20,6 +20,7 @@ "vcmi.adventureMap.playerAttacked" : "Gracz został zaatakowany: %s", "vcmi.adventureMap.moveCostDetails" : "Punkty ruchu - Koszt: %TURNS tury + %POINTS punktów, Pozostanie: %REMAINING punktów", "vcmi.adventureMap.moveCostDetailsNoTurns" : "Punkty ruchu - Koszt: %POINTS punktów, Pozostanie: %REMAINING punktów", + "vcmi.adventureMap.movementPointsHeroInfo" : "(Punkty ruchu: %REMAINING / %POINTS)", "vcmi.adventureMap.replayOpponentTurnNotImplemented" : "Wybacz, powtórka ruchu wroga nie została jeszcze zaimplementowana!", "vcmi.capitalColors.0" : "Czerwony", diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index 57eb5b29e..802364f6b 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -171,10 +171,11 @@ void CPlayerInterface::initGameInterface(std::shared_ptr ENV, std:: void CPlayerInterface::closeAllDialogs() { // remove all active dialogs that do not expect query answer - for (;;) + while(true) { auto adventureWindow = GH.windows().topWindow(); auto infoWindow = GH.windows().topWindow(); + auto topWindow = GH.windows().topWindow(); if(adventureWindow != nullptr) break; @@ -182,16 +183,8 @@ void CPlayerInterface::closeAllDialogs() if(infoWindow && infoWindow->ID != QueryID::NONE) break; - if (infoWindow) - infoWindow->close(); - else - GH.windows().popWindows(1); + topWindow->close(); } - - if(castleInt) - castleInt->close(); - - castleInt = nullptr; } void CPlayerInterface::playerEndsTurn(PlayerColor player) @@ -1460,6 +1453,7 @@ void CPlayerInterface::playerBlocked(int reason, bool start) cmp.push_back(std::make_shared(ComponentType::FLAG, playerID)); makingTurn = true; //workaround for stiff showInfoDialog implementation showInfoDialog(msg, cmp); + waitWhileDialog(); makingTurn = false; } } diff --git a/client/adventureMap/AdventureMapInterface.cpp b/client/adventureMap/AdventureMapInterface.cpp index b8c71884e..020f4a323 100644 --- a/client/adventureMap/AdventureMapInterface.cpp +++ b/client/adventureMap/AdventureMapInterface.cpp @@ -557,7 +557,8 @@ void AdventureMapInterface::onTileLeftClicked(const int3 &targetPosition) else //still here? we need to move hero if we clicked end of already selected path or calculate a new path otherwise { if(LOCPLINT->localState->hasPath(currentHero) && - LOCPLINT->localState->getPath(currentHero).endPos() == targetPosition)//we'll be moving + LOCPLINT->localState->getPath(currentHero).endPos() == targetPosition && + !GH.isKeyboardShiftDown())//we'll be moving { assert(!CGI->mh->hasOngoingAnimations()); if(!CGI->mh->hasOngoingAnimations() && LOCPLINT->localState->getPath(currentHero).nextNode().turns == 0) diff --git a/client/adventureMap/CList.cpp b/client/adventureMap/CList.cpp index a563f34f4..5c46a510a 100644 --- a/client/adventureMap/CList.cpp +++ b/client/adventureMap/CList.cpp @@ -266,7 +266,7 @@ void CHeroList::CHeroItem::showTooltip() std::string CHeroList::CHeroItem::getHoverText() { - return boost::str(boost::format(CGI->generaltexth->allTexts[15]) % hero->getNameTranslated() % hero->getClassNameTranslated()); + return boost::str(boost::format(CGI->generaltexth->allTexts[15]) % hero->getNameTranslated() % hero->getClassNameTranslated()) + hero->getMovementPointsTextIfOwner(hero->getOwner()); } void CHeroList::CHeroItem::gesture(bool on, const Point & initialPosition, const Point & finalPosition) diff --git a/client/gui/CIntObject.cpp b/client/gui/CIntObject.cpp index 7dc4dff85..3535985f1 100644 --- a/client/gui/CIntObject.cpp +++ b/client/gui/CIntObject.cpp @@ -343,6 +343,6 @@ WindowBase::WindowBase(int used_, Point pos_) void WindowBase::close() { if(!GH.windows().isTopWindow(this)) - logGlobal->error("Only top interface must be closed"); + throw std::runtime_error("Only top interface can be closed"); GH.windows().popWindows(1); } diff --git a/client/gui/CIntObject.h b/client/gui/CIntObject.h index da3ebcdc8..700b7d990 100644 --- a/client/gui/CIntObject.h +++ b/client/gui/CIntObject.h @@ -148,7 +148,6 @@ class WindowBase : public CIntObject { public: WindowBase(int used_ = 0, Point pos_ = Point()); -protected: virtual void close(); }; diff --git a/config/schemas/faction.json b/config/schemas/faction.json index 841c03240..e25c286e4 100644 --- a/config/schemas/faction.json +++ b/config/schemas/faction.json @@ -96,7 +96,7 @@ "creatures" : { "type" : "array", "minItems" : 7, - "maxItems" : 7, + "maxItems" : 8, "description" : "List of creatures available for recruitment on each level", "items" : { "type" : "array", diff --git a/config/schemas/gameSettings.json b/config/schemas/gameSettings.json new file mode 100644 index 000000000..64e75dac2 --- /dev/null +++ b/config/schemas/gameSettings.json @@ -0,0 +1,151 @@ +{ + "type" : "object", + "$schema" : "http://json-schema.org/draft-04/schema", + "title" : "VCMI game settings format", + "description" : "Format used to define game settings in VCMI", + "additionalProperties" : false, + "properties" : { + "textData" : { + "type" : "object", + "additionalProperties" : false, + "properties" : { + "heroClass" : { "type" : "number" }, + "artifact" : { "type" : "number" }, + "creature" : { "type" : "number" }, + "faction" : { "type" : "number" }, + "hero" : { "type" : "number" }, + "spell" : { "type" : "number" }, + "object" : { "type" : "number" }, + "terrain" : { "type" : "number" }, + "river" : { "type" : "number" }, + "road" : { "type" : "number" } + } + }, + "mapFormat" : { + "type" : "object", + "additionalProperties" : false, + "properties" : { + "restorationOfErathia" : { "type" : "object" }, + "armageddonsBlade" : { "type" : "object" }, + "shadowOfDeath" : { "type" : "object" }, + "chronicles" : { "type" : "object" }, + "jsonVCMI" : { "type" : "object" }, + "hornOfTheAbyss" : { "type" : "object" }, + "inTheWakeOfGods" : { "type" : "object" } + } + }, + "heroes" : { + "type" : "object", + "additionalProperties" : false, + "properties" : { + "perPlayerOnMapCap" : { "type" : "number" }, + "perPlayerTotalCap" : { "type" : "number" }, + "retreatOnWinWithoutTroops" : { "type" : "boolean" }, + "startingStackChances" : { "type" : "array" }, + "backpackSize" : { "type" : "number" }, + "tavernInvite" : { "type" : "boolean" }, + "minimalPrimarySkills" : { "type" : "array" } + } + }, + "towns" : { + "type" : "object", + "additionalProperties" : false, + "properties" : { + "buildingsPerTurnCap" : { "type" : "number" }, + "startingDwellingChances" : { "type" : "array" } + } + }, + "combat": { + "type" : "object", + "additionalProperties" : false, + "properties" : { + "goodMoraleDice" : { "type" : "array" }, + "badMoraleDice" : { "type" : "array" }, + "goodLuckDice" : { "type" : "array" }, + "badLuckDice" : { "type" : "array" }, + "backpackSize" : { "type" : "number" }, + "attackPointDamageFactor" : { "type" : "number" }, + "attackPointDamageFactorCap" : { "type" : "number" }, + "defensePointDamageFactor" : { "type" : "number" }, + "defensePointDamageFactorCap" : { "type" : "number" }, + "oneHexTriggersObstacles" : { "type" : "boolean" }, + "layouts" : { "type" : "object" } + } + }, + "creatures": { + "type" : "object", + "additionalProperties" : false, + "properties" : { + "weeklyGrowthPercent" : { "type" : "number" }, + "weeklyGrowthCap" : { "type" : "number" }, + "dailyStackExperience" : { "type" : "number" }, + "allowRandomSpecialWeeks" : { "type" : "boolean" }, + "allowAllForDoubleMonth" : { "type" : "boolean" } + } + }, + "dwellings": { + "type" : "object", + "additionalProperties" : false, + "properties" : { + "accumulateWhenNeutral" : { "type" : "boolean" }, + "accumulateWhenOwned" : { "type" : "boolean" }, + "mergeOnRecruit" : { "type" : "boolean" } + } + }, + "markets": { + "type" : "object", + "additionalProperties" : false, + "properties" : { + "blackMarketRestockPeriod" : { "type" : "number" } + } + }, + "banks": { + "type" : "object", + "additionalProperties" : false, + "properties" : { + "showGuardsComposition" : { "type" : "boolean" } + } + }, + "modules": { + "type" : "object", + "additionalProperties" : false, + "properties" : { + "stackExperience" : { "type" : "boolean" }, + "stackArtifact" : { "type" : "boolean" }, + "commanders" : { "type" : "boolean" } + } + }, + "pathfinder": { + "type" : "object", + "additionalProperties" : false, + "properties" : { + "ignoreGuards" : { "type" : "boolean" }, + "useBoat" : { "type" : "boolean" }, + "useMonolithTwoWay" : { "type" : "boolean" }, + "useMonolithOneWayUnique" : { "type" : "boolean" }, + "useMonolithOneWayRandom" : { "type" : "boolean" }, + "useWhirlpool" : { "type" : "boolean" }, + "originalFlyRules" : { "type" : "boolean" } + } + }, + "spells": { + "type" : "object", + "additionalProperties" : false, + "properties" : { + "dimensionDoorOnlyToUncoveredTiles" : { "type" : "boolean" }, + "dimensionDoorExposesTerrainType" : { "type" : "boolean" }, + "dimensionDoorFailureSpendsPoints" : { "type" : "boolean" }, + "dimensionDoorTriggersGuards" : { "type" : "boolean" }, + "dimensionDoorTournamentRulesLimit" : { "type" : "boolean" } + } + }, + "bonuses": { + "type" : "object", + "additionalProperties" : false, + "properties" : { + "global" : { "type" : "object" }, + "perHero" : { "type" : "object" } + } + }, + } +} diff --git a/config/schemas/mod.json b/config/schemas/mod.json index e9ca88dd2..5c09ef74c 100644 --- a/config/schemas/mod.json +++ b/config/schemas/mod.json @@ -124,12 +124,7 @@ "settings" : { "type" : "object", "description" : "List of changed game settings by mod", - "additionalProperties" : { - "type" : "object", - "properties" : { - "type" : "object" - } - } + "$ref" : "gameSettings.json" }, "filesystem" : { "type" : "object", diff --git a/config/schemas/template.json b/config/schemas/template.json index aa43e4fbd..fc185815c 100644 --- a/config/schemas/template.json +++ b/config/schemas/template.json @@ -134,9 +134,7 @@ "settings" : { "description" : "List of changed game settings by template", "type" : "object", - "additionalProperties" : { - "type" : "object" - } + "$ref" : "gameSettings.json" }, "name" : { "description" : "Optional name - useful to have several template variations with same name", diff --git a/docs/Readme.md b/docs/Readme.md index 8b4a392c2..b50df62b8 100644 --- a/docs/Readme.md +++ b/docs/Readme.md @@ -52,12 +52,15 @@ Please see corresponding installation guide articles for details for your platfo - [Cheat codes](players/Cheat_Codes.md) - [Privacy Policy](players/Privacy_Policy.md) +## Documentation and guidelines for translators + +- [Translations](translators/Translations.md) + ## Documentation and guidelines for game modders - [Modding Guidelines](modders/Readme.md) - [Mod File Format](modders/Mod_File_Format.md) - [Bonus Format](modders/Bonus_Format.md) -- [Translations](modders/Translations.md) - [Map Editor](modders/Map_Editor.md) - [Campaign Format](modders/Campaign_Format.md) - [Configurable Widgets](modders/Configurable_Widgets.md) diff --git a/docs/modders/Translations.md b/docs/translators/Translations.md similarity index 99% rename from docs/modders/Translations.md rename to docs/translators/Translations.md index 7eeaa7ed9..89e6cbba8 100644 --- a/docs/modders/Translations.md +++ b/docs/translators/Translations.md @@ -33,6 +33,7 @@ The page will be automatically updated once a week. VCMI allows translating game data into languages other than English. In order to translate Heroes III in your language easiest approach is to: - Copy existing translation, such as English translation from here: https://github.com/vcmi-mods/h3-for-vcmi-englisation (delete sound and video folders) +- Copy text-free images from here: https://github.com/vcmi-mods/empty-translation - Rename mod to indicate your language, preferred form is "(language)-translation" - Update mod.json to match your mod - Translate all texts strings from `game.json`, `campaigns.json` and `maps.json` diff --git a/launcher/firstLaunch/firstlaunch_moc.cpp b/launcher/firstLaunch/firstlaunch_moc.cpp index b440dcdec..cd0daeadd 100644 --- a/launcher/firstLaunch/firstlaunch_moc.cpp +++ b/launcher/firstLaunch/firstlaunch_moc.cpp @@ -323,7 +323,7 @@ void FirstLaunchView::extractGogData() QFile tmpFile(file); if(!tmpFile.open(QIODevice::ReadOnly)) { - QMessageBox::critical(this, tr("File cannot opened"), tmpFile.errorString()); + QMessageBox::critical(this, tr("File cannot be opened"), tmpFile.errorString()); return QString{}; } QByteArray magicFile = tmpFile.read(magic.length()); diff --git a/launcher/translation/chinese.ts b/launcher/translation/chinese.ts index e7c7a3b67..192d401cd 100644 --- a/launcher/translation/chinese.ts +++ b/launcher/translation/chinese.ts @@ -1248,7 +1248,7 @@ Offline installer consists of two parts, .exe and .bin. Make sure you download b - File cannot opened + File cannot be opened 打开文件失败 diff --git a/launcher/translation/czech.ts b/launcher/translation/czech.ts index 82b843005..462b70da0 100644 --- a/launcher/translation/czech.ts +++ b/launcher/translation/czech.ts @@ -1241,7 +1241,7 @@ Offline instalátor obsahuje dvě části, .exe a .bin. Ujistěte se, že stahuj - File cannot opened + File cannot be opened diff --git a/launcher/translation/english.ts b/launcher/translation/english.ts index f0cfc4739..1a11f1cd1 100644 --- a/launcher/translation/english.ts +++ b/launcher/translation/english.ts @@ -1220,7 +1220,7 @@ Offline installer consists of two parts, .exe and .bin. Make sure you download b - File cannot opened + File cannot be opened diff --git a/launcher/translation/french.ts b/launcher/translation/french.ts index e3524de8b..cb9e32807 100644 --- a/launcher/translation/french.ts +++ b/launcher/translation/french.ts @@ -1246,7 +1246,7 @@ Heroes® of Might and Magic® III HD n"est actuellement pas pris en charge - File cannot opened + File cannot be opened Le fichier ne peut pas être ouvert diff --git a/launcher/translation/german.ts b/launcher/translation/german.ts index cb7b587d5..e7d9f1c09 100644 --- a/launcher/translation/german.ts +++ b/launcher/translation/german.ts @@ -1241,7 +1241,7 @@ Der Offline-Installer besteht aus zwei Teilen, .exe und .bin. Stellen Sie sicher - File cannot opened + File cannot be opened Datei kann nicht geöffnet werden diff --git a/launcher/translation/polish.ts b/launcher/translation/polish.ts index b2b58d544..46b52f1cd 100644 --- a/launcher/translation/polish.ts +++ b/launcher/translation/polish.ts @@ -1241,7 +1241,7 @@ Instalator offline składa się z dwóch części, .exe i .bin. Upewnij się, ż - File cannot opened + File cannot be opened Nieudane otwarcie pliku diff --git a/launcher/translation/portuguese.ts b/launcher/translation/portuguese.ts index 58c66e786..37e69e100 100644 --- a/launcher/translation/portuguese.ts +++ b/launcher/translation/portuguese.ts @@ -1241,7 +1241,7 @@ O instalador offline consiste em duas partes, .exe e .bin. Certifique-se de baix - File cannot opened + File cannot be opened O arquivo não pode ser aberto diff --git a/launcher/translation/russian.ts b/launcher/translation/russian.ts index c042ac99d..6578bc373 100644 --- a/launcher/translation/russian.ts +++ b/launcher/translation/russian.ts @@ -1226,7 +1226,7 @@ Offline installer consists of two parts, .exe and .bin. Make sure you download b - File cannot opened + File cannot be opened diff --git a/launcher/translation/spanish.ts b/launcher/translation/spanish.ts index e68e91161..0c7f269a5 100644 --- a/launcher/translation/spanish.ts +++ b/launcher/translation/spanish.ts @@ -1239,7 +1239,7 @@ Offline installer consists of two parts, .exe and .bin. Make sure you download b - File cannot opened + File cannot be opened diff --git a/launcher/translation/swedish.ts b/launcher/translation/swedish.ts index 953b216b4..575b22836 100644 --- a/launcher/translation/swedish.ts +++ b/launcher/translation/swedish.ts @@ -6,32 +6,32 @@ VCMI on Discord - VCMI på Discord + VCMI på Discord Have a question? Found a bug? Want to help? Join us! - Har du en fråga? Hittat en bugg? Vill du hjälpa till? Anslut dig till oss! + Har du en fråga? Hittat en bugg? Vill du hjälpa till? Anslut dig till oss! VCMI on Github - VCMI på Github + VCMI på Github Our Community - Vår gemenskap + Vår gemenskap Build Information - Konstruktionsinformation + Konstruktionsinformation User data directory - Användardata-mapp + Användardata-mapp @@ -39,52 +39,52 @@ Open - Öppna + Öppna Check for updates - Sök efter uppdateringar + Sök efter uppdateringar Game version - Spelversion + Spelversion Log files directory - Loggfils-mapp + Loggfils-mapp Data Directories - Datafilsregister + Datafilsregister Game data directory - Speldata-mapp + Speldata-mapp Operating System - Operativsystem + Operativsystem Configuration files directory - Konfigurationsfils-mapp + Konfigurationsfils-mapp Project homepage - Projektets hemsida + Projektets hemsida Report a bug - Rapportera ett fel + Rapportera ett fel @@ -92,106 +92,106 @@ Translation - Översättning + Översättning Town - Stad + Stad Test - Testa + Testa Templates - Modeller + Modeller Spells - Trollformler + Trollformler Music - Musik + Musik Maps - Kartor + Kartor Sounds - Ljud + Ljud Skills - Färdigheter + Färdigheter Other - Övrigt + Övrigt Objects - Objekt + Objekt Mechanics - Mekanik + Mekanik Interface - Gränssnitt + Gränssnitt Heroes - Hjälte + Hjälte Graphical - Grafik + Grafik Expansion - Expansion/Tillägg + Expansion/Tillägg Creatures - Varelser + Varelser Compatibility - Kompatibilitet + Kompatibilitet Artifacts - Artefakter + Artefakter AI - AI + AI @@ -199,270 +199,270 @@ Filter - Filter + Filter All mods - Alla moddar + Alla moddar Downloadable - Nedladdningsbar + Nedladdningsbar Installed - Installerad + Installerad Updatable - Uppdaterbar + Uppdaterbar Active - Tillgångar + Tillgångar Inactive - Inaktiv + Inaktiv Reload repositories - Ladda om repositorier + Ladda om repositorier Description - Beskrivning + Beskrivning Changelog - Förändringshistorik + Förändringshistorik Screenshots - Skärmbilder + Skärmbilder %p% (%v KB out of %m KB) - %p% (%v KB av %m KB) + %p% (%v KB av %m KB) Install from file - Installera från fil + Installera från fil Uninstall - Avinstallera + Avinstallera Enable - Aktivera + Aktivera Disable - Inaktivera + Inaktivera Update - Uppdatera + Uppdatera Install - Installera + Installera Abort - Ge upp + Ge upp Mod name - Modd-namn + Modd-namn Installed version - Installerad version + Installerad version Latest version - Senaste version + Senaste version Size - Storlek + Storlek Download size - Nedladdningsstorlek + Nedladdningsstorlek Authors - Författare + Författare License - Licens + Licens Contact - Kontakt + Kontakt Compatibility - Kompatibilitet + Kompatibilitet Required VCMI version - VCMI-version som krävs + VCMI-version som krävs Supported VCMI version - Stödd VCMI-version + Stödd VCMI-version - Please upgrade mod - Vänligen uppdatera modd + please upgrade mod + vänligen uppdatera modd mods repository index - Modd-repositorie index + Modd-repositorie index or newer - eller nyare + eller nyare Supported VCMI versions - VCMI-versioner som stöds + VCMI-versioner som stöds Languages - Språk + Språk Required mods - Moddar som krävs + Moddar som krävs Conflicting mods - Modd-konflikter + Modd-konflikter This mod can not be installed or enabled because the following dependencies are not present - Denna modd kan inte installeras eller aktiveras eftersom följande beroenden inte finns + Denna modd kan inte installeras eller aktiveras eftersom följande beroenden inte finns This mod can not be enabled because the following mods are incompatible with it - Denna modd kan inte aktiveras eftersom följande beroenden är inkompatibla med den + Denna modd kan inte aktiveras eftersom följande beroenden är inkompatibla med den This mod cannot be disabled because it is required by the following mods - Denna modd kan inte inaktiveras eftersom den krävs för följande beroenden + Denna modd kan inte inaktiveras eftersom den krävs för följande beroenden This mod cannot be uninstalled or updated because it is required by the following mods - Denna modd kan inte avinstalleras eller uppdateras eftersom den krävs för följande beroenden + Denna modd kan inte avinstalleras eller uppdateras eftersom den krävs för följande beroenden This is a submod and it cannot be installed or uninstalled separately from its parent mod - Denna undermodd/submodd kan inte installeras eller uppdateras separat från huvud-modden + Denna undermodd/submodd kan inte installeras eller uppdateras separat från huvud-modden Notes - Anteckningar + Anteckningar All supported files - Alla filer som stöds + Alla filer som stöds Maps - Kartor + Kartor Campaigns - Kampanjer + Kampanjer Configs - Konfigurationer + Konfigurationer Mods - Moddar + Moddar Select files (configs, mods, maps, campaigns) to install... - Välj filer att installera (konfigurationer, moddar, kartor, kampanjer)... + Välj filer att installera (konfigurationer, moddar, kartor, kampanjer)... Replace config file? - Byt ut konfigurationsfilen? + Byt ut konfigurationsfilen? Do you want to replace %1? - Vill du ersätta %1? + Vill du ersätta %1? Downloading %1. %p% (%v MB out of %m MB) finished - Ladda ner %1. %p% (%v MB av %m MB) slutfört + Ladda ner %1. %p% (%v MB av %m MB) slutfört Download failed - Nedladdning misslyckades + Nedladdning misslyckades @@ -471,7 +471,7 @@ Encountered errors: - Det går inte att ladda ner alla filer. + Det går inte att ladda ner alla filer. Fel påträffat: @@ -482,41 +482,41 @@ Fel påträffat: Install successfully downloaded? - + Installera lyckade nedladdningar? Installing mod %1 - Installera mod %1 + Installera mod %1 Operation failed - Åtgärden misslyckades + Åtgärden misslyckades Encountered errors: - Fel påträffades: + Fel påträffades: screenshots - skärmdumpar + skärmdumpar Screenshot %1 - Skriv ut skärm %1 + Skriv ut skärm %1 Mod is incompatible - Denna modd är inkompatibel + Denna modd är inkompatibel @@ -524,95 +524,95 @@ Installera lyckade nedladdningar? Can not install submod - Det går inte att installera undermodd/submodd + Det går inte att installera undermodd/submodd Mod is already installed - Modden är redan installerad + Modden är redan installerad Can not uninstall submod - Det går inte att avinstallera undermodd/submodd + Det går inte att avinstallera undermodd/submodd Mod is not installed - Modden är inte installerad + Modden är inte installerad Mod is already enabled - Modden är redan aktiverad + Modden är redan aktiverad Mod must be installed first - Modden måste installeras först + Modden måste installeras först Mod is not compatible, please update VCMI and checkout latest mod revisions - Modden är inte kompatibel. Vänligen uppdatera VCMI och kontrollera att du har den senaste versionen av modden + Modden är inte kompatibel. Vänligen uppdatera VCMI och kontrollera att du har den senaste versionen av modden Required mod %1 is missing - Den obligatorisk modden %1 saknas + Den obligatorisk modden %1 saknas Required mod %1 is not enabled - Den obligatorisk modden %1 är inte aktiverad + Den obligatorisk modden %1 är inte aktiverad This mod conflicts with %1 - Denna modd är i konflikt med %1 + Denna modd är i konflikt med %1 Mod is already disabled - Modden är redan inaktiverad + Modden är redan inaktiverad This mod is needed to run %1 - Denna modden krävs för att köra %1 + Denna modden krävs för att köra %1 Mod archive is missing - Modd-arkiv saknas + Modd-arkiv saknas Mod with such name is already installed - En modd med samma namn är redan installerad + En modd med samma namn är redan installerad Mod archive is invalid or corrupted - Modd-arkivet är ogiltigt eller korrupt + Modd-arkivet är ogiltigt eller korrupt Failed to extract mod data - Det gick inte att extrahera data från modd + Det gick inte att extrahera data från modd Data with this mod was not found - Modd-data för denna modd hittades inte + Modd-data för denna modd hittades inte Mod is located in protected directory, please remove it manually: - Modden är placerad i en skyddad mapp. Vänligen radera den manuellt: + Modden är placerad i en skyddad mapp. Vänligen radera den manuellt: @@ -621,192 +621,192 @@ Installera lyckade nedladdningar? Off - Inaktiverad + Inaktiverad Artificial Intelligence - Artificiell intelligens + Artificiell intelligens On - Aktiverad + Aktiverad Enemy AI in battles - Fiendens AI i strider + Fiendens AI i strider Default repository - Standard-repositorie + Standard-repositorie VSync - Vertikal synkronisering + Vertikal synkronisering Online Lobby port - Port-numret till online-väntrummet + Port-numret till online-väntrummet Autocombat AI in battles - Automatiska AI-strider + Automatiska AI-strider Sticks Sensitivity - Spak-känslighet + Spak-känslighet Automatic (Linear) - Automatisk (linjär) + Automatisk (linjär) Haptic Feedback - Haptisk återkoppling (vibrationer i kontrollen) + Haptisk återkoppling (vibrationer i kontrollen) Software Cursor - Programvarumarkör (muspekare) + Programvarumarkör (muspekare) Automatic - Automatisk + Automatisk None - Inget + Inget xBRZ x2 - xBRZ x2 + xBRZ x2 xBRZ x3 - xBRZ x3 + xBRZ x3 xBRZ x4 - xBRZ x4 + xBRZ x4 Online Lobby address - Adressen till online-väntrummet + Adressen till online-väntrummet Upscaling Filter - Förstoringsfilter + Förstoringsfilter Use Relative Pointer Mode - Använd läge för relativ muspekare + Använd läge för relativ muspekare Nearest - Närmast + Närmast Linear - Linjär + Linjär Input - Touchscreen - Ingång/indata - Pekskärm + Ingång/indata - Pekskärm Network - Nätverk + Nätverk Downscaling Filter - Nerskalnings-filter + Nerskalnings-filter Show Tutorial again - Visa övningsgenomgången igen + Visa övningsgenomgången igen Reset - Återställ + Återställ Audio - Ljud + Ljud Relative Pointer Speed - Relativ pekarhastighet + Relativ pekarhastighet Music Volume - Musikvolym + Musikvolym Ignore SSL errors - Ignorera SSL-fel + Ignorera SSL-fel Input - Mouse - Ingång/indata - Mus + Ingång/indata - Mus Long Touch Duration - Utökad beröringslängd + Utökad beröringslängd % - % + % Controller Click Tolerance - Tolerans för klick på styrenhet + Tolerans för klick på styrenhet Touch Tap Tolerance - Tolerans för pektryck + Tolerans för pektryck Input - Controller - Ingång/indata - Kontroll + Ingång/indata - Kontroll Sound Volume - Ljudvolym + Ljudvolym @@ -817,7 +817,7 @@ Windowed - game will run inside a window that covers part of your screen Borderless Windowed Mode - game will run in a window that covers entirely of your screen, using same resolution as your screen. Fullscreen Exclusive Mode - game will cover entirety of your screen and will use selected resolution. - Välj visningsläge för spelet + Välj visningsläge för spelet Fönsterläge - spelet kommer att köras i ett fönster som täcker en viss del av din skärm (kan även täcka hela skärmen). @@ -828,167 +828,167 @@ Exklusivt helskärmsläge - spelet kommer att täcka hela skärmen och använda Windowed - Fönsterläge + Fönsterläge Borderless fullscreen - Kantlöst fönsterläge + Kantlöst fönsterläge Exclusive fullscreen - Exklusiv helskärm + Exklusiv helskärm Reserved screen area - Reserverat skärmområde + Reserverat skärmområde Neutral AI in battles - Neutralt AI i strider + Neutralt AI i strider Autosave limit (0 = off) - Antal platser för automatisk-sparning (0 = inaktiverad) + Antal platser för automatisk-sparning (0 = inaktiverad) Adventure Map Enemies - Fiender på äventyskartan + Fiender på äventyskartan Autosave prefix - Prefix för automatisk-sparning + Prefix för automatisk-sparning empty = map name prefix - tomt = kartnamnsprefix + tomt = kartnamnsprefix Interface Scaling - Gränssnittsskalning + Gränssnittsskalning Framerate Limit - Gräns ​​för bildhastighet + Gräns ​​för bildhastighet Renderer - Renderingsmotor + Renderingsmotor Heroes III Translation - Heroes III - Översättning + Heroes III - Översättning Adventure Map Allies - Allierade på äventyrskartan + Allierade på äventyrskartan Additional repository - Ytterligare repositorier + Ytterligare repositorier Check on startup - Kontrollera vid start + Kontrollera vid start Mouse Click Tolerance - Musklickstolerans + Musklickstolerans Sticks Acceleration - Styrspaks-acceleration + Styrspaks-acceleration Refresh now - Uppdatera nu + Uppdatera nu Fullscreen - Helskärm + Helskärm General - Allmänt + Allmänt VCMI Language - VCMI-språk + VCMI-språk Resolution - Upplösning + Upplösning Autosave - Auto-spara + Auto-spara Display index - Visa index + Visa index Network port - Nätverksport + Nätverksport Video - Video + Video Show intro - Visa intro + Visa intro Active - Aktiv + Aktiv Disabled - Inaktiverad + Inaktiverad Enable - Aktivera + Aktivera Not Installed - Inte installerad + Inte installerad Install - Installera + Installera @@ -996,27 +996,27 @@ Exklusivt helskärmsläge - spelet kommer att täcka hela skärmen och använda %1 B - %1 B + %1 B %1 KiB - %1 KiB + %1 KiB %1 MiB - %1 MiB + %1 MiB %1 GiB - %1 GiB + %1 GiB %1 TiB - %1 TiB + %1 TiB @@ -1024,98 +1024,98 @@ Exklusivt helskärmsläge - spelet kommer att täcka hela skärmen och använda Language - Språk + Språk Heroes III Data - Heroes III-data + Heroes III-data Mods Preset - Modd-förinställningar + Modd-förinställningar Select your language - Välj ditt språk + Välj ditt språk Have a question? Found a bug? Want to help? Join us! - Har du en fråga? Hittat en bugg? Vill du hjälpa till? Anslut dig till oss! + Har du en fråga? Hittat en bugg? Vill du hjälpa till? Anslut dig till oss! Locate Heroes III data files - Hitta Heroes III-datafiler + Hitta Heroes III-datafiler Use offline installer from gog.com - Använd offline-installationsprogrammet från GOG.com + Använd offline-installationsprogrammet från GOG.com You can manually copy directories Maps, Data and Mp3 from the original game directory to VCMI data directory that you can see on top of this page - Du kan manuellt kopiera mapparna 'Maps', 'Data' och 'Mp3' från den ursprungliga spel-mappen till VCMI-datamappen som du kan se överst på den här sidan + Du kan manuellt kopiera mapparna 'Maps', 'Data' och 'Mp3' från den ursprungliga spel-mappen till VCMI-datamappen som du kan se överst på den här sidan Install gog.com files - Installera filer från GOG.com + Installera filer från GOG.com Manual Installation - Manuell installation + Manuell installation Installing... %p% - Installerar... %p% + Installerar... %p% If you already have Heroes III files on your device, you can select this directory and VCMI will copy the existing data automatically. - Om du redan har Heroes III-filerna på din enhet kan du välja den här mappen och VCMI kommer automatiskt att kopiera befintliga data. + Om du redan har Heroes III-filerna på din enhet kan du välja den här mappen och VCMI kommer automatiskt att kopiera befintliga data. Copy existing files - Kopiera befintliga filer + Kopiera befintliga filer Your Heroes III data files have been successfully found. - Dina Heroes III-datafiler har hittats. + Dina Heroes III-datafiler har hittats. If you own Heroes III on gog.com you can download backup offline installer from gog.com, and VCMI will import Heroes III data using offline installer. Offline installer consists of two parts, .exe and .bin. Make sure you download both of them. - Om du äger Heroes III från GOG.com kan du ladda ner backup offline-installationsprogrammet från GOG.com - VCMI kommer att importera Heroes III-data med hjälp av offline-installationsprogrammet. Offline-installationsprogrammet består av två delar, en .exe och en .bin. Se till att ladda ner båda. + Om du äger Heroes III från GOG.com kan du ladda ner backup offline-installationsprogrammet från GOG.com - VCMI kommer att importera Heroes III-data med hjälp av offline-installationsprogrammet. Offline-installationsprogrammet består av två delar, en .exe och en .bin. Se till att ladda ner båda. Install a translation of Heroes III in your preferred language - Installera en översättning av Heroes III på ditt föredragna språk + Installera en översättning av Heroes III på ditt föredragna språk Finish - Slutför + Slutför VCMI on Github - VCMI på Github + VCMI på Github VCMI on Discord - VCMI på Discord + VCMI på Discord @@ -1126,7 +1126,7 @@ Before you can start playing, there are a few more steps that need to be complet Please keep in mind that in order to use VCMI you must own the original data files for Heroes® of Might and Magic® III: Complete or The Shadow of Death. Heroes® of Might and Magic® III HD is currently not supported! - Tack för att du installerade VCMI! + Tack för att du installerade VCMI! Innan du kan börja spela finns det några steg kvar att slutföra. @@ -1138,135 +1138,135 @@ Heroes® of Might and Magic® III HD stöds för närvarande inte! Next - Nästa + Nästa Search again - Sök igen + Sök igen Heroes III data files - Heroes III-datafiler + Heroes III-datafiler Copy existing data - Kopiera befintliga data + Kopiera befintliga data Back - Tillbaka + Tillbaka Install VCMI Mod Preset - Installera VCMI Modd-förinställningar + Installera VCMI Modd-förinställningar Horn of the Abyss - Avgrundens horn (Horn of the Abyss) + Avgrundens horn (Horn of the Abyss) Heroes III Translation - Heroes III - Översättning + Heroes III - Översättning Interface Improvements - Gränssnitts-förbättringar + Gränssnitts-förbättringar In The Wake of Gods - I gudars kölvatten (In The Wake of Gods) + I gudars kölvatten (In The Wake of Gods) Optionally, you can install additional mods either now, or at any point later, using the VCMI Launcher - Valfritt kan du installera ytterligare moddar antingen nu eller när som helst senare med hjälp av 'VCMI Launcher' + Valfritt kan du installera ytterligare moddar antingen nu eller när som helst senare med hjälp av 'VCMI Launcher' Install mod that provides various interface improvements, such as better interface for random maps and selectable actions in battles - Installera en modd som förbättrar olika användargränssnitt i spelet, såsom ett bättre användargränssnitt för slumpmässiga kartor och valbara åtgärder i strider + Installera en modd som förbättrar olika användargränssnitt i spelet, såsom ett bättre användargränssnitt för slumpmässiga kartor och valbara åtgärder i strider Install compatible version of "Horn of the Abyss", a fan-made Heroes III expansion ported by the VCMI team - Installera en kompatibel version av "Horn of the Abyss" (en fantillverkad Heroes III-expansion som blivit portad av VCMI-teamet) + Installera en kompatibel version av "Horn of the Abyss" (en fantillverkad Heroes III-expansion som blivit portad av VCMI-teamet) Install compatible version of "In The Wake of Gods", a fan-made Heroes III expansion - Installera en kompatibel version av "In The Wake of Gods" (en fantillverkad Heroes III-expansion) + Installera en kompatibel version av "In The Wake of Gods" (en fantillverkad Heroes III-expansion) Heroes III installation found! - Heroes III-installationen hittades! + Heroes III-installationen hittades! Copy data to VCMI folder? - Kopiera data till VCMI-mappen? + Kopiera data till VCMI-mappen? Select %1 file... param is file extension - Välj filen %1... + Välj filen %1... You have to select %1 file! param is file extension - Du behöver välja filen %1! + Du behöver välja filen %1! GOG file (*.*) - GOG-fil (*.*) + GOG-fil (*.*) File selection - Filval + Filval File cannot be opened - Filen kan inte öppnas + Filen kan inte öppnas Invalid file selected - Ogiltig fil vald + Ogiltig fil vald GOG installer - GOG installationsprogram + GOG installationsprogram GOG data - GOG-data + GOG-data No Heroes III data! - Inga Heroes III-data! + Inga Heroes III-data! Selected files do not contain Heroes III data! - De valda filerna innehåller inte Heroes III-data! + De valda filerna innehåller inte Heroes III-data! @@ -1274,48 +1274,48 @@ Heroes® of Might and Magic® III HD stöds för närvarande inte! Heroes III data not found! - Heroes III-data hittades inte! + Heroes III-data hittades inte! Failed to detect valid Heroes III data in chosen directory. Please select directory with installed Heroes III data. - Det går inte att upptäcka giltiga Heroes III-data i den valda katalogen. Välj en mapp där Heroes III-data finns. + Det går inte att upptäcka giltiga Heroes III-data i den valda katalogen. Välj en mapp där Heroes III-data finns. You've provided GOG Galaxy installer! This file doesn't contain the game. Please download the offline backup game installer! - Du har tillhandahållit installationsprogrammet för GOG Galaxy! Den här filen innehåller inte spelet. Ladda ner offline-installationsprogrammet för spelet! + Du har tillhandahållit installationsprogrammet för GOG Galaxy! Den här filen innehåller inte spelet. Ladda ner offline-installationsprogrammet för spelet! Stream error while extracting files! error reason: - Strömningsfel vid extrahering av filer! + Strömningsfel vid extrahering av filer! Orsak till fel: Not a supported Inno Setup installer! - Inno Setup-installationsprogrammet stöds inte! + Inno Setup-installationsprogrammet stöds inte! Extracting error! - Extraktionsfel! + Extraktionsfel! Heroes III: HD Edition files are not supported by VCMI. Please select directory with Heroes III: Complete Edition or Heroes III: Shadow of Death. - Heroes III HD Edition-filer stöds inte av VCMI. + Heroes III HD Edition-filer stöds inte av VCMI. Välj en mapp som innehåller data från Heroes III: Complete Edition eller Heroes III: Shadow of Death. Unknown or unsupported Heroes III version found. Please select directory with Heroes III: Complete Edition or Heroes III: Shadow of Death. - Okänd eller ostödd version av Heroes III. + Okänd eller ostödd version av Heroes III. Vänligen välj en mapp som innehåller data från Heroes III: Complete Edition eller Heroes III: Shadow of Death. @@ -1324,7 +1324,7 @@ Vänligen välj en mapp som innehåller data från Heroes III: Complete Edition Image Viewer - Bildvisare + Bildvisare @@ -1332,92 +1332,92 @@ Vänligen välj en mapp som innehåller data från Heroes III: Complete Edition Czech - Tjeckiska + Tjeckiska Chinese - Kinesiska + Kinesiska English - Engelska + Engelska Finnish - Finska + Finska French - Franska + Franska German - Tyska + Tyska Hungarian - Ungerska + Ungerska Italian - Italienska + Italienska Korean - Koreanska + Koreanska Polish - Polska + Polska Portuguese - Portugisiska + Portugisiska Russian - Ryska + Ryska Spanish - Spanska + Spanska Swedish - Svenska + Svenska Turkish - Turkiska + Turkiska Ukrainian - Ukrainska + Ukrainska Vietnamese - Vietnamesiska + Vietnamesiska Auto (%1) - Auto (%1) + Auto (%1) @@ -1425,32 +1425,32 @@ Vänligen välj en mapp som innehåller data från Heroes III: Complete Edition VCMI Launcher - VCMI Launcher + VCMI Launcher Mods - Moddar + Moddar Settings - Inställningar + Inställningar Help - Hjälp + Hjälp Map Editor - Kartredigerare + Kartredigerare Start game - Starta ett spel + Starta ett spel @@ -1458,12 +1458,12 @@ Vänligen välj en mapp som innehåller data från Heroes III: Complete Edition Name - Namn + Namn Type - Typ + Typ @@ -1471,13 +1471,13 @@ Vänligen välj en mapp som innehåller data från Heroes III: Complete Edition Error starting executable - Fel vid start av körbar fil + Fel vid start av körbar fil Failed to start %1 Reason: %2 - Startfel %1 + Startfel %1 Orsak: %2 @@ -1486,27 +1486,27 @@ Orsak: %2 You have the latest version - Du har den senaste versionen + Du har den senaste versionen Close - Stäng + Stäng Check for updates on startup - Sök efter uppdateringar vid uppstart + Sök efter uppdateringar vid uppstart Network error - Nätverksfel + Nätverksfel Cannot read JSON from url or incorrect JSON data - Det går inte att läsa JSON-data från URL:en eller fel JSON-data + Det går inte att läsa JSON-data från URL:en eller fel JSON-data diff --git a/launcher/translation/ukrainian.ts b/launcher/translation/ukrainian.ts index c69ef2db4..41daca511 100644 --- a/launcher/translation/ukrainian.ts +++ b/launcher/translation/ukrainian.ts @@ -1241,7 +1241,7 @@ Offline installer consists of two parts, .exe and .bin. Make sure you download b - File cannot opened + File cannot be opened Не вдається відкрити файл diff --git a/launcher/translation/vietnamese.ts b/launcher/translation/vietnamese.ts index 3c55777c0..24c9e05d1 100644 --- a/launcher/translation/vietnamese.ts +++ b/launcher/translation/vietnamese.ts @@ -1232,7 +1232,7 @@ Offline installer consists of two parts, .exe and .bin. Make sure you download b - File cannot opened + File cannot be opened diff --git a/lib/GameSettings.cpp b/lib/GameSettings.cpp index df1a5051f..780c79f43 100644 --- a/lib/GameSettings.cpp +++ b/lib/GameSettings.cpp @@ -105,6 +105,8 @@ const std::vector GameSettings::settingProperties = void GameSettings::loadBase(const JsonNode & input) { + JsonUtils::validate(input, "vcmi:gameSettings", input.getModScope()); + for(const auto & option : settingProperties) { const JsonNode & optionValue = input[option.group][option.key]; diff --git a/lib/mapObjectConstructors/CObjectClassesHandler.cpp b/lib/mapObjectConstructors/CObjectClassesHandler.cpp index 518f7b2ad..51c9c8fbb 100644 --- a/lib/mapObjectConstructors/CObjectClassesHandler.cpp +++ b/lib/mapObjectConstructors/CObjectClassesHandler.cpp @@ -203,6 +203,11 @@ TObjectTypeHandler CObjectClassesHandler::loadSubObjectFromJson(const std::strin assert(handlerConstructors.count(handler) != 0); } + // Compatibility with 1.5 mods for 1.6. To be removed in 1.7 + // Detect banks that use old format and load them using old bank hander + if (baseObject->id == Obj::CREATURE_BANK && entry.Struct().count("levels") && !entry.Struct().count("rewards")) + handler = "bank"; + auto createdObject = handlerConstructors.at(handler)(); createdObject->modScope = scope; diff --git a/lib/mapObjects/CGHeroInstance.cpp b/lib/mapObjects/CGHeroInstance.cpp index 35782bfdb..8cf3871b0 100644 --- a/lib/mapObjects/CGHeroInstance.cpp +++ b/lib/mapObjects/CGHeroInstance.cpp @@ -567,6 +567,25 @@ std::string CGHeroInstance::getObjectName() const return VLC->objtypeh->getObjectName(ID, 0); } +std::string CGHeroInstance::getHoverText(PlayerColor player) const +{ + std::string hoverText = CArmedInstance::getHoverText(player) + getMovementPointsTextIfOwner(player); + return hoverText; +} + +std::string CGHeroInstance::getMovementPointsTextIfOwner(PlayerColor player) const +{ + std::string output = ""; + if(player == getOwner()) + { + output += " " + VLC->generaltexth->translate("vcmi.adventureMap.movementPointsHeroInfo"); + boost::replace_first(output, "%POINTS", std::to_string(movementPointsLimit(!boat))); + boost::replace_first(output, "%REMAINING", std::to_string(movementPointsRemaining())); + } + + return output; +} + ui8 CGHeroInstance::maxlevelsToMagicSchool() const { return type->heroClass->isMagicHero() ? 3 : 4; diff --git a/lib/mapObjects/CGHeroInstance.h b/lib/mapObjects/CGHeroInstance.h index 2ad2811a9..a4dffa8af 100644 --- a/lib/mapObjects/CGHeroInstance.h +++ b/lib/mapObjects/CGHeroInstance.h @@ -301,6 +301,8 @@ public: void pickRandomObject(vstd::RNG & rand) override; void onHeroVisit(const CGHeroInstance * h) const override; std::string getObjectName() const override; + std::string getHoverText(PlayerColor player) const override; + std::string getMovementPointsTextIfOwner(PlayerColor player) const; void afterAddToMap(CMap * map) override; void afterRemoveFromMap(CMap * map) override; diff --git a/lib/rewardable/Limiter.cpp b/lib/rewardable/Limiter.cpp index 7bded9054..a5b522e4b 100644 --- a/lib/rewardable/Limiter.cpp +++ b/lib/rewardable/Limiter.cpp @@ -244,6 +244,7 @@ void Rewardable::Limiter::serializeJson(JsonSerializeFormat & handler) handler.serializeIdArray("colors", players); handler.serializeInt("manaPoints", manaPoints); handler.serializeIdArray("artifacts", artifacts); + handler.serializeIdArray("spells", spells); handler.enterArray("creatures").serializeStruct(creatures); handler.enterArray("primary").serializeArray(primary); { diff --git a/mapeditor/inspector/questwidget.cpp b/mapeditor/inspector/questwidget.cpp index 982138741..df706c19d 100644 --- a/mapeditor/inspector/questwidget.cpp +++ b/mapeditor/inspector/questwidget.cpp @@ -48,48 +48,48 @@ QuestWidget::QuestWidget(MapController & _controller, CQuest & _sh, QWidget *par } //fill artifacts - for(int i = 0; i < controller.map()->allowedArtifact.size(); ++i) + for(const auto & artifactPtr : VLC->arth->objects) { - auto * item = new QListWidgetItem(QString::fromStdString(VLC->artifacts()->getByIndex(i)->getNameTranslated())); - item->setData(Qt::UserRole, QVariant::fromValue(i)); + auto artifactIndex = artifactPtr->getIndex(); + auto * item = new QListWidgetItem(QString::fromStdString(artifactPtr->getNameTranslated())); item->setFlags(item->flags() | Qt::ItemIsUserCheckable); item->setCheckState(Qt::Unchecked); - if(controller.map()->allowedArtifact.count(i) == 0) + if(controller.map()->allowedArtifact.count(artifactIndex) == 0) item->setFlags(item->flags() & ~Qt::ItemIsEnabled); ui->lArtifacts->addItem(item); } //fill spells - for(int i = 0; i < controller.map()->allowedSpells.size(); ++i) + for(const auto & spellPtr : VLC->spellh->objects) { - auto * item = new QListWidgetItem(QString::fromStdString(VLC->spells()->getByIndex(i)->getNameTranslated())); - item->setData(Qt::UserRole, QVariant::fromValue(i)); + auto spellIndex = spellPtr->getIndex(); + auto * item = new QListWidgetItem(QString::fromStdString(spellPtr->getNameTranslated())); item->setFlags(item->flags() | Qt::ItemIsUserCheckable); item->setCheckState(Qt::Unchecked); - if(controller.map()->allowedSpells.count(i) == 0) + if(controller.map()->allowedSpells.count(spellIndex) == 0) item->setFlags(item->flags() & ~Qt::ItemIsEnabled); ui->lSpells->addItem(item); } //fill skills - ui->lSkills->setRowCount(controller.map()->allowedAbilities.size()); - for(int i = 0; i < controller.map()->allowedAbilities.size(); ++i) + ui->lSkills->setRowCount(VLC->skillh->objects.size()); + for(const auto & skillPtr : VLC->skillh->objects) { - auto * item = new QTableWidgetItem(QString::fromStdString(VLC->skills()->getByIndex(i)->getNameTranslated())); - item->setData(Qt::UserRole, QVariant::fromValue(i)); + auto skillIndex = skillPtr->getIndex(); + auto * item = new QTableWidgetItem(QString::fromStdString(skillPtr->getNameTranslated())); auto * widget = new QComboBox; - for(auto & s : NSecondarySkill::levels) + for(const auto & s : NSecondarySkill::levels) widget->addItem(QString::fromStdString(s)); - if(controller.map()->allowedAbilities.count(i) == 0) + if(controller.map()->allowedAbilities.count(skillIndex) == 0) { item->setFlags(item->flags() & ~Qt::ItemIsEnabled); widget->setEnabled(false); } - ui->lSkills->setItem(i, 0, item); - ui->lSkills->setCellWidget(i, 1, widget); + ui->lSkills->setItem(skillIndex, 0, item); + ui->lSkills->setCellWidget(skillIndex, 1, widget); } //fill creatures @@ -156,7 +156,7 @@ void QuestWidget::obtainData() for(auto i : quest.mission.artifacts) ui->lArtifacts->item(VLC->artifacts()->getById(i)->getIndex())->setCheckState(Qt::Checked); for(auto i : quest.mission.spells) - ui->lArtifacts->item(VLC->spells()->getById(i)->getIndex())->setCheckState(Qt::Checked); + ui->lSpells->item(VLC->spells()->getById(i)->getIndex())->setCheckState(Qt::Checked); for(auto & i : quest.mission.secondary) { int index = VLC->skills()->getById(i.first)->getIndex();