Commit Graph

251 Commits (master)

Author SHA1 Message Date
Lukas Werling 6d5dc2b92e c4group -l: Print both file and contents CRC
The contents CRC is the number that actually counts for group equality,
whereas the file CRC may differ, for example because of different
compression.
2018-04-21 21:41:28 +02:00
Kanibal f24d685a47 win32: fix handling of forward slashes 2018-03-15 23:49:00 +01:00
Sven Eberhardt 0c50e81413 Scenario list loader: Ignore .ocd and .ocg files when looking recursively for scenarios 2017-07-11 20:45:57 -07: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
Julius Michaelis d81a7f10e3 Silence a lot of inconsistent-missing-override warnings 2017-02-21 19:03:46 +01:00
Sven Eberhardt 22306bd266 Editor: Add templates for new scenarios 2017-02-05 16:08:29 -05:00
Nicolas Hake 9bddba53df Improve CStdStream const correctness 2017-02-05 13:26:24 +01:00
Nicolas Hake b0898f4e1a C4Group: Pull most the data members out of the header 2017-02-05 13:26:23 +01:00
Nicolas Hake bcbd368ffd C4Group: Rename "Status" enum to "SourceType" 2017-02-05 13:20:18 +01:00
Nicolas Hake c73fed8aa6 C4Group: Make more stuff private
C4Update needs to access some internal data of C4Group and uses a
special derived class (C4GroupEx). Make everything it doesn't want to
tamper with private so it's more obvious what is and isn't accessed from
outside the class.
2017-01-07 13:41:50 +01:00
Nicolas Hake aef2705825 C4Group: Delete some dead code
The pByChild parameter to C4Group::AdvanceFilePtr was never used except
to pass it to itself recursively, and C4Group::ProcessOut was never used
at all.
2017-01-07 13:41:48 +01:00
Lukas Werling d84c9b174f Add warning for non-UTF-8 files 2016-12-13 22:40:51 +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 8f47edc1e3 Fix destruction order of system string table vs. editor
Depending on the mood of the linker, the editor may have been
constructed before and destroyed after the system-wide string table
because they weren't defined in the same file. Destruction of the editor
tries to load some strings, which would then access the already
destroyed string table and thus crash.
2016-10-16 18:40:51 +02:00
Sven Eberhardt 9d715387f2 Qt editor: Store and restore window layout (docked dialogues, etc.) 2016-08-08 23:57:24 -04:00
Sven Eberhardt 5db45c0f47 Merge branch 'master' into qteditor 2016-08-06 21:45:19 -04:00
Nicolas Hake 0cbb476daf Remove re namespace alias
This alias is a legacy from when we were using Boost.Regexp to
workaround a broken implementation in GCC's libstdc++ earlier than 4.9.
2016-07-25 18:39:44 +02:00
Sven Eberhardt a7aa89f168 Merge branch 'master' into qteditor
Conflicts:
	planet/Objects.ocd/Structures.ocd/StoneDoor.ocd/SpinWheel.ocd/Script.c
	src/platform/C4WindowSDL.cpp
	src/script/C4AulParse.cpp
	src/script/C4Effect.cpp
2016-06-20 22:27:03 -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
Sven Eberhardt b70882d7fa Editor: Object scaling+rotation 2016-06-17 00:07:49 -04: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
Günther Brammer a19e7f6ced Use #elif defined() to check for config.h macros instead of plain #elif
This way, the code works with a config.h that does not define those macros.
2016-01-23 23:05:16 +01:00
Sven Eberhardt 3f7bd627de Fix int type in group info display format. 2016-01-09 00:19:39 -04:00
Nicolas Hake 9b34bf2634 Remove arbitrary inline forward declarations of StdBuf (and derivatives) 2015-12-29 21:42:46 +01:00
Nicolas Hake c0befc6ba0 Remove C4RTF
The only use of C4RTF in its final moments was parsing out plain text
from RTF files anyway, so why even go to all the trouble instead of just
storing plain text in the beginning?
2015-12-29 17:51:43 +01:00
Nicolas Hake 500229c302 C4Extra: Make ownership of ExtraGroups more explicit 2015-12-29 13:56:06 +01:00
Nicolas Hake d0cd244077 C4Extra: Merge ctor/Default, dtor/Clear 2015-12-29 02:59:02 +01:00
Sven Eberhardt 171080cbd5 Play frontend music by tag. 2015-12-12 12:08:45 -05:00
Sven Eberhardt 96082569bd Allow sounds in subfolders and create namespaces for them (#1185) 2015-12-06 23:44:41 -05:00
Nicolas Hake 24b54211c5 Drop Min, Max, Swap for std::min, std::max, std::swap
The C++ standard library comes with perfectly fine implementations of
these functions, so there's no point in reimplementing them just for the
hell of it.
2015-11-15 13:53:01 +01:00
Nicolas Hake 8fc57b69c3 Don't ZeroMem non-POD types
Using memset to initialize non-POD types doesn't work. Or rather, it may
work right now, but will fail when somebody adds a member that relies on
its constructor doing something (like for example any STL container).
Either way it's undefined behavior and needs to go. Furthermore, using
it to reinitialize an object also prevents any dtors from doing their
work when needed.

A new helper function InplaceReconstruct will take an object of nothrow-
default-constructible type, and call the dtor to properly clean up
before placement-new reconstructing the object in the same location.
This is still bad design, but unfortunately removing the Default/Clear
functions from every object currently using them is a herculean task.
2015-11-14 16:43:19 +01:00
Nicolas Hake 1bc2d41368 C4Group: Remove unused time offset
Four years ago, we made c4group stop caring about time. Now it doesn't
need to carry a completely unused offset value around anymore.
2015-11-14 16:19:58 +01:00
Nicolas Hake 715d3f34dd Remove obsolete declaration of C4Group_SetOriginal
This function hasn't existed for five years. It's time for the
declaration to go away.
2015-11-14 16:19:58 +01:00
Sven Eberhardt fe05fb5b1a Fix loading of shape textures from packed groups (#1421). 2015-10-15 20:29:56 -04:00
Sven Eberhardt 47e422f452 Rework and document texture shapes.
* Renamed from material shapes to textures shapes
* No per-texture, so the same material can use different shapes with different textures
* Load a shape image instead of text file with vector components
* Allow texture sizes that are not multiple of the map zoom
* Add minimum overlap parameter to draw shapes only when the given overlap is reached.
2015-10-09 00:16:24 -04:00
Peter Wortmann f0030e33e0 Warning fixes
Actually pretty sure a few of them were bugs. Hopefully no new
ones were introduced here.
2015-10-03 15:32:39 +01:00
Sven Eberhardt 1f46a9004c Fix some erroneous file orders causing group rewinds. 2015-09-22 23:47:06 -04:00
Sven Eberhardt 80fe1aa658 Avoid some C4Group rewinds in scenario list and player loading. 2015-09-10 22:32:51 -04:00
Sven Eberhardt 283277ac82 Do not pre-load file contents from unpacked music folders ($1378).
Removes several seconds from startup time and ~150MB memory usage. Note that tags are still loaded so all file headers do have to be accessed.
2015-09-06 00:02:17 -04:00
Sven Eberhardt 5ec9999d4c Fix crash on global or scenario script reload.
The string table of System.ocg scripts (except the global System.ocg) pointed to nowhere after the initial load phase, but is still required for reload. Added a ref counting option to keep these string tables alive.
2015-08-20 13:15:11 -04:00
Armin Burgmeier 006cf68874 Some refactoring, and restore support for Map.bmp
The new behaviour that allows 255 mat-tex combinations (once we increased
C4M_MaxTexCount...) is enabled with MapFg.bmp, and then MapBg.bmp can be
used to draw IFT or other fancy things.
2015-08-04 21:21:23 -04:00
Armin Burgmeier eb98e73b76 Introduce background map
The background landscape is generated from the background map.
2015-08-04 21:21:23 -04:00
Armin Burgmeier 54666aeb2d Introduce background landscape
The background landscape is a 8-bit landscape which stores the material
that a particular pixel will be replaced with when it is cleared, e.g.
by digging or blasting.

This is just the groundwork for this and does not offer much advantage
over the IFT flag that was used previously for that purpose. However,
additional features such as keeping the background material/texture
fixed when loam bridges are built, PXS are incorporated into the landscape
or the massmover is moving things around can be added.

See http://bugs.openclonk.org/view.php?id=1338 for more details.
2015-08-04 21:20:06 -04: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
Sven Eberhardt 90cca08d63 Add /todo message board command.
Adds text to local TODO.txt file. Useful for taking notes quickly e.g. when testing new scenarios in a network game.

TODO filenames are configurable. Default file is TODO.txt in the scenario file (if it's unpacked) and TODO.txt on the current path if access to the first location failed.
2015-03-05 16:04:07 +01:00
Nicolas Hake 09ad403d06 C4Group: Stop checking operator new return value
new throws std::bad_alloc on failure. It never returns NULL, so checking
for that is useless.
2015-02-13 19:46:11 +01:00