1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-14 10:12:59 +02:00
Commit Graph

130 Commits

Author SHA1 Message Date
Ivan Savenko
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
Ivan Savenko
cb96b9959e
Merge pull request #4623 from Laserlicht/invincible_bonus
INVINCIBLE bonus
2024-09-20 11:50:29 +03:00
Laserlicht
5e3630adae adjust texts 2024-09-19 20:57:43 +02:00
Laserlicht
b36c05df1d INVINCIBLE bonus 2024-09-19 03:14:45 +02:00
K
bda1adbdfd miniscule bonus system cleanup
update comments, remove one never used method, make another method private
2024-09-18 16:41:41 +02:00
Ivan Savenko
9a08e2eb0f
Merge pull request #4573 from kdmcser/stack_level_updater_for_commander
make TimesStackLevelUpdater support commander
2024-09-12 14:16:16 +03:00
kdmcser
b84d653a99 make TimesStackLevelUpdater support commander 2024-09-09 19:23:23 +08:00
K
a6c7fda649 avoid one loop in BonusList::totalValue() 2024-09-04 23:10:54 +02:00
Ivan Savenko
82c37573fa Removed save compatibility with 1.4
All save compatibility checks targeting 1.4 saves have now been removed.
Saves from 1.5 can still be loaded in 1.6

Implemeted few TODO's in serialization that were postponed to avoid
breaking save compatibility in MP for 1.5.X releases.

Fixed missed case for loading black market object from 1.5 saves
2024-08-29 18:51:53 +00:00
Ivan Savenko
55fd7bd7aa Thieves guild information level is now a bonus type 2024-08-28 13:50:07 +00:00
Ivan Savenko
8371232d29
Merge pull request #4504 from Laserlicht/hota_bonus
disintegrate bonus
2024-08-28 14:00:11 +03:00
K
462c79e190 remove never used code in CBonusSystemNode
Method CBonusSystemNode::getAllBonuses have 'root' parameter which is never
set to anythig else than nullptr. This patch removes the parameter and all
code that depends on it as preparatory work for further bonus system
optimization.
2024-08-25 14:15:21 +02:00
Laserlicht
9c4d4e89d6 disintegrate 2024-08-24 00:29:36 +02:00
Ivan Savenko
162535e6d8 Workaround on crash on visiting configurable building with "bonus"
duration
2024-08-14 17:03:25 +00:00
Ivan Savenko
97f1a310df Fix miscellaneous issues discovered by Sonar 2024-08-12 18:26:30 +00:00
Ivan Savenko
48c92711f2 Fixed deserialization of new artifacts (and possibly some other objects)
Was broken in my previous PR, since pointer graph serialization was
enabled by default, leading to deserializationFix triggering on netpack
apply.

Cleaned up / clarified code
2024-07-29 18:19:15 +00:00
Ivan Savenko
37cf788079
Merge pull request #4317 from IvanSavenko/split_townhandler
Split CTownHandler into smaller chunks
2024-07-22 17:42:48 +03:00
Ivan Savenko
e8aa6efbb9
Merge pull request #4261 from kaja47/shrinkage
Reduce size of Bonus struct from 320 bytes to 296 bytes.
2024-07-22 17:12:08 +03:00
K
c1e6bbddfe Reduce size of Bonus struct from 320 bytes to 296 bytes.
- Internal enums were resized to occupy single byte.
- Duration bitmask uses 16 bit integer directly instead of std::bitset<11> which consumed 8 bytes.
- Fields shuffled to minimise padding and keep the most useful data on first 2 cache lines.
2024-07-22 14:59:31 +02:00
Ivan Savenko
4aa73b40c9 Split CTownHandler into smaller chunks 2024-07-21 18:21:48 +00:00
Ivan Savenko
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
Ivan Savenko
c00a1e1b0c Fixed new issues detected by SonarCloud 2024-07-15 07:46:40 +00:00
Ivan Savenko
6b8f94e6e7 Merge remote-tracking branch 'vcmi/master' into develop 2024-07-11 17:43:44 +00:00
Ivan Savenko
a19b3b61ad Fixed missing addInfo when owner updater is used 2024-07-08 20:57:14 +00:00
Ivan Savenko
ad972eb7e2 Optimize BonusList::totalValue 2024-07-04 19:55:09 +00:00
Alexander Wilms
31e1d39f92 Fix issues introduced by fixing typos 2024-06-27 08:38:04 +00:00
Alexander Wilms
02e429e973 Fix typos using https://github.com/crate-ci/typos
Changes were reviewed manually
2024-06-24 03:47:19 +02:00
Ivan Savenko
3bea383b59 Merge branch 'vcmi/beta' into 'vcmi/develop' 2024-06-21 12:58:36 +00:00
Ivan Savenko
1ac98e305f Fix potential data race if two threads attempt to select bonuses with
different durations
2024-06-12 18:11:22 +00:00
Ivan Savenko
e32b6bd807 Fix potentially uninitialized members 2024-06-12 18:10:38 +00:00
Ivan Savenko
df83fa33a1 Merge branch 'vcmi/master' into 'vcmi/develop' 2024-05-31 09:34:21 +00:00
Ivan Savenko
28081085a8 Create separate instance of updater for every bonus 2024-05-28 16:43:28 +00:00
Ivan Savenko
84bc6c42db Added 'Serializeable' base class for classes serializeable by pointer 2024-05-16 18:40:59 +00:00
Tomasz Zieliński
914cea5877 Tweaks 2024-04-26 19:33:26 +02:00
Tomasz Zieliński
04691c851f Fixes issue of bonuses not correctly removed 2024-04-26 19:22:20 +02:00
Dydzio
b351946afd Add some utility bonuses for player resources boosting 2024-04-15 21:18:45 +02:00
Ivan Savenko
50e8d1fd82 Add save compatibility check 2024-04-09 16:42:20 +03:00
Ivan Savenko
42616cf4e8 Fix text formatting, fix todo's 2024-04-09 16:13:30 +03:00
Ivan Savenko
18ece6dcf6 Remove some usages of server-side translations 2024-04-09 16:13:30 +03:00
Ivan Savenko
9e49587749 Replace bonus string description with metastring that can properly
handle translations
2024-04-09 16:13:30 +03:00
Evgeny Malygin
25125f96da
Fix: licenses, pragma guards, StdInc 2024-03-29 07:48:52 +02:00
Kris-Ja
27ba4f10be Fix BonusLimitEffect #3070
Change BonusList::getBonus() to return bonuses with any BonusLimitEffect by default (returned only bonuses with BonusLimitEffect::NO_LIMIT previously)
2024-03-25 23:31:58 +01:00
Kris-Ja
ff35a27176 Fix loading saved games (add ESerializationVersion) 2024-03-23 22:03:06 +01:00
Kris-Ja
05bbb45824 change MANA_PER_KNOWLEGDE to percentage 2024-03-23 20:28:49 +01:00
Ivan Savenko
922966dcf8 Renamed JsonNode::meta to more logical modScope. Member is now private 2024-02-26 12:55:49 +02:00
Ivan Savenko
08a27663f9 Reworked JsonNode constructors to more logical form 2024-02-26 12:55:49 +02:00
Ivan Savenko
54796c7c56 Rename toJson to toString/toCompactString for consistency 2024-02-26 12:55:49 +02:00
Ivan Savenko
c3957c2c2a Moved json files to new directory, split on per-class basis 2024-02-14 13:08:24 +02:00
Alexander Wilms
678cacbd25 Remove more redundant virtual specifiers
`grep -nr "virtual " | grep -v googletest | grep " override" | grep -v overriden > ../redundant_virtual.txt`

```python
import os

with open("../redundant_virtual.txt") as f:
    for line in f:
        print()
        line: str = line.strip()
        print(line)
        tmp = line.split(":",2)
        file = tmp[0].strip()
        code = tmp[-1].strip()
        print(file)
        print(code)
        new_code = code.replace("virtual ", "", 1)
        # https://superuser.com/a/802490/578501
        command = f"export FIND='{code}' && export REPLACE='{new_code}' && ruby -p -i -e \"gsub(ENV['FIND'], ENV['REPLACE'])\" {file}"
        os.system(command)
```
2024-02-13 15:21:30 +01:00
Alexander Wilms
522cb571b3 Remove redundant virtual specifiers
`grep -nr virtual | grep -v googletest | grep override > ../redundant_virtual.txt`

```python
import os

with open("../redundant_virtual.txt") as f:
    for line in f:
        print()
        line: str = line.strip()
        print(line)
        tmp = line.split(":")
        file = tmp[0].strip()
        code = tmp[-1].strip()
        print(file)
        print(code)
        new_code = code.replace("virtual ", "", 1)
        # https://superuser.com/a/802490/578501
        command = f"export FIND='{code}' && export REPLACE='{new_code}' && ruby -p -i -e \"gsub(ENV['FIND'], ENV['REPLACE'])\" {file}"
        os.system(command)
```
2024-02-10 20:46:13 +01:00