Commit graph

1925 commits

Author SHA1 Message Date
Kp c4a8432081 Remove WORDS_NEED_ALIGNMENT memcpy src cast to const uint8_t*
The cast provokes a warning on systems that require alignment, so remove
it.  memcpy takes const void* input, so the cast is unnecessary.

Reported-by: MattWatt <https://github.com/dxx-rebirth/dxx-rebirth/issues/119>
2015-09-13 21:02:19 +00:00
Kp fb5ae4e0bc Fix various header freestanding issues 2015-09-09 03:27:52 +00:00
zico 4a562bf098 Added multi_send_theif_frame() function to update thief bot more frequently (by PPS) and even if it is not controlled by a player to counter discrepancies caused by client side AI movement of the bot 2015-09-03 15:13:56 +02:00
Kp fd5d7b800d Move reactor gun loop into calc_controlcen_gun_point 2015-08-26 03:15:10 +00:00
Kp d3ca71c8d0 Inline get_num_reactor_models 2015-08-26 03:15:10 +00:00
Kp 9ca2bc20c6 Use DXX_CONSTANT_TRUE for valptridx static checks 2015-08-22 20:43:04 +00:00
Kp 9ed4754009 Remove typedef valptridx<T>::array_managed_type managed_type##_array_t 2015-08-22 20:43:04 +00:00
Kp 2833e81ab4 Disallow copying vptr factories 2015-08-22 20:43:04 +00:00
Kp e6fab164ae Remove valptridx internal use of operator-(ptr,array) 2015-08-22 20:43:04 +00:00
Kp 2155c417cb Move array_managed_type into valptridx<T> 2015-08-22 20:43:04 +00:00
Kp f8008ca34f Only define object_array_t::object_array_t if VALGRIND 2015-08-22 20:43:04 +00:00
Kp 946048c54b Move valptridx subtypes to individual fwd headers 2015-08-22 20:43:04 +00:00
Kp a126f72bef Remove array for basic_ptr(basic_ptr<rpolicy>,array) 2015-08-22 20:43:04 +00:00
Kp a606b89fe8 Make robot_flags unsigned 2015-08-22 20:43:03 +00:00
Kp b946011299 Remove non-GNU PIGGY_PAGE_IN
Non-GNU PIGGY_PAGE_IN uses a do {} while(0), but some callers are in a
context where do{}while() is an error.
2015-08-22 20:43:03 +00:00
Kp b8baddb5a2 Use uint8_t for player_awareness_type_t
Fixes: 9157e5f970 ("Use enum class for player_awareness_type_t")
2015-08-22 20:43:02 +00:00
Kp 64ff1cda89 Only restore non-alpha when alpha was used 2015-08-21 03:12:35 +00:00
Kp fcfd3d7e54 Cast valptridx size_t to unsigned long for Windows
Windows has `typedef unsigned size_t`, so %lu triggers a format warning
for Windows targets.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/116>
2015-08-19 02:42:49 +00:00
Kp be3ab3bd81 Use range_for in PHYSFSX_checkMatchingExtension 2015-08-14 03:02:04 +00:00
Kp e5683593ef Expand ZERO_VECTOR inline 2015-08-13 03:15:53 +00:00
Kp 4f871c43fe Add compile-time check for non-overlapping vm_matrix_x_matrix 2015-08-13 03:15:52 +00:00
Kp 17b1943c5e Mark various per-file structures as static 2015-08-12 03:11:46 +00:00
Kp bc7c469ab2 Use array<> for more globals 2015-08-12 03:11:46 +00:00
Kp fa9f2e626d Move DbgShowMemInfo to CArg
Members of Arg are not visible to common code, so common/mem/mem.cpp
broke during the -Wodr cleanup.

Reported-by: zicodxx <https://github.com/dxx-rebirth/dxx-rebirth/issues/114>
Fixes: 6bd93e466f ("Guard args.h for LTO -Wodr")
2015-08-11 03:05:55 +00:00
Kp 0a3de25d7a Flatten valptridx ptr/idx further
Use a dummy template parameter to prevent slicing, instead of an extra
class in the inheritance chain.  This improves the generated code
slightly.
2015-08-07 03:13:51 +00:00
Kp 3458454f7e Flatten valptridx hierarchy 2015-08-06 02:57:59 +00:00
Kp b3d1c6efaa Use helper for valptridx array size checks 2015-08-06 02:57:58 +00:00
Kp e3dbe7a07c Add workaround for gcc-4.7 type inheritance quirk
In gcc-4.7, a type inherited via using is distinct from a type defined
by using.

	$ cat t.cpp
	template <typename>
	class A
	{
	public:
	    typedef void a;
	    typedef void b;
	};

	template <typename T>
	class B : protected A<T>
	{
	protected:
	    using typename A<T>::a;
	    using b = typename A<T>::b;
	public:
	    static inline a f1();
	    static inline b f2();
	};

	template <typename T>
	typename B<T>::a B<T>::f1() {}	// fails for gcc-4.7, works in later

	template <typename T>
	typename B<T>::b B<T>::f2() {}	// works in both

	$ gcc-4.7 -Wall -Wextra -std=gnu++0x -O2 -c t.cpp
	t.cpp:21:18: error: prototype for 'typename B<T>::a B<T>::f1()' does not match any in class 'B<T>'
	t.cpp:16:18: error: candidate is: static typename A<T>::a B<T>::f1()
	t.cpp:16:18: warning: inline function 'static typename A<T>::a B<T>::f1() [with T = int; typename A<T>::a = void]' used but never defined [enabled by default]

	$ gcc-4.8 -Wall -Wextra -std=gnu++0x -O2 -c t.cpp
	$

Fixes: 8b7c5c3e2b ("Rewrite valptridx")
2015-08-05 02:59:03 +00:00
Kp f15116f2cb Simplify multiplayer sound handling 2015-08-05 02:59:02 +00:00
Kp 6870b48710 Remove unused return value of digi_link_sound_to_object* 2015-08-05 02:59:02 +00:00
Kp 9fb9aef509 Remove unused return value of digi_link_sound_to_pos 2015-08-05 02:59:02 +00:00
Kp c47b7e383f Make template alias support mandatory 2015-08-03 03:11:25 +00:00
Kp 20b1db3483 Expand dxx_explicit_operator_bool to "explicit"
Many files now use "explicit", so compilers which reject
explicit operator bool() will not work.  Remove the macro.
2015-08-03 03:11:25 +00:00
Kp 2fb03da475 Inline multi_send_endlevel_start secret for D2 2015-08-03 03:11:25 +00:00
Kp 978cf91a96 Reduce partial_range error argument shuffling 2015-08-03 03:11:24 +00:00
Kp eb5fcb34e6 Remove default argument for basic_ptr(reference,array) 2015-07-29 03:05:28 +00:00
Kp e0e1b28c72 Remove default argument for basic_ptr(reference,index,array) 2015-07-29 03:05:28 +00:00
Kp 84bd64a14c Remove default argument for basic_ptridx(magic,array) 2015-07-29 03:05:28 +00:00
Kp ba38214bab Remove default argument for basic_ptridx(pointer,index,array) 2015-07-29 03:05:28 +00:00
Kp 4d8ae44794 Add helper macro DXX_CONSTANT_TRUE 2015-07-29 03:05:28 +00:00
Kp a2816617fe Pass reactor& to read_model_guns 2015-07-25 23:10:48 +00:00
Kp c9dff229f1 Remove dead AI fire leading code 2015-07-25 23:10:47 +00:00
Kp 822f8ad5c0 Use __builtin_object_size to check some unchecked ranges 2015-07-25 23:10:47 +00:00
Kp 2f847030ce Combine partial_range_error reporting
Use iterator type instead of container type, so that T[1] and T[2] use
the same reporting function.  This saves ~7k in an LTO build.
2015-07-25 23:10:47 +00:00
Kp 3f6a402bfd Include bound in partial_range always_error function name 2015-07-25 23:10:47 +00:00
Kp 9a5654e002 Move similar/editor/autosave.cpp -> common/editor/autosave.cpp 2015-07-25 23:10:47 +00:00
Kp 720cc9db98 Move tmap scanline pointers to structure 2015-07-25 23:10:47 +00:00
Kp 1738870b22 Make some c_tmap scanline functions static 2015-07-25 23:10:47 +00:00
Kp c942d28197 Use accessor for grs_bitmap::bm_type 2015-07-25 23:10:47 +00:00
Kp b7838318b1 Fix valptridx for -fno-inline 2015-07-25 23:10:46 +00:00
Kp b8cc2f4172 Inline multi_i_am_master 2015-07-25 23:10:46 +00:00
Kp bda7fef3a0 Use get_local_player to compute reference to local player 2015-07-25 23:10:46 +00:00
Kp f38e80c053 Use get_local_plrobj to compute reference to object of local player 2015-07-25 23:10:45 +00:00
Kp f00725f740 Use forward-declaration header for player.h 2015-07-25 23:10:45 +00:00
Kp 70c4cc87ab Use forward-declaration header for weapon.h 2015-07-25 23:10:45 +00:00
Kp f899aaeaca Move player callsign to player-callsign.h 2015-07-25 23:10:45 +00:00
Kp 9bfea35e4f Use forward-declaration header for gr.h 2015-07-25 23:10:45 +00:00
Kp 15fb75c1c7 Fix check_header_includes build 2015-07-25 23:10:45 +00:00
Kp cdb113a050 Diagnose including compiler-type_traits without dxxsconf.h 2015-07-25 23:10:45 +00:00
Kp 8594086b23 Move magic_constant definition into valptridx 2015-07-21 02:57:27 +00:00
Kp 644c80e632 Pass vsegptr to add_stuck_object 2015-07-21 02:57:27 +00:00
Kp 1f301770d7 Remove always-NULL gr_bitblt_fade_table 2015-07-21 02:57:27 +00:00
Kp 82e1ea5636 Move similar/mem/mem.cpp -> common/mem/mem.cpp 2015-07-18 21:01:56 +00:00
Kp a58e8f87a0 Move similar/misc/hash.cpp -> common/misc/hash.cpp 2015-07-18 21:01:56 +00:00
Kp cfdffa184f Move similar/arch/sdl/event.cpp -> common/arch/sdl/event.cpp 2015-07-18 21:01:56 +00:00
Kp 04d9f82a50 Move similar/arch/sdl/key.cpp -> common/arch/sdl/key.cpp 2015-07-18 21:01:56 +00:00
Kp c7542fe9fc Move similar/arch/sdl/mouse.cpp -> common/arch/sdl/mouse.cpp 2015-07-18 21:01:56 +00:00
Kp d8f28a8767 Move Cfg::Grabinput to CCfg to improve code sharing 2015-07-18 21:01:56 +00:00
Kp 6bd93e466f Guard args.h for LTO -Wodr 2015-07-18 21:01:56 +00:00
Kp 3015db64ad Guard segment.h for LTO -Wodr 2015-07-18 21:01:55 +00:00
Kp 4c200342dd Use range_for for PHYSFS archive types 2015-07-18 21:01:55 +00:00
Kp 095e64fd5a Support serializing enum class 2015-07-18 21:01:55 +00:00
Kp d3df8b8e83 Fix LTO -Wodr for cheats 2015-07-18 03:49:47 +00:00
Kp bbcdf9f7d2 Fix LTO -Wodr for GameCfg 2015-07-18 03:49:47 +00:00
Kp 19ed586988 SDL2: SDL_JoystickName parameter changed 2015-07-14 02:42:12 +00:00
Kp b822f4c049 Simplify joystick setup 2015-07-14 02:42:12 +00:00
Kp 7a16099aaf Fix gcc-4.6 cmd build
gcc-4.6 lacks forward_list<T>::splice_after(iterator, forward_list&).
Add an explicit std::move to help it.
2015-07-14 02:42:12 +00:00
Kp 7dd310c8e9 Use helper macro for reading/writing short in rle 2015-07-14 02:42:12 +00:00
Kp 1c5399427a Work around clang name lookup bug #13983
clang searches scopes in the wrong order, causing strange failures when
an inner template has a parameter with the same name as a type in an
outer scope.

clang bug report: <https://llvm.org/bugs/show_bug.cgi?id=13983>
2015-07-13 01:09:37 +00:00
Kp 6c94416a90 Pass array from ptridx factory 2015-07-13 01:09:37 +00:00
Kp fa8dcc9113 Explicitly delete basic_ptridx(pointer_type); require array
Require the array argument for basic_ptridx, which is supplied
automatically when the factory is used.
2015-07-13 01:09:37 +00:00
Kp 1adb56f16b Make draw_mine_all static 2015-07-13 01:09:36 +00:00
Kp ff5bb37c5c Combine basic_ptr_global_factory, basic_vptridx_global_factory 2015-07-13 01:09:36 +00:00
Kp 73fdd59225 Require exact type for valptridx factory 2015-07-13 01:09:36 +00:00
Kp 745de17c41 Use T::index_type for highest_valid 2015-07-13 01:09:36 +00:00
Kp 012b65a37c Pass vcobjptridx to check_trigger 2015-07-12 01:04:22 +00:00
Kp 13bcdcf0ca Use valptr for fireball.cpp 2015-07-12 01:04:19 +00:00
Kp fdd2356eac Use segptridx for Cursegp, Markedsegp 2015-07-12 01:04:18 +00:00
Kp aa890e5d29 Pass only valptr_t to fuelcen_delete 2015-07-12 01:04:18 +00:00
Kp a8fadce19f Pass only vobjptr_t to obj_unlink 2015-07-12 01:04:17 +00:00
Kp e54b550c59 Pass only vobjptr_t to multi_reset_player_object 2015-07-12 01:04:17 +00:00
Kp 1b6999ff4d Switch get_seg_masks from vcsegptridx_t to vcsegptr_t
The index component is not needed.
2015-07-12 01:04:17 +00:00
Kp 8b7c5c3e2b Rewrite valptridx
Move decisions out to policy classes.  Provide trivial copy
construction/assignment.  Simplify checking for unsafe conversions.
2015-07-09 03:12:45 +00:00
Kp 658102a868 Improve static_assert test
Previously, SConstruct tested whether static_assert worked with trivial
constant expressions.  Extend the test to more complicated expressions
like the ones used in the program.

Replace the typedef based approach with an inline enum to avoid warnings
about unused local typedefs.

Allow use with compilers that lack working static_assert or that cannot
accept complicated expressions.  Add a non-checking definition that uses
the input parameter.  This prevents warnings when types or constants are
used only for the static_assert.
2015-07-09 03:12:45 +00:00
Kp 4a742e3fc4 Parenthesize static_assert expression
When static_assert is a macro, it must have two arguments as seen by the
preprocessor.  Add an identity mapping to the native case to enforce
this, and fix up all the sites that break with the new rule.
2015-07-09 03:12:45 +00:00
Kp fe360b18e3 Implement secluded spawns 2015-07-04 21:01:18 +00:00
Kp c03fe30fc2 Move similar/arch/sdl/timer.cpp -> common/arch/sdl/timer.cpp 2015-07-04 21:01:17 +00:00
Kp d73e5a24c3 Reduce scope of ifdef(D1||D2) 2015-07-04 21:01:17 +00:00
Kp f42a3fe241 Improve Cfg locality 2015-07-04 21:01:17 +00:00
Kp 06b453d617 Enable D1 weapon drops 2015-07-02 02:37:55 +00:00