Commit graph

65 commits

Author SHA1 Message Date
Kp b282bea173 Rewrite simple integer casts from C style to static_cast<>
This pass only targets commonly used standard types.

s/(\(\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\)\s*)\s*(/static_cast<\1>(/g
2016-06-05 01:04:26 +00:00
Kp 7fdce88558 Add parentheses around target of simple casts
C casts do not require parentheses.  C++ casts require grouping around
the target.  Prepare for conversion to C++ casts by adding otherwise
unnecessary parentheses around the target of simple C casts.

This pass does not attempt to process expressions that involve
any subexpression that can nest arbitrarily, such as parentheses or
brackets.  It also works only on commonly used standard types.

	(int) a->b;	// changed
	(int) a[b];	// not changed

s/\((\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\s*\**\s*)\s*\)\([&+-]\?\)\([[:alnum:]_.]\+\s*->\s*\)*\([[:alnum:]_.]\+\)\(\s*\([];+>)*\/^%,|&<>]\)\|$\|\(\s*-\s*[^>]\)\)/\1(\5\6\7)\8/g
2016-06-05 01:04:25 +00:00
Kp dcc56e6b39 Propagate bm_mode::linear into iff_read_bitmap 2016-05-28 17:31:27 +00:00
Kp c00f918a8e Propagate bm_mode::linear into bald_guy_load 2016-05-28 17:31:26 +00:00
Kp 3fb16c1d7a Propagate bm_mode::linear into pcx_read_bitmap 2016-05-28 17:31:26 +00:00
Kp 398596c468 Use enum for bitmap mode 2016-05-28 17:31:26 +00:00
Kp b57f08c798 Use partial_const_range 2016-02-12 04:02:28 +00:00
Kp 1f91897f5d Move some game symbols to namespaces 2016-01-09 16:38:12 +00:00
Kp cbd2cd7c54 Move SysNoTitles to CArg 2015-12-24 04:01:27 +00:00
Kp 61fe046ba2 Reuse show_first_found_title_screen for Descent 1
This avoids an Error call if none of the titles are available.
2015-10-09 02:46:11 +00:00
Kp 29f79f0a6b Enable -notitles for Descent 2 2015-10-09 02:46:09 +00:00
Kp 6224b53581 Use operator?: for flash_cursor gr_set_fontcolor 2015-09-29 02:41:22 +00:00
Kp d9cef82f81 Allow nullptr for gr_get_string_size 2015-09-29 02:41:22 +00:00
Kp 17b1943c5e Mark various per-file structures as static 2015-08-12 03:11:46 +00:00
Kp 5573ed6bea Cache font scale X float 2015-06-13 22:42:20 +00:00
Kp 6792c1bc4b Enable -Wunused-parameter 2015-04-26 20:15:56 +00:00
Kp 6b6eaef226 Include polyobj.h from robot.h
Swap the inclusion order since all robots are polyobjects, but not all
polyobjects are robots.
2015-04-02 02:36:57 +00:00
Kp ae8b99ae7d Use RAIIdigi_sound for briefing printing_channel 2015-04-02 02:36:55 +00:00
Kp b60c603e21 Avoid redundant PHYSFSX_exists checks 2015-04-02 02:36:55 +00:00
Kp 61ee6463aa Remove unused show_title_screen return value 2015-04-02 02:36:55 +00:00
Kp b36ce28382 Remove unnecessary strcpy in titles.cpp 2015-04-02 02:36:55 +00:00
Kp 66806e1f34 Enable -Wmissing-braces
clang includes it in -Wall, so add it for gcc
2015-04-02 02:36:52 +00:00
Bradley Bell 51de6c80b5 Don't play chattering over D1 briefing music. 2015-02-08 12:26:36 -08:00
Bradley Bell 2b4aba341d Properly scale and simplify arithmetic for briefing bitmap.
Constrain by screen height, by just using rescale_y for width and height.
Then use show_fullscr to fill the destination canvas.
2015-02-07 22:48:04 -08:00
Bradley Bell 33f0731d11 Remap briefing bitmap. 2015-02-07 22:47:18 -08: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 31450e4843 Pass iff_read_bitmap arg by & 2015-01-25 05:32:44 +00:00
Kp 40fd988a0f Hide local classes in anonymous namespaces 2015-01-23 03:55:06 +00:00
Kp 84e3a03451 Remove unused parameters 2015-01-18 01:58:33 +00:00
Kp f7815810e8 Use RAIIPHYSFS_File to manage PHYSFS_File
Fixes a few leaks on error paths.
2015-01-17 18:31:42 +00:00
Kp 68d705a85a Use bool conversion to test PHYSFS_File pointer 2015-01-17 18:31:42 +00:00
Kp 28a31a223f Centralize window_close calls 2015-01-17 18:31:41 +00:00
Kp fccb6814f8 Pass gr_create_sub_canvas arg by & 2015-01-17 18:31:40 +00:00
Kp fcc4f7dba5 Use unique_ptr for briefing_screen
Add workaround for briefing use of global Briefing_screens.
2015-01-17 18:31:40 +00:00
Kp 80aa48efb4 Pass digi_*_start_sound soundobj as sound_object* 2014-12-14 05:22:59 +00:00
Kp c990701d87 Pass show_fullscr arg by & 2014-12-02 03:35:01 +00:00
Kp c89e3b7452 Pass gr_bitmapm arg as & 2014-12-02 03:35:01 +00:00
Kp 95539512d5 Pass pcx_read_bitmap arg by & 2014-12-02 03:35:01 +00:00
Kp 594c597621 Pass gr_init_bitmap_data arg by & 2014-11-30 22:09:20 +00:00
Kp 97332b848c Pass gr_free_bitmap_data arg by & 2014-11-30 22:09:20 +00:00
Kp ad35ff421e Use new/delete for title_screen 2014-11-30 22:09:19 +00:00
Kp 166f15617d Pass ogl_ubitmapm_cs arg by & 2014-11-30 22:09:18 +00:00
Kp fb1704780b Move pMovie into local data structures 2014-10-29 03:01:18 +00:00
Kp a8f853aa7a Pass d_event arg by const& 2014-10-04 22:36:13 +00:00
Kp a02f78a171 Move saving window pointer into helper 2014-09-07 19:04:07 +00:00
Kp ff31905181 Use unique_ptr for grs_subcanvas 2014-09-07 19:04:06 +00:00
Kp 94550355a8 Use make_unique instead of bare new 2014-08-24 18:28:09 +00:00
Kp 4029de77b0 Fix array underrun in redraw_messagestream 2014-08-08 02:54:50 +00:00
Kp f47aa29cd9 Use color_t for color values 2014-08-08 02:07:47 +00:00
Kp 4acbb40ad7 Use enum for window event result 2014-08-07 02:47:48 +00:00