1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00
Commit Graph

176 Commits

Author SHA1 Message Date
16a06179cf Use ArtifactInstanceID in CGArtifact 2025-04-27 14:57:30 +03:00
ab11d2b075 Remove quests from CMap, now solely owned by quest objects 2025-04-27 14:57:30 +03:00
bdae7285ae Objects list is now private member of CMap 2025-04-27 14:57:30 +03:00
745040def3 Access to heroes storage in CMap is now done via public methods 2025-04-27 14:57:30 +03:00
1f502c0548 CMap towns and heroes on map fields are now private 2025-04-27 14:57:30 +03:00
0ada2a5ebd Map objects now use shared_ptr (game) 2025-04-27 14:57:30 +03:00
2ca1748e96 Artifact instances are now owned solely by CMap 2025-04-27 14:57:30 +03:00
9f713a0914 Rename int3::valid to isValid for consistency 2025-03-03 10:46:00 +00:00
645b95ba02 Renamed LibClasses * VLC to GameLibrary * LIBRARY 2025-02-21 16:54:56 +00:00
4b824d05e2 Do not allow heroes banned for player as starting heroes
- `disposedHeroes` is now in map header, for use in map selection
- heroes that are marked as unavailable for player will now be hidden
from starting hero selection
2025-02-14 10:43:55 +00:00
08fbcd5239 TerrainTile now uses identifiers instead of pointers to VLC 2024-10-30 16:22:11 +00:00
638bc174c3 Fix crash on exporting maps for translation 2024-10-25 21:41:24 +00:00
10ad0fc760 Split CHeroHandler.cpp/.h into 1 file per class
All parts of CHeroHandler.cpp are now in lib/entities/hero
Adjusted includes to use new paths
No functionality changes
2024-10-13 14:01:09 +00:00
3dd4fa2528 Reduce usage of pointers to VLC entities
Final goal (of multiple PR's) is to remove all remaining pointers from
serializeable game state, and replace them with either identifiers or
with shared/unique pointers.

CGTownInstance::town and CGHeroInstance::type members have been removed.
Now this data is computed dynamically using subID member.

VLC entity of a town can now be accessed via following methods:
- getFactionID() returns ID of a faction
- getFaction() returns pointer to a faction
- getTown() returns pointer to a town

VLC entity of a hero can now be accessed via following methods:
- getHeroTypeID() returns ID of a hero
- getHeroClassID() returns ID of a hero class
- getHeroType() returns pointer to a hero
- getHeroClass() returns pointer to a hero class
2024-10-10 12:28:08 +00:00
a8f8c3f4b1 Replaced most of accesses to CGObjectInstance::pos with anchorPoint() 2024-10-09 15:43:46 +00:00
a58e209cbd Merge pull request #4490 from godric3/fix-campaign-hero-placeholder
Fix campaign hero placeholder
2024-09-09 23:39:20 +03:00
b06426ac43 CMap removed from CArtifactSet level 2024-09-04 15:12:40 +03:00
355bf4ec3e read reservedCampaignHeroes from vmaps 2024-08-22 16:52:35 +02:00
4aa73b40c9 Split CTownHandler into smaller chunks 2024-07-21 18:21:48 +00:00
1aa391fdf8 Split CGeneralTextHandler file into 1 file per class form
All text processing code is now located in lib/texts.
No changes other than code being moved around and adjustment of includes

Moved without changes:
Languages.h           -> texts/Languages.h
MetaString.*          -> texts/MetaString.*
TextOperations.*      -> texts/TextOperations.*

Split into parts:
CGeneralTextHandler.* -> texts/CGeneralTextHandler.*
                      -> texts/CLegacyConfigParser.*
                      -> texts/TextLocalizationContainer.*
                      -> texts/TextIdentifier.h
2024-07-20 12:55:17 +00:00
434371195d JsonNode constructors: Take fileName as argument
* Don't print JSON in JsonParser::parse() in case of errors
2024-07-17 13:50:59 +02:00
02bd52041b extend map format 2024-06-29 13:13:59 +02:00
7461df161c lib now uses shared_ptr for entities. Removed manual memory management. 2024-05-17 15:04:05 +00:00
6ba6e0d55b Moved serialization of ModCompatibilityInfo from MapFormat 2024-04-23 17:15:59 +03:00
08a27663f9 Reworked JsonNode constructors to more logical form 2024-02-26 12:55:49 +02:00
54796c7c56 Rename toJson to toString/toCompactString for consistency 2024-02-26 12:55:49 +02:00
c3957c2c2a Moved json files to new directory, split on per-class basis 2024-02-14 13:08:24 +02:00
9e09fe08e1 Fixed duplicated hero check - was used too early, before hero type is
loaded
2024-02-05 21:55:48 +02:00
2a193effcc Merge branch 'master' into 'develop' 2024-01-25 16:23:13 +02:00
8e8d42bfa2 Try to simplify / cleanup code to localize crash 2024-01-20 18:40:03 +02:00
e67e4430ba Removed most of non-const static fields in lib. Reduced header includes. 2024-01-19 13:55:22 +02:00
a15366f5a5 Make IObjectInterface::cb non-static 2024-01-19 13:55:21 +02:00
73019c204d Replace redundant types with auto for the lvalues of template factory functions for smart pointers
grep -r --include \*.h --include \*.cpp "= std::" * | grep -v auto | grep -Po ".*[^ ]+ [^ ]+ [^ ]*[ ]*=.*;" | grep -v "auto\|int\|char\|bool\|float|\double\|for\|if\|googletest\|fuzzylite\|size_t\|using\|return" | grep -v double | grep -v si64 | grep -v si32 | grep -v ui32 | grep \< | grep -v float | tr -d '\t' | grep -v assert > redundant_types.txt

import re

with open("redundant_types.txt") as f:
    for line in f:
        line = line.strip()
        path = line.split(":", 1)[0]
        original_code = ":".join(line.split(":")[1:]).strip()

        print()
        print(path)
        print(original_code)
        prefix = "auto "
        if original_code.startswith("static"):
            static = True
        else:
            static = False

        cpp_type = " ".join(original_code.split("=")[0].strip().split(" ")[0:-1])
        print(cpp_type)

        if static:
            new_code = "static auto "+ " ".join(original_code.split(" ")[2:])
        else:
            new_code = "auto "+ " ".join(original_code.split(" ")[1:])
        print(new_code)

        if True:
            with open(path, "r") as f:
                filedata = f.read()

            filedata = filedata.replace(original_code, new_code)

            with open(path, "w") as f:
                f.write(filedata)
2024-01-17 12:50:00 +00:00
cca08e29da Remove duplicate semicolons 2024-01-16 19:02:39 +00:00
ee46fc806a Add workaround to loading old map format 2023-11-27 14:09:08 +02:00
f7ef474201 Fix format of custom win/loss conditions for h3 campaigns 2023-11-19 23:59:49 +02:00
96c81be68e Win/loss conditions now use VariantIdentifier. Removed non-implemented
options
2023-11-15 15:55:19 +02:00
abad4b01ce Remove explicit convesion to int in operators 2023-11-15 15:55:19 +02:00
0842f5afee Removed remaining usages of std::vector<bool> 2023-11-15 15:55:18 +02:00
eb167d94a6 Mod compatibility check is now in a separate class and not part of
ModHandler
2023-11-08 21:27:05 +02:00
184f5a72cc Use toEntity/toXXX methods in Identifier instead VLC objects access 2023-11-03 16:03:29 +02:00
8d5fa41a19 Minor fixes 2023-11-03 16:03:29 +02:00
8346d71c98 Remove more subID access 2023-11-01 14:44:05 +02:00
03e1169781 Reduced number of accesses to CGObjectInstance::subID 2023-11-01 14:43:20 +02:00
a1a5bc28c2 convert line endings from CRLF (Windows) to LF (Linux/Unix)
Mixed line endings cause problems when exporting patches with
git-format-patch and then trying to "git am" a patch with mixed and
non-matching line endings. In such a situation git will fail to apply
the patch.

This commit runs the dos2unix tools on the remaining files with CRLF
(\r\n) line endings to convert them to line-feeds (\n) only.

Files that are Windows specific like *.vcxproj and *.props files were
not converted.

Closes: #3073
2023-10-19 16:23:21 +02:00
037efdf5fc Improvements to type safety of Identifier class
- Constructor of Identifier from integer is now explicit
- Lobby hero/town selection now uses Identifiers instead of int's
- Removed serialization workaround for hero portraits
- Added dummy objects for custom heroes portraits for ID resolver to use
- HeroInstance now stores portrait ID only in case of custom portrait
- Fixed loading of campaign heroes portraits on RoE maps
2023-10-04 18:05:23 +03:00
ae073ee35d Remove unused identifiers 2023-09-28 23:15:36 +02:00
a710c88b07 Proper map translations loading 2023-09-28 13:09:01 +02:00
ba1dbbbb1d New version for map format 2023-09-28 04:23:14 +02:00
65f696b018 Cosmetic changes for json map reader 2023-09-28 03:02:46 +02:00