Commit graph

86 commits

Author SHA1 Message Date
Kp 599ac9dee0 Always qualify valptridx type/factory
Previously, valptridx used PREFIX for allow-invalid+mutable, c#PREFIX
for allow-invalid+const, v#PREFIX for require-valid+mutable, vc#PREFIX
for require-valid+const.  Convert the types, factories, and all usage
sites to specify a qualifier for all four combinations:

	im#PREFIX -> allow-invalid+mutable
	ic#PREFIX -> allow-invalid+const
	vm#PREFIX -> require-valid+mutable
	vc#PREFIX -> require-valid+const

Changes to common/include/valptridx.h and common/include/fwd-valptridx.h
are manual.  All other changes are generated by:

	git grep -lz -e '\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\>' | xargs -0 sed -i -e 's/\<\(v\?\)\(\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\)\>/\1m\2/g'

for the 'm' prefix and:

	git grep -lz -e '\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\>' | xargs -0 sed -i -e 's/\<\([cm]\(obj\|seg\|clwall\|wall\|actdoor\|trg\)\(ptridx\|ptr\|idx\)\(_t\)\?\)\>/i&/g'

for the 'i' prefix.
2017-06-10 03:31:02 +00:00
Kp b5915abdcc Change station/robotmaker consistency check to LevelError 2017-04-15 17:46:44 +00:00
Kp 829e95b6f8 Separate hoard/proximity tracking 2017-03-18 18:07:36 +00:00
Kp a815541ef5 Fix check_header_includes=1 poison.h 2017-02-19 19:33:36 +00:00
Chris Taylor 30b5ef7c73 Create robot_create function and use it 4x
Contains 2 calls - to obj_create and init_ai_object. For safety reasons and tidiness compared to using obj_create directly. The call to init_ai_object in recreate_thief was already redundant.
2017-01-22 17:56:50 +08:00
Kp baa187801b Add special case to make past releases not die on various segnums
All releases to date have a bug where they treat certain segment number
fields as an int, not a segment number.  Storing segment_none (0xffff)
into the save file causes affected releases to crash in various places
because it fails to recognize that this is segment_none.

Current code correctly treats segment_none as a non-segment and works
correctly without this hack.  The hack is only required to get past
releases to work correctly after loading a saved game written by current
code.
2017-01-21 19:05:43 +00:00
Kp 29b9c255fa Remove unnecessary FuelCenter operator- 2016-12-22 05:21:16 +00:00
Kp 5a69c09ec2 Move fuelcen_activate special assignment up
One caller uses fuelcen_activate when segp->special != station_type.
Every other caller passes the type that was already on the segment.
Move the assignment into the one caller that needs it, then remove the
argument.
2016-10-29 23:16:17 +00:00
Kp c4cfe54010 Return literal object_none on object_none error path
gcc generates better code for:

	if (variable == magic_constant)
		return magic_constant;

than it does for:

	if (variable == magic_constant)
	    return variable;

even though the two have the same result.  Switch to the form which
generates slightly better code.
2016-10-29 23:16:15 +00:00
Kp ce65735c04 Expand get_local_player_flags
It was a convenient transition macro, but its presence was always
intended to be temporary.  Expand it to ease the conversion of usage
sites that already have access to local player data through a local
variable.
2016-10-02 00:34:40 +00:00
Kp 1b321ac0c6 Expand get_local_player_secondary_ammo
It was a convenient transition macro, but its presence was always
intended to be temporary.  Expand it to ease the conversion of usage
sites that already have access to local player data through a local
variable.
2016-10-02 00:34:40 +00:00
Kp 6a3ded191f Move EDITOR to dxxsconf.h; rename to DXX_USE_EDITOR
Rename symbol EDITOR to DXX_USE_EDITOR to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -wl EDITOR -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(EDITOR\)\>/#if DXX_USE_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(EDITOR\))/#\1if \2DXX_USE_\3/' -e 's/^\s*#ifndef \(EDITOR\)\>/#if !DXX_USE_\1/'
2016-09-11 18:49:16 +00:00
Kp 99bbd0cf26 Mark global constants as constexpr
s/^const \([^*]*=.*;\)/constexpr \1/
2016-07-23 04:10:42 +00:00
Kp c636dc4b98 Convert various static const expressions to constexpr 2016-07-16 16:52:04 +00:00
zico 901a554e96 New powerup management code: Addeed functions and packet type to keep track of original and current level inventory as well as player and thief inventories. Calling maybe_drop_net_powerup() for all ammo based weapons except Concussion missiles. Limiting maybe_drop_net_powerup() to only spawn items missing from initial level inventory. Added function to let host respawn items that were lost for whatever reason. Expanded maybe_drop_net_powerup() and child functions to be able to drop item based on a random player. Changed back maybe_drop_secondary_weapon_egg() to its original behavior, dropping 3 of each type max. 2016-02-25 14:11:08 +01:00
Kp 2fd6a425b0 Remove highest_valid 2016-02-12 04:02:28 +00:00
Kp b57f08c798 Use partial_const_range 2016-02-12 04:02:28 +00:00
Kp 86709f547b Fix capitalization of PHYSFS_File
Per comment in physfs.h, the spelling PHYSFS_file is deprecated.
Replace all instances with PHYSFS_File.
2016-01-09 16:38:14 +00:00
Kp a3ae630829 Remove default argument for basic_ptridx(index) 2016-01-09 16:38:14 +00:00
Kp 98f5afa9f8 Remove default argument for basic_ptr(pointer,array &) 2016-01-09 16:38:13 +00:00
Kp e8c34be843 Use v*ptr* factories with highest_valid 2015-12-22 04:18:51 +00:00
Kp db9fb0ed42 Move more symbols into namespace dcx/dsx 2015-12-22 04:18:50 +00:00
Kp 2b51578ba6 Use enum class for Player_dead_state (formerly Player_is_dead) 2015-12-15 04:09:35 +00:00
Kp 6b353cb9ac Move player powerup_flags to object.ctype.player_info 2015-11-07 21:55:59 +00:00
Kp 17b8b64980 Use macro get_local_player_flags for player's flags 2015-10-30 02:52:56 +00:00
Kp dc5dfb80e8 Use macro get_local_player_secondary_ammo for player's secondary_ammo 2015-10-30 02:52:56 +00:00
Kp 48af374924 Reduce direct use of Segments[] 2015-10-21 02:45:43 +00:00
Kp de3575a647 Shorten fuelcen_check_for_goal 2015-09-26 21:17:13 +00:00
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 423c1c3f10 Use range_for for fuelcen.cpp 2015-08-22 20:43:03 +00:00
Kp f15116f2cb Simplify multiplayer sound handling 2015-08-05 02:59:02 +00:00
Kp bda7fef3a0 Use get_local_player to compute reference to local player 2015-07-25 23:10:46 +00:00
Kp 1378ec2176 Remove unused Fuelcen_refill_speed
Fixes: 0df3209fad ("Remove unused energy center capacity tracking")
2015-07-21 02:57:27 +00:00
Kp 374145633b Use valptr for fuelcen.cpp 2015-07-12 01:04:19 +00:00
Kp aa890e5d29 Pass only valptr_t to fuelcen_delete 2015-07-12 01:04:18 +00:00
Kp f20892e24f Remove write-only PlayerSegment 2015-07-10 03:22:27 +00:00
Kp 0df3209fad Remove unused energy center capacity tracking 2015-07-10 03:22:26 +00:00
Kp 9d5bc102ab Use valptr for fuelcen highest_valid 2015-06-13 22:42:17 +00:00
Kp 9a4f7a32bf Pass vcsegptr to fuelcen_give_fuel 2015-05-09 17:39:00 +00:00
Kp f15ec9c86a Use enum for AIM constants 2015-04-26 20:15:51 +00:00
Kp e883d7c872 Use enum class for AIB constants 2015-04-26 20:15:51 +00:00
Kp 5ae5033fed Use enum for AIB constants 2015-04-02 02:36:57 +00:00
Kp 2c09f9fa90 Propagate special types for distance/magnitude 2015-03-12 02:21:19 +00:00
Kp 99a4a0ed62 Capture range_for by-value temporaries as const
Modifying a by-value temporary does not affect the underlying container,
so modifying it is almost always a bug.  Require use of a by-reference
capture when modification is desired.

sed -i -e 's/range_for\s*(\s*\(const\s\+\)\?auto\s\+\([[:alpha:]_]\)/range_for (const auto \2/g'
2015-02-05 03:03:49 +00:00
Kp 6c857b038d Undefine Station,RobotCenters,Vertices,Segments,Objects at level load 2015-02-01 23:07:18 +00:00
Kp 2d8f8b5d4a Reduce inclusion of wall.h 2014-12-22 04:35:49 +00:00
Kp d63be88eb0 Propagate use of vsegptridx_t 2014-11-23 04:58:45 +00:00
Kp 2c349136cc Avoid slicing into segnum_t local 2014-11-20 03:00:36 +00:00
Kp 6d61198130 Pass compute_segment_center vector by & 2014-10-30 03:32:51 +00:00
Kp 5bb9c88979 Add vm_vec_sub that returns result 2014-10-29 03:24:31 +00:00