Commit Graph

53 Commits (60841c1d96073b0adbb687f29dfc059619ad3919)

Author SHA1 Message Date
Lukas Werling 60841c1d96 Write text files with unix file endings
The old LineFeed constant caused problems with Qt. Using \n directly is
easier and I don't think there's a reason left to use \r\n anyways.
We've always converted the files in the repository. Nowadays, even
notepad.exe works with unix file endings.
2019-02-19 15:28:12 +01:00
Maikel de Vries 0d58380dbf unify two implementations of Angle in the engine
There seems to be no reason to have two different implementation and the one in FnAngle seemed the most sane and complete one.
2017-07-19 22:04:43 +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
Nicolas Hake c5ed6e7dc8 Move strprintf to Standard
strprintf works like asprintf, except it returns a std::string.
2017-03-16 18:51:16 +01:00
Nicolas Hake 168824a603 Win32: Use _vsprintf_p instead of v(a)s(n)printf (#1892)
This makes it possible to use positional parameters in format strings on
all platforms.
2017-02-19 12:57:27 +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 5bdddff139 Remove MS CRT memory management debugging
Redefining new breaks perfectly valid code, but only on MSVC and only in
one particular configuration (Debug). This is very annoying because it
means people not using MSVC, or even people doing Release builds, can
write standards-conforming code which then may fail to build for other
people.
2016-07-25 18:39:44 +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
Nicolas Hake 0067a6dbfe Drop several unused string manipulation functions
To wit: SCompare, SCopyPrecedingIdentifier, SCopyNamedSegment,
SSearchIdentifier, SSearchFunction and SRemoveComments.
2015-11-15 16:16:36 +01:00
Nicolas Hake a3b7b66386 Drop "Toggle" helper function
Toggling a boolean is trivial enough to not really warrant a helper
function.
2015-11-15 16:15:25 +01: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 a2f06c6ac5 Move ForLine function into C4Landscape.cpp
C4Landscape is the sole consumer of this function, so there's no reason
to make it available outside.
2015-02-23 13:39:51 +01:00
Nicolas Hake ff263e5433 Fix potential buffer overflow in ssprintf
If vsnprintf fails for other reasons than too small a buffer, it returns
a negative value. Comparing that with a size_t value promotes the
negative value to unsigned, which makes for a very large result, almost
guaranteed to be larger than the buffer size.
2015-02-12 23:55:38 +01:00
Nicolas Hake 95641b5fb0 Add a dummy declaration to ssprintf
G++ doesn't allow attributes on function definitions for reasons. Add a
declaration immediately before the definition so it works.
2015-02-12 23:14:16 +01:00
Nicolas Hake e21a5bdd44 Rename BoundBy to Clamp
"BoundBy" sounds like a predicate. "Clamp" is a common function name for
the operation in graphics processing, so it should be familiar to users.
2015-02-12 23:05:55 +01:00
Nicolas Hake 35e7ca509b Replace NoPointer struct with template parameter deduction
We're trying to ensure that no caller passes a char* to ssprintf, but a
char array instead. This is way easier done by using template parameter
deduction than a specialized class template.
2015-02-12 22:25:36 +01: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 9bc61db360 copyright notices update 2011 2011-09-01 16:58:52 +02:00
Günther Brammer fadacd3bb4 Move StrToI32 to lib/ 2011-05-01 18:55:02 +02:00
Günther Brammer 21e28a4689 Script: Use Unicode instead of Byte strings
Internally, strings are UTF-8 as before, but GetChar returns an
Unicode code point instead of a byte from the UTF-8 encoded string,
and Format("%c") takes an Unicode code point as well.
2011-03-10 00:26:31 +01:00
Nicolas Hake c4276e84c4 Split UTF-8 validation out of StdStrBuf 2011-04-05 20:58:40 +02:00
Günther Brammer 81d64df737 Do not use Windows' RGB macros for BGR colors 2011-03-11 03:37:27 +01:00
Günther Brammer e80a39dd09 Remove some dead code 2011-03-09 23:30:23 +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
Günther Brammer 3342509880 Fix a potential infinite loop in the landscape.txt interpreter 2010-04-25 14:27:06 +02:00
Nicolas Hake 46ece7030e Use <cmath> M_PI instead of own "pi" constant
This solves a conflict with a definition with the same name within Apple SDK
headers (thanks, Mortimer)
2010-04-24 17:40:41 +02:00
Nicolas Hake 5dc0d3b4cb Reduce value truncation warnings 2010-04-20 18:20:24 +02:00
Benjamin Herr 5cdbd907c8 Make some src/lib headers compile on their own 2010-03-29 01:58:02 +02:00
Benjamin Herr 27287b981f Reformat everything according to style guidelines
as per http://forum.openclonk.org/topic_show.pl?tid=208
and http://wiki.openclonk.org/w/Style_Guidelines
via astyle
  --brackets=break
  --indent=tab=2
  --keep-one-line-statements
  --keep-one-line-blocks
  --indent-namespaces
  --convert-tabs
  --recursive
  --exclude=zlib
  --exclude=tinyxml
  src/\*.h src/*.cpp
2010-03-28 19:58:21 +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
Sven Eberhardt f32a4547e3 fix edit cursor highlight on zoomed object (#176)
MSVC assertion fix
2010-03-25 20:57:08 +01:00
Günther Brammer 2a99ad1d39 Split Standard.h into two: Miscellanous utility and platform abstraction 2010-03-08 23:59:11 +01:00
Günther Brammer ed66b27cf3 Finally move the Log() declaration where it belongs
In the old days, the code was split in two parts - C4* files in one part
and the other files. Long, long ago, the other files were presumably used
by other programs, but that wasn't true since the GWE at least. But the
split was maintained, except for the Log functions. Now that everything
is one giant bunch anyway, the Log functions can be declared in C4Log.h
again.
2010-03-04 22:16:55 +01:00
Nicolas Hake 0b137e8cd5 msvc: Build fixes for x64 compatibility
I don't know whether it works, because I don't have 64 bit libraries at the
moment. But at least the syntax errors are gone.
2010-02-27 14:48:01 +01:00
Günther Brammer ff8d950e85 Remove C4ENGINE define
Most files using it weren't used by c4group-the-application anymore, and
the remaining stuff can be dealt with by using stubs or the same code in
both cases.
2010-02-17 22:59:46 +01:00
Günther Brammer a16df97a95 Various cleanups in the platform code 2010-02-16 02:54:02 +01:00
Peter Wortmann 7ed1264518 Optimize rotated solid masks some more 2009-09-19 23:20:32 +02:00
Nicolas Hake 583f8e9799 Add deprecation macro 2010-01-25 04:14:53 +01:00
Nicolas Hake b1f0c3e1c6 Remove a49cc8f3de41 and add more solid fix 2010-01-24 02:48:55 +01:00
Nicolas Hake d6c50df936 Revive ssize_t definition for non-GNU targets 2010-01-04 03:18:28 +01:00
Günther Brammer d4cb25cf39 Reorganize C4Include.h and Standard.h
All plattform stuff is now in Standard.h, while C4Include.h just includes
a bunch of headers. Mostly headers from the standard library, because
those change very seldom.

Also remove the ptrdiff_t typedef, properly include <cstddef> instead.
2010-01-02 01:11:54 +01:00
mizipzor a53dae0c1b Fixed compilation in MSVC2010 2009-11-25 19:38:54 +01:00
Nicolas Hake 55c86b2001 MSVC: Re-enable deprecation warnings
The reason those were disabled have been warnings about not using MSVC's
"secure" CRT functions and non-standard-C POSIX functions. Those warnings
have been disabled selectively by command line macro definitions.
2009-11-12 14:14:08 +01:00
Nicolas Hake 4bda27997c win32: Allow windowed mode
Frontend dialogs aren't resized since they would have to be destroyed
and re-created in the current implementation; this should change to an
auto-layouter as in other widget toolkits.
This is an OS independent problem though.
2009-10-23 03:53:16 +02:00
Armin Burgmeier 809c2234cd Merged alphafix into default
This reverts the meaning of alpha components everywhere in engine and script.
alpha=0 means transparent, and alpha=255 means opaque.
2009-09-19 12:08:09 -04:00
Günther Brammer dddf9ef00a Change all lineendings to LF (except in planet/) 2009-09-16 03:29:20 +02:00
David Dormagen a886a18180 replaced remaining TRUE and FALSE (both are invalid now) 2009-09-05 19:22:54 +02:00
Armin Burgmeier 4573315d42 Reverted meaning of alpha: Now 255 is opaque and 0 is transparent
Shader and D3D remains to be adapted yet.
2009-08-23 17:46:56 -04:00