1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-06 23:26:26 +02:00

16 Commits

Author SHA1 Message Date
kdmcser
84202ee64f fix compile error 2025-04-20 00:34:18 +08:00
kdmcser
c3c8b5048a extract functions of string <-> boost::filesystem::path to TextOperations.h 2025-04-20 00:23:41 +08:00
Ivan Savenko
dcb7a9e9f3 Fixes to locale/unicode handling
- Fixes crash on opening spellbook (recent regression)
- Fix crash if `haystack` string is shorter than `needle`
- Levenstein distance computation is now case-insensitive
- Text similarity computation now assumes utf-8 strings, not ascii
- Fix corruption of utf-8 string on life drain
2025-04-11 16:27:26 +03:00
Michał Zaremba
f0ee3b8257 Fix setting up locale for Android and such 2025-04-02 05:14:51 +02:00
Ivan Savenko
7a3e1409d0 Remove old boost includes and defines 2025-03-19 08:03:56 +00:00
Ivan Savenko
ca8dcf30ed Fix build 2025-03-18 11:56:22 +00:00
MichalZr6
749149a679 Fixes following reviews
Use std::optional and improve textSearchSimilarityScore()
2025-03-12 21:40:07 +01:00
MichalZr6
3f4616eb0f SonarCloud fixes 2025-03-12 17:44:13 +01:00
MichalZr6
9fbb2d7370 Fix: use LIBRARY instead of VLC 2025-03-11 23:45:59 +01:00
MichalZr6
5363424451 Small fixes to search mapobject feature:
- Trim overly long names to prevent incorrect item display
- Use getLocaleName() for proper locale-aware to_lower conversion
- Implement scoring-based sorting for better search match ranking
- Remove Boost dependency: replace with std::string::find() and rfind()
2025-03-11 23:22:04 +01:00
MichalZr6
e993c2aed0 Use locale based on language set in config 2025-03-11 23:21:12 +01:00
Ivan Savenko
a8a6be7ac1 Fix potential compatibility with C++20 / C++23 mode
This fixes several issues with compatibility with C++20. C++23 was also
tested, but apparently it does not have any additional breaking changes
compared to C++20 (or we don't have those).

VCMI still uses C++17 as before - goal is only to make potential
transition easier.

There were 2 cases that are deprecated in C++20 that we use:
- Floating point operations on enums are deprecated
- `this` can no longer be captured when using default capture by value
`[=]`

Both of those should now be replaced with code that works fine in both C+
+17 and in C++20 mode
2025-03-02 14:11:48 +00:00
Laserlicht
07b494632b optimize textSearchSimilar 2025-02-08 13:22:11 +01:00
Ivan Savenko
a95ab5a7ce Add better debugging for text conversion failure 2025-02-01 18:10:42 +00:00
Laserlicht
0035b2346a optimized search input 2025-01-23 23:50:04 +01: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