summaryrefslogtreecommitdiff
path: root/src/utils/stringutils.h
AgeCommit message (Collapse)AuthorFilesLines
2025-07-11Make the screenshot file name a clickable linkThorbjørn Lindeijer1-2/+11
Some security checks are done because players might also write "screenshot:" in the chat to create file:// URLs and `SDL_OpenURL` can be used to open many things. So we disallow ".." and require a ".png" extension.
2025-06-17Add quest database support and parsing utilitiesThorbjørn Lindeijer1-0/+2
- Introduce QuestDB with quest/effect structures and XML parsing - Register questdb in CMake and settings manager - Add fromString overload for std::vector<int> parsing
2025-04-29Changed removeColors to work in-placeThorbjørn Lindeijer1-3/+3
Can avoid some memory allocations. Also simplified its implementation a little. Also made ChatLogger::getDateString use the full year.
2025-03-24Expanded GUI theming capabilitiesThorbjørn Lindeijer1-9/+28
* Moved previously hardcoded values for frame size, padding and title bar height to the Skin. * Added support for rendering colored rectangles (used for scroll bar background). * Scroll bar width is now determined by its skin. * Added separate skins for horizontal and vertical scroll bars and horizontal and vertical scroll markers and added a skin for the shortcut box. * Added support for hovered state on window close button.
2025-03-13Removed needless case-insensitive string comparisonsThorbjørn Lindeijer1-10/+0
These are not necessary since we can instead make sure the referenced values match case, like we do for everything else. This affects server types in the server list and colors referenced in theme files. The server version was also compared case-insensitively for some reason.
2025-02-14Fixed handling of update URLs which mention a portThorbjørn Lindeijer1-10/+11
This appears to have been a regression in f405849b49614254f42eb3ee6147434458978623, which for some reason erased the port (and any trailing parts) from not just the update directory but also from the update URL. Unfortunately we can't access Mana-Mantis #381 at the moment, but presumably the port was removed due to the colon being a problematic character. Instead, now the colon (and other special characters) are replaced by _ when determining the update directory. Closes https://git.themanaworld.org/mana/mana/-/issues/80
2025-02-13Implemented support for item replacementsThorbjørn Lindeijer1-0/+5
Specifying an unknown sprite or direction is reported as error and will not cause any replacements. Specific item replacements are supported also when not specifying the sprite. Replacements do not affect particle effects. Part of https://git.themanaworld.org/mana/mana/-/issues/92
2025-01-21Replaced include guards with #pragma onceThorbjørn Lindeijer1-4/+1
Thanks to https://github.com/cgmb/guardonce and a follow-up replace to remove duplicated newlines at end of file: find src -type f -name '*.h' -exec \ sed --in-place -e :a -e '/^\n*$/{$d;N;};/\n$/ba' {} \; Source: https://unix.stackexchange.com/questions/81685/how-to-remove-multiple-newlines-at-eof Fixes compile on macOS, which appears to have been due to the EVENT_H include guard.
2025-01-20Made client config statically typedThorbjørn Lindeijer1-1/+51
This makes accessing the config values much faster, since it no longer needs to do a lookup nor string conversion, which means we could remove some needless copying of the values. Overall it makes it easier to find out where settings are used and it puts the defaults along with the declaration. Options with default values are no longer saved to the config file. This does not include unrecognized options, which are kept around to provide some compatibility with older clients. While most basic options have kept the same name, more complicated settings like window geometry, shortcuts, outfits, etc. now have their own XML elements. Older clients will ignore these and erase them when saving the configuration.
2025-01-18Introduced small convenience wrapper to write XMLThorbjørn Lindeijer1-2/+2
Might not seem worth it right now, but it will be if we write out more XML structures.
2024-03-25Avoid string allocations during text rendering and sizingThorbjørn Lindeijer1-2/+0
Now a text chunk has a maximum length of 4k characters, but that should be plenty of space since they're only single lines.
2024-03-11Implemented ability to open external links in news and chatThorbjørn Lindeijer1-0/+8
* Use ConfirmDialog to confirm the opening of the external link. * ConfirmDialog now centers on its parent window when provided. * Reset hovered link when mouse exits the BrowserBox.
2024-02-05Updated C++ standard to C++17Thorbjørn Lindeijer1-3/+9
C++17 should be universal enough by now. This raises the minimum CMake to 3.8, which should also pose no problem since Ubuntu 18.04 already shipped with CMake 3.10. C++17's 'if' initialization statement is now used in an efficient implementation of 'join' for vector<string>, found on StackOverflow.
2012-03-18Removed some 'const' keywords from value returnsThorbjørn Lindeijer1-3/+3
It makes no sense to mark a return value as const when it is returned by value. This only makes sense if the return value is passed by reference, in order to prevent the receiver from modifying the value. Also made some other small adjustments. A std::string does not need to be initialized to "" explicitly and getSafeUtf8String could take its parameter by reference. Reviewed-by: Yohann Ferreira
2012-01-26Updated copyrights to 2012Thorbjørn Lindeijer1-1/+1
2012-01-09Made the client able to remove the port from update urls.Yohann Ferreira1-0/+11
Resolves: Mana-Mantis #381. Reviewed-by: Ablu.
2011-01-13Moved the normalize() function in strungUtils where it belongs.Yohann Ferreira1-0/+11
(Preparation for bringing a smaller item loading refactoring patch.) Trivial.
2010-09-27Centralized String to bool conversion into the client.Yohann Ferreira1-2/+3
The former XML::getBoolProperty() had a potential memleak and was unsafe when dealing with unknown values. Reviewed-by: CodyMartin. Resolves: Mana-Mantis #213.
2010-09-25Merge branch '1.0'Thorbjørn Lindeijer1-0/+4
Conflicts: src/actorspritemanager.h src/beingmanager.cpp src/game.cpp src/gui/beingpopup.cpp src/gui/chat.cpp src/gui/chat.h src/gui/inventorywindow.h src/gui/itempopup.cpp src/gui/socialwindow.cpp src/gui/statuswindow.cpp src/gui/widgets/chattab.cpp src/gui/widgets/chattab.h src/net/tmwa/inventoryhandler.cpp src/net/tmwa/partyhandler.cpp src/party.cpp src/sound.cpp src/utils/stringutils.cpp src/utils/stringutils.h
2010-08-29Move handling of autocomplete and input history into TextFieldJared Adams1-0/+4
Reviewed-by: Freeyorp
2010-07-28Centralized configuration default values using the VariableData system.Yohann Ferreira1-0/+8
Please note that I didn't turned all the getValue() call into new ones, simply because I have to have config object initiated which is not forcefully the case the branding file. Resolves: Manasource Mantis #170.
2010-05-27Fix drawing incorrect utf8 strings issue.Andrei Karas1-0/+2
Reviewed-by: Bertram Resolve: Manasource Mantis #143
2010-02-22Modify copyright headersFreeyorp1-1/+2
2010-02-20License header update for The Mana ClientThorbjørn Lindeijer1-4/+3
2010-02-07Updated Copyright year to 2010!Bertram1-1/+1
Also added the update copyright tool from the Wormux Team. ( And not forgetting credit's due. :P )
2010-01-08Small refactoring in chat auto completingAndrei Karas1-1/+1
2010-01-07Chat auto completingAndrei Karas1-0/+4
2010-01-07Fix a typoFreeyorp1-1/+1
2010-01-06Fixes so mapreader ignores the case of object typesChuck Miller1-0/+9
This will decrease warnings in the log file by a good bit
2009-12-10Avoiding compiler warnings with gcc 4.4.0Stefan Dombrowski1-1/+1
With the changed __attribute__ it compiles now without warnings on gcc 4.4.0. For other compiler this should work too, because this format is already used for log() in log.h.
2009-11-03Remove more _SUPPORT ifdefs and do some cleanupJared Adams1-0/+10
2009-10-05Hide color codes from speech textAndrei Karas1-0/+8
2009-05-03Moved strprintf into stringutils.{h,cpp}Bjørn Lindeijer1-0/+11
2009-04-29Changed palette colors to be once again stored in a human readableTametomo1-0/+8
format once again. This was originally reverted because it caused a regression on Windows, but not Linux, which was later found out to be because there's a Linux kernel function which will convert hex strings into an integer format, while Windows doesn't share the same luxury. So, to avoid any issues, this commit adds an atox (ascii to hex) string utility, and uses it when parsing hex strings for colors from the configuration file. Also ensured that people who have colors saved in the old, raw integer format can get their colors converted to hex values. Signed-off-by: Tametomo <irarice@gmail.com> Signed-off-by: Bjørn Lindeijer <bjorn@lindeijer.nl>
2009-04-13Fixed @'s in a user's nickDavid Athay1-0/+8
2009-02-18Introduced a toLower method and grouped string utilsBjørn Lindeijer1-0/+68
The string utility methods are now grouped together in the stringutils.h header. Also, a toLower method was added for convenience.