summaryrefslogtreecommitdiff
path: root/src/utils
AgeCommit message (Collapse)AuthorFilesLines
2024-02-29Re-download updates when their checksum no longer matchesThorbjørn Lindeijer1-1/+1
The Mana World currently likes to just update its "TMW.zip" file, whereas updates were always given unique names in the past. With this change, the client checks the Adler32 checksum to know when it should re-download an update file. This matches the behavior of ManaPlus commit 96150f1aeacf55d311c41ffe12d9e754b1cda001.
2024-02-22General code cleanupsThorbjørn Lindeijer3-15/+13
* Use default member initializers * Use range-based loops * Don't use 'else' after 'return' * Removed some unused includes * Construct empty strings with std::string() instead of "" * Clear strings with .clear() instead of assigning "" * Check whether strings are empty with .empty() instead of comparing to "" * Removed redundant initializations
2024-02-13General code cleanupsThorbjørn Lindeijer1-6/+5
* Removing unused includes * Use member initialization * Use range-based for loops * Use nullptr * Removed no longer used aliases * Use override * Don't use else after return * Use '= delete' to remove implicit members * Use std::string::empty instead of comparing to ""
2024-02-05Updated C++ standard to C++17Thorbjørn Lindeijer2-7/+25
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.
2024-02-02Restored support for setting monster ID offset on monsters tagThorbjørn Lindeijer2-2/+12
Apparently this was supported before, but support for that was lost in bd1fdd87eed48ba3ffcc413936d6a6a60a429a97. Fixes #46
2024-01-29Apply C++11 fixitsThorbjørn Lindeijer3-6/+6
modernize-loop-convert modernize-deprecated-headers
2024-01-29Updated PhysFS RWops helper to the latest versionThorbjørn Lindeijer2-59/+117
Fixes compatibility with SDL2. The old version compiled for whatever reason, but it would crash when the client tried to play a sound.
2024-01-26Apply C++11 fixitsThorbjørn Lindeijer6-23/+23
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using
2024-01-25Always use C++11 and remove related compatibility option/codeThorbjørn Lindeijer1-4/+0
2024-01-25Ported to SDL2Thorbjørn Lindeijer2-304/+16
2024-01-24Removed undefined '__EXPORT__'Thorbjørn Lindeijer1-5/+4
There should be no need to export the functions explicitly, given that they are compiled as part of the executable.
2024-01-24Fixed a few coding errors the compiler complained aboutThorbjørn Lindeijer1-1/+1
2024-01-24Fixed compilation issues and use of deprecated C++ featuresThorbjørn Lindeijer1-4/+2
* Fixed compiler errors due to dynamic exception specifications * Replace std::auto_ptr with std::unique_ptr * Replace std::mem_fun with std::mem_fn * Prefix for_each with std:: (apparently not needed before) * Just use lambda instead of std::bind2nd * Removed usages of std::unary_function
2013-05-04Client-side settings are now available from settings.xmlPrzemysław Grzywacz2-0/+195
2013-04-27Small cleanupThorbjørn Lindeijer1-4/+0
2012-03-24Merge branch '0.6'Thorbjørn Lindeijer1-0/+5
2012-03-24Introduced compile-time option to disable use of C++0xThorbjørn Lindeijer1-0/+5
This is in order to still support older compilers, in particular GCC 4.2.1, so that Mana may be compiled for Maemo 5. Reviewed-by: Yohann Ferreira
2012-03-18Removed some 'const' keywords from value returnsThorbjørn Lindeijer2-7/+7
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-02-03Clear tile flags from the gid before further processingThorbjørn Lindeijer1-1/+1
Better to show non-rotated/flipped tiles than no tile at all. This also fixes interpretation of collision tiles that happen to be flipped. Also interpret the gid as an unsigned number, since that's how they are written in the TMX file since the introduction of these flags. Reviewed-by: Yohann Ferreira
2012-01-31Added missing copyright notices.Yohann Ferreira2-0/+2
Reviewed-by: Erik Schilling
2012-01-26Updated copyrights to 2012Thorbjørn Lindeijer16-16/+16
2012-01-24Use SDL_RWops directly on top of PhysFSThorbjørn Lindeijer2-0/+281
This avoids the creation of a temporary buffer containing a complete file for the sole purpose of wrapping it up in an SDL_RWops. The necessary wrapper is by Ryan C. Gordon and is included in the PhysFS repository under 'extras'. Reviewed-by: Yohann Ferreira
2012-01-15Don't leak the XMLContext that is created while loading an XML documentThorbjørn Lindeijer1-4/+4
The XMLContext is only relevant while an XML file is being parsed. So rather than allocating it on the heap and forgetting to delete it again, it's now allocated on the stack and thrown away automatically. Reviewed-by: Yohann Ferreira
2012-01-15Removed a strange if check on an uninitialized variableThorbjørn Lindeijer1-3/+2
The 'inflated' pointer wasn't initialized, but included in the if check for some reason (caught by valgrind). This would have caused support for .gz compressed maps to break sometimes, but since we don't use such maps anymore, maybe support for it should actually be dropped. Reviewed-by: Yohann Ferreira
2012-01-09Made the client able to remove the port from update urls.Yohann Ferreira2-1/+59
Resolves: Mana-Mantis #381. Reviewed-by: Ablu.
2012-01-09Spotted some more hard-coded files and paths definitions.Yohann Ferreira1-0/+4
Conflicts: src/actorsprite.cpp
2011-10-25Change the wrong, but mostly supported WIN32 macro to the correct _WIN32, ↵Bernd Wachter4-7/+7
enforced by -std=c++0x Reviewed-by: Thorbjørn Lindeijer
2011-09-15Prevent copying of MutexLockerBen Longbons1-1/+11
There was a bug here, which wouldn't surface if the copy was elided. Fixed by using a move constructor. Reviewed-by: Thorbjørn Lindeijer <thorbjorn@lindeijer.nl>
2011-06-19More C++0x Windows compilation fixes.Philipp Sehmisch1-1/+1
Another case of M_PI being no longer defined in cmath.h _MAX_PATH doesn't work anymore, but there is still MAX_PATH putenv doesn't work anymore, so I replaced it with a function from the WINApi Reviewed-by: Thorbjorn
2011-04-30Merge branch '0.5'Yohann Ferreira1-8/+4
Conflicts: CMakeLists.txt po/fi.po po/fr.po src/gui/skilldialog.cpp src/localplayer.cpp src/net/manaserv/generalhandler.cpp src/net/tmwa/buysellhandler.cpp src/net/tmwa/generalhandler.cpp src/net/tmwa/playerhandler.cpp src/net/tmwa/specialhandler.cpp src/winver.h
2011-04-18Remove illegal macro names starting with underscore and capitalBen Longbons4-11/+11
2011-04-15Fix mkdir_r to not assume existence of PATH_MAXBen Longbons1-8/+4
Required to build on HURD, but good practice anyway. Reviewed-by: Thorbjørn Lindeijer
2011-02-01Merge branch '0.5'Thorbjørn Lindeijer1-3/+2
Conflicts: po/de.po src/game.cpp src/resources/wallpaper.cpp
2011-02-01Make it clear that our current sha256 code is GPLv2 onlyThorbjørn Lindeijer1-3/+2
Due to taking the version from InspIRCd, our version of the file is stuck on GPLv2 and can't legally be released as "GPLv2 or later". Fix the license header accordingly. We should probably consider replacing this code once again. Reviewed-by: Patrick Matthäi
2011-01-13Moved the normalize() function in strungUtils where it belongs.Yohann Ferreira2-0/+17
(Preparation for bringing a smaller item loading refactoring patch.) Trivial.
2010-09-27Centralized String to bool conversion into the client.Yohann Ferreira3-14/+20
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 Lindeijer2-0/+39
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 Adams2-1/+40
Reviewed-by: Freeyorp
2010-08-15Remove the logToChat optionChuck Miller1-1/+1
This is a very old legacy option. Today its not very useful because the logger had become quite verbose that using it during run-time is not helpful. Reviewed-By: Jared Adams Reviewed-By: Freeyorp
2010-08-15Merge branch '1.0'Chuck Miller4-35/+288
Conflicts: mana.cbp mana.files src/CMakeLists.txt src/Makefile.am src/utils/xml.cpp
2010-08-13Simplify handling of compressed filesJared Adams3-22/+235
ResourceManager will now check for ".gz" and act appropriately (unless told not to). Compression handling functions are now in new utils/zlib files, along with a function to load a file from drive, uncompressing it if it ends in ".gz". Reviewed-by: Freeyorp
2010-08-05Add better XML error logging and do some related cleanupJared Adams2-14/+51
Error details from libxml2 are no longer ignored and are properly logged now. XML initialization code is now in the XML namespace. The XML::Document constructor that took a data pointer was removed because it wasn't being used and it would make the new logging less useful (no filename). Signed-off-by: Chuck Miller
2010-07-28Centralized configuration default values using the VariableData system.Yohann Ferreira2-2/+22
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-07-10Moved parsing of specials.xml from gui/specialswindow.cpp to separate source ↵Philipp Sehmisch2-4/+19
files. Restored functional recharge bars in specials window. Individual specials are only shown after the server informed the client about their status. Made level label, use button and progress bars optional. Their use is controlled through specials.xml. The special window button is again shown even when the player has no specials. This problem needs to be solved differently now for architecture reasons. Reviewed-by: Jaxad0127
2010-06-13Merge remote branch '1.0/1.0'Jared Adams2-0/+13
Conflicts: data/graphics/CMakeLists.txt data/graphics/Makefile.am src/client.cpp
2010-05-27Fix drawing incorrect utf8 strings issue.Andrei Karas2-0/+13
Reviewed-by: Bertram Resolve: Manasource Mantis #143
2010-05-21Remove some unneeded printfsJared Adams1-1/+0
2010-03-12Split Palette into Theme and UserPaletteJared Adams1-1/+7
Themes can now control the colors they use. Colors in the Viewport (being names, particles, etc) can still be changed by the user. Also make ProgressBars more easily colored. DyePalette was made more flexible in the process. Also fixes comparing strings of different lengths insensitively. Reviewed-by: Thorbjørn Lindeijer
2010-03-03Fix possible memory corruption.Andrei Karas1-1/+1
Signed-off-by: Jared Adams <jaxad0127@gmail.com>
2010-03-01Handle cases properly where the path already exists, but not as directoryBernd Wachter1-6/+18