Commit graph

174 commits

Author SHA1 Message Date
Kp 2e88fec559 Flatten some ui type hierarchy 2016-08-06 19:55:24 +00:00
Kp c636dc4b98 Convert various static const expressions to constexpr 2016-07-16 16:52:04 +00:00
Kp b6fd8572d1 Simplify ui_radio_set_value loop 2016-07-06 01:54:25 +00:00
Kp e92a7aea14 Use C++ static_cast for gadget downcast 2016-07-06 01:54:25 +00:00
Kp 65f68877aa 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-16 03:56:44 +00:00
Kp 1b12a3f7ef Add parentheses around target of more complicated 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 some C casts.

This pass attempts to process expressions that involve parenthesized or
bracketed subexpressions, but only if those subexpressions do not
themselves contain parenthesized or bracketed subexpressions.

	(int) f(1);	// changed
	(int) f(g());	// not changed

perl -p -i -e '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*-\s*[^>]))/\1\(\3\4\5\6\)\7/g'
2016-06-12 03:45:37 +00:00
Kp bc30ccd216 Rewrite cast of (sbyte) to standard type int8_t
s/(sbyte)\s*\(\w\)/(int8_t) \1/g
2016-06-12 03:45:37 +00:00
Kp 1789643480 Remove UserError on unknown MED function
Jayman2000 reports that users who do not update their MED.MNU after
updating to 8b61b9f ("Remove unused symbols") receive an "editor crash"
on startup.  This is not a crash, but instead is poor error handling in
menubar.cpp, which calls UserError instead of ignoring the offending
line.  Calls to UserError are fatal, but do not crash the program.
Replace that call with a con_printf(CON_URGENT) and ignore the line.

Additionally, change the handling for excess menus and for excess menu
items to con_printf+ignore instead of UserError.

Reported-by: Jayman2000 <https://github.com/dxx-rebirth/dxx-rebirth/pull/190>
Fixes: 8b61b9f0db ("Remove unused symbols")
2016-04-03 17:50:42 +00:00
Kp 27cef20eb3 Move namespace dsx handling to dsx-ns.h 2016-03-19 19:08:10 +00:00
Kp 08de1bbff0 Remove cv_color
It is only ever set to 0 or copied from other canvases.  Set it to zero
everywhere.
2016-02-12 04:02:28 +00:00
Kp f4e1ebb576 Remove unnecessary gr_setcolor calls 2016-02-12 04:02:28 +00:00
Kp e09a590e6f Pass color to Vline 2016-02-12 04:02:28 +00:00
Kp 76d0e01b6e Pass color to Hline 2016-02-12 04:02:28 +00:00
Kp de08a67321 Pass color to gr_ubox 2016-02-12 04:02:28 +00:00
Kp 23047b1165 Pass color to gr_rect 2016-02-12 04:02:28 +00:00
Kp 35a4736df0 Pass color to gr_urect 2016-02-12 04:02:28 +00:00
Kp 053901b62b Pass color to gr_uline 2016-02-12 04:02:28 +00:00
Kp b57f08c798 Use partial_const_range 2016-02-12 04:02:28 +00:00
Kp eb3fe7acdb Remove sprintf from menubar.cpp 2016-01-09 16:38:16 +00:00
Kp dc8c0323d8 Uninline namespace dcx 2015-12-13 18:00:49 +00:00
Kp 22bd3ce8d8 Use inline namespace dcx for common/ui 2015-12-05 22:57:24 +00:00
Kp ed55763603 Remove unused symbols 2015-12-04 03:36:31 +00:00
Kp dad504cfef Fix some -Wshadow warnings 2015-11-26 02:56:54 +00:00
Kp 50f672ba34 Reuse computed string length 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 968cdbecf4 Add non-aborting UserError for user-caused fatal errors 2015-06-16 03:15:40 +00:00
Kp 06c363fb19 Fix UI_GADGET -fno-inline build
Fixes: 95e3ac1e5b ("Use integral_constant for UI kind")
2015-06-11 03:06:58 +00:00
Kp 25186ca984 Remove write-only keyd_last_released 2015-05-28 03:08:38 +00:00
Kp badad2ef33 Remove write-only keyd_last_pressed 2015-05-28 03:08:38 +00:00
Kp bdee338e34 Preserve array size for ui_get_filename 2015-05-09 17:38:58 +00:00
Kp 649993982f Enable tail call optimization in menubar_close 2015-05-09 17:38:58 +00:00
Kp fc4b686d9d Store PHYSFS_list element count in list when needed 2015-05-09 17:38:57 +00:00
Kp 1d08cb6058 Fix file_get*list nullptr without constructor inheritance 2015-05-05 03:20:42 +00:00
Kp c3925353fd Use null_sentinel_iterator for PHYSFS_list_t 2015-04-26 20:15:51 +00:00
Kp 143c536c77 Use PHYSFS_list_t for more functions 2015-04-26 20:15:50 +00:00
Kp 44adc83ca4 Use std::remove_if in file_get*list 2015-04-26 20:15:50 +00:00
Kp f00ec13c0f Use std::move_backward for file_getdirlist 2015-04-26 20:15:50 +00:00
Kp 08ee591e21 Fix ODR collision between ui/file browser and main/menu browser 2015-04-22 02:44:30 +00:00
Kp 150e2d2686 Convert local arrays to array<> 2015-04-19 04:18:49 +00:00
Kp 2f92078413 Move ui_add_gadget_scrollbar arrows off stack 2015-04-02 02:36:56 +00:00
Kp f88eaf43ac Make UI_GADGET_LISTBOX char* const 2015-04-02 02:36:54 +00:00
Kp 92b6cd3883 Replace ui_create_dialog specialization with helper
Rename ui_create_dialog<void *> specialization with free function
untyped_ui_create_dialog.  GCC 4.6 incorrectly considers a
specialization to be a redundant declaration, causing a
-Wredundant-decls failure with the specialization form.

Fixes: be041a9cfc ("Add type checking for ui_create_dialog")
2015-04-02 02:36:52 +00:00
Kp d04e7902ee Make file_get*list static 2015-03-22 18:49:21 +00:00
Kp 383e7703b6 Use ntstring in file_getdirlist 2015-03-22 18:49:21 +00:00
Kp fca381727c Add wrappers for screen width/height 2015-03-22 18:49:21 +00:00
Kp f900d4a5ee Remove RAIIdmem::operator pointer
Mac OS X defines uint_fast32_t to unsigned int, causing ambiguous
overloads between RAIIdmem::operator[](std::size_t) and
RAIIdmem::operator[](int).  Adding a disambiguating overload for OS X
breaks Windows.  Remove operator pointer and operator[].  Rely on the
inherited operator[] for indexing.  Require users to call ->get() to
convert to a simple pointer.

First btb ambiguity reported: https://github.com/dxx-rebirth/dxx-rebirth/pull/34
Second btb ambiguity reported: https://github.com/dxx-rebirth/dxx-rebirth/pull/43
2015-02-17 03:52:59 +00:00
Kp f38aec1212 Remove string copying in GetKeyDescription 2015-01-29 04:27:35 +00:00
Kp 71ec47b32e Refactor ui_pad_activate 2015-01-29 04:27:35 +00:00
Kp ff4a0ccd70 Fix RAIIdmem array usage
Some RAIIdmem instances managed a T[], but were declared to manage a T.
2015-01-28 03:42:53 +00:00