Commit Graph

54 Commits (ee35d256aa485d35be1bab307ec9833780934577)

Author SHA1 Message Date
Lukas Werling ee35d256aa Add basic character classes to WildcardMatch() 2019-02-03 19:14:53 +01:00
Nicolas Hake 8298813a90 CMake: Remove <direct.h> test
We're not using the <direct.h> header anywhere besides including it
for no purpose, so we can drop the test (and the inclusion).
2018-12-31 12:20:39 +01:00
Lukas Werling 1541bf62c1 Fix buffer overrun in RealPath
This usually isn't an issue, but is caught by -fcheck-pointer-bounds.
2017-09-17 18:51:41 +02:00
David Dormagen 8d1aa0c0c2 DirectoryIterator: only append DirectorySeparator if necessary 2017-08-15 10:04:46 +02:00
Tushar Maheshwari a661eab867 Automatic fixes using clang-tidy for header files
A follow-up on a previous PR GH-41. The discussion in the forum can be
viewed at http://forum.openclonk.org/topic_show.pl?pid=33086.
Run clang-tidy (without auto, pass-by-value and using checks) to fix the
header files not modified in the previous PR.

Summary of the changes:

 - C++11 member initialization.
 - nullptr instead of 0 for pointers.
 - override for functions declared virtual in base class.
 - default trivial special member functions
2017-05-15 13:46:46 +02:00
Tushar Maheshwari 3a4f49ad90 Revisit #includes
Consolidate the include statements scattered across the code in accordance
with the comment in C4Include.h. The advantages are listed in the same
comment.
Furthermore, it follows llvm-include-order which is the logical
extrapolation of the project's style guideline wherever possible
(C4Include.h being the most-frequent exception).
2017-05-15 13:24:59 +02:00
Tushar Maheshwari e58a7884e4 Automatic fixes using clang-tidy
See http://forum.openclonk.org/topic_show.pl?tid=3376 for discussion.

Close GH-41
2017-05-03 20:30:45 +02:00
Nicolas Hake e3d6486f2a Move GetRelativePath to C4Language
C4Language is the only consumer of GetRelativePath. It cannot handle
arbitrarily sized paths, so discourage new code from using it by moving
it to C4Language.cpp.

Also remove the buffer size parameter which was always defaulted anyway
and use template parameter deduction to always get the correct size.
2017-03-11 13:47:18 +01:00
Sven Eberhardt ebda8193ef Replace NULL by nullptr in C++ sources
We don't support pre-C++0x any more, so nullptr should be fine everywhere (except in the plain C source files)
2016-11-02 19:58:02 -04:00
Nicolas Hake e490428f29 Win32: Drastically improve load times with unpacked planet/
C4Group::SearchNextEntry would waste lots of cycles looking up file
attributes that were never inspected afterwards. Since all we want is
the file size, and we already get that for free from FindFirstFile and
FindNextFile, store it with the directory iterator instead of querying
it at every iteration.

This reduces load times on my machine by almost half, tested across
several different scenarios.
2016-06-19 17:08:50 +02:00
Nicolas Hake eabca223f5 Update all copyright notices for 2016 2016-04-03 20:24:42 +02:00
Nicolas Hake 493c276126 Rewrite header inclusions to #include "path/to/file.h" style 2016-04-03 20:24:42 +02:00
Sven Eberhardt e229090141 Fix memory leak in GetWorkingDirectory.
It was just one leak per engine launch so it's not relevant. But there's no reason to do manual buffer management when StdStrBuf is used anyway.
2015-09-12 03:05:16 -04:00
David Dormagen ac738735b2 Merge branch 'master' into Controls
Conflicts:
	planet/Objects.ocd/Vehicles.ocd/Airplane.ocd/Script.c
	src/game/C4Game.cpp
	src/game/C4GraphicsSystem.cpp
	src/gamescript/C4GameScript.cpp
2015-09-02 08:19:34 +02:00
Sven Eberhardt e5814f8841 Silence some spurious compiler warnings about partially initialized structures. 2015-09-01 21:37:16 -04:00
David Dormagen 196f528201 Merge branch 'master' into Controls
Conflicts:
	planet/Objects.ocd/HUD.ocd/FancyGridMenu.ocd/DefCore.txt
	planet/Objects.ocd/HUD.ocd/GridMenu.ocd/DefCore.txt
	planet/Objects.ocd/Helpers.ocd/Dummy.ocd/Graphics.png
	planet/Objects.ocd/Items.ocd/Tools.ocd/WindBag.ocd/Script.c
	planet/Objects.ocd/Items.ocd/Weapons.ocd/Javelin.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/ClonkControl.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/Constructor.ocd/ConstructionMenu.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/Constructor.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/Flag.ocd/Marker.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/Producer.ocd/Script.c
	planet/Objects.ocd/Structures.ocd/Flagpole.ocd/Script.c
	planet/Objects.ocd/Structures.ocd/Pump.ocd/Script.c
	src/game/C4Game.cpp
	src/gamescript/C4GameScript.cpp
	src/gui/C4GameMessage.cpp
	src/landscape/C4Landscape.cpp
2015-06-03 22:32:36 +02:00
Nicolas Hake 5562b09dc4 Remove a lot of disabled legacy code, round 2
Maybe at some point we'll be rid of all the commented-out code that
nobody has looked at in years.
2015-03-25 20:02:53 +01:00
Nicolas Hake 2ef2c637a7 Remove several instances of disabled legacy code 2015-01-18 22:59:45 +01:00
David Dormagen bd04722553 Merge branch 'master' into Controls
Conflicts:
	planet/Objects.ocd/HUD.ocd/Controller.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/ClonkControl.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/Constructor.ocd/ConstructionMenu.ocd/Script.c
	planet/Objects.ocd/Libraries.ocd/Constructor.ocd/Script.c
	src/game/C4GraphicsSystem.cpp
	src/game/C4GraphicsSystem.h
	src/game/C4Viewport.cpp
	src/gui/C4GameMessage.cpp
2015-01-15 19:57:01 +01:00
Armin Burgmeier 039e03824a Fix buffer underflow in GetExtension() 2015-01-04 18:29:36 +01:00
David Dormagen bb2ec10afd fixed incorrect type of handle for some WIN32 file operations
The return type is intptr_t which may be 64bit. Stuffing that into an int can lead to an overflow, which then can lead to the error check (if handle < 0) failing.
Which has caused me to need to restart the game soooo many times already... Like some sort of old car with a broken starter.
2014-10-18 09:22:56 +02:00
Günther Brammer 8780a69b51 Improve the messages for path problems
C4Group::Open would sometimes overwrite more specific error messages or
not mention the problematic path. DirectoryIterator::Read also now mentions
more detail. Two superfluous messages were removed to make space.
2014-06-09 04:17:17 +02:00
Nicolas Hake e0dc30c59a Update copyright notices
As discussed in http://forum.openclonk.org/topic_show.pl?tid=2917, I
have merged all copyright notices into a single file and referenced that
merged file from each source file.

For the updated source files, the timeline has been split into three
parts:
 1. Pre-RWD code (before 2001)
 2. RWD code (2001 through 2009)
 3. OpenClonk code (2009 and later)
All pre-RWD copyright notices have been left intact, as have RWD-era
copyright notices where the file did not have a RedWolf design copyright
notice but only individual author ones. All copyright notices of the
OpenClonk era have been replaced by a single notice ranging from the
first recorded year to the current year (2013). Mape code did not get a
OpenClonk Team copyright notice because it is somewhat separate from the
main OpenClonk codebase and has only been touched by Armin Burgmeier.
2013-12-23 13:03:19 +01:00
Günther Brammer 864c5c7ea8 copyright notices update 2012 2013-01-12 16:31:40 +01:00
Sven Eberhardt 99992b6f47 Fix sync loss and missing landscape or objects when joining two consecutive games without restarting the engine inbetween
Caused by an outdated cache of the DirectoryIterator in the main scenario group
2012-11-17 19:44:04 +01:00
Günther Brammer b4fd8fcd15 linux: Add O_CLOEXEC to various open calls
This should prevent some file descriptor leakage from forks that
some libraries we use do.
2012-03-05 01:33:02 +01:00
Armin Burgmeier 86bc3ac417 Don't print an error message for ERROR_PATH_NOT_FOUND in DirectoryIterator::Read
We do the same already for ERROR_FILE_NOT_FOUND. This fixes a harmless warning
when running the engine in a release directory where there is no planet/
directory.
2012-01-28 18:15:51 +01:00
Günther Brammer 91e3a0ca07 Remove unused EraseFiles and EraseItems functions 2011-11-02 21:34:04 +01:00
Nicolas Hake af8cc1320f Do not throw from DirectoryIterator::Read (#681) 2011-10-29 01:16:13 +02:00
Nicolas Hake 6a18a56f5d Remove some extraneous parentheses 2011-09-28 19:44:03 +02:00
Günther Brammer 69c66d9b8f Make StdFile.cpp utf-8 2011-09-07 14:22:35 +02:00
Günther Brammer 9bc61db360 copyright notices update 2011 2011-09-01 16:58:52 +02:00
Sven Eberhardt 1a176a52b9 MSVC2010 fix: Use _filesize instead of filesize
silence a few warnings
2011-08-14 18:16:19 +02:00
Nicolas Hake 0f4e6e8ccd win32: Use wide variants of CRT file access APIs 2011-08-11 15:46:06 +02:00
Günther Brammer 4d1238beb4 win32: Use Unicode APIs for File manipulation 2011-04-02 18:45:44 +02:00
Günther Brammer 35a8667672 Savegames: Include *.ocf directories in Origin, not *.c4f 2011-05-15 19:32:39 +02:00
Günther Brammer 259c4aa30a Fix DirectoryIterator::DirectoryIterator(const DirectoryIterator &)
Thankfully, this copy constructor is unused, so nothing relied on the
previously broken behaviour.
2011-03-30 21:11:37 +02:00
Günther Brammer 3bbf7c6c38 Add DirectoryIterator & DirectoryIterator::operator = (const DirectoryIterator &)
Because every class with pointer members should have one.
2011-03-30 21:04:42 +02:00
Günther Brammer c49f8b32d5 win32: wrap all windows.h-includes to always undef troubling macros 2011-03-13 15:48:45 +01:00
Günther Brammer 21a8f337d5 win32: avoid winbase.h in PlatformAbstraction.h 2011-03-12 15:29:21 +01:00
Günther Brammer be342d4a51 copyright notices update 2010
This time with more manual checking and using git blame -M -C, so that
a few cases of copied code get a copyright notice corresponding to
their initial introduction.
2010-12-23 01:01:24 +01:00
Sven Eberhardt 6158aec581 Removed internal score counting by player wealth/owned objects
Unified and renamed all Points/Value/Score functions/field names into Score
Some MSVC warning fixes
2010-04-21 21:12:49 +02:00
Benjamin Herr 4378de147c Rerun astyle with missing \ added 2010-03-28 20:58:01 +02:00
Günther Brammer b4e37b070b Change all indentation with spaces to use tabs instead
This is a whitespace-only patch. Hopefully, it'll only affect rarely-changed
parts of the engine, since all regularly maintained pieces should already
use tabs.
2010-03-27 17:05:02 +01:00
Günther Brammer e30ff99d6a Remove all superflous #include <Standard.h>
Standard.h is included by C4Include.h, and every file includes that.
2010-03-04 22:11:12 +01:00
Benjamin Herr f3b35227ea avoid lots of gcc warnings 2010-01-25 05:00:59 +01:00
Armin Burgmeier 3ef547e58a Fix the build on Linux 2010-01-25 20:17:29 +01:00
Nicolas Hake be39732a8f Implemented fixed ordering in DirectoryIterator
This should alleviate loading order differences from different
OSes somewhat. Since the iterator currently employs a lexicographic
ordering, there are probably still problems when one player has
their packages unpacked, while another one has theirs packed.

This should go away once we employ a sane format for game packages.
2010-01-25 16:54:38 +01:00
Tobias Zwick edec15d64f merge 2009-11-30 17:24:14 +01:00
Nicolas Hake f0fdf5e992 Prepare for precompiled headers 2009-10-20 05:39:24 +02:00