Commit Graph
49 Commits
Author SHA1 Message Date
SHIRAKATA Kentaro 79927d70a0 remove the code for embedding SCCS ID
This code is for UNIXy build, but current UNIXy builds define GCC_WARN,
so this is never used.

(After all, embedding SCCS ID itself is out of date.)
2022-10-31 15:57:28 +09:00
SHIRAKATA Kentaro 2a8ddf1145 remove duplicate code
Here, `then` clause and `else` clause is identical.
2022-09-21 17:00:01 -07:00
SHIRAKATA Kentaro 4e3fc4dcb0 remove unnecessary if 2022-08-19 06:22:01 -07:00
SHIRAKATA Kentaro b3b09bca5a split "letknow" into separate function 2022-07-22 13:07:22 -07:00
SHIRAKATA Kentaro 58b32e76f0 split starving dog into separate function 2022-07-20 14:40:50 -07:00
SHIRAKATA Kentaro 8a78442e2d remove unnecessary code on destroy_one_item()
`physical_damage` is initialized to FALSE, and no codes change it.
2022-06-28 12:52:06 -07:00
SHIRAKATA Kentaro a377a1fc67 split displaying trap map into separate function 2022-06-28 12:39:38 -07:00
SHIRAKATA Kentaro 20fa315bfc fix warnings 2022-06-11 17:18:34 +09:00
SHIRAKATA Kentaro d23f26077b remove unnecessary null-check on parsesymbols()
`strval` here is always non-null,
because the null-check is done in earlier code.
2022-06-08 05:28:32 +09:00
SHIRAKATA Kentaro ed7fb3895f split cleaning-up on gd_move() into separate function 2022-06-06 20:28:21 +09:00
SHIRAKATA Kentaro 4faf79dccc fix memory leaks related to selection_new()
selection_new() returns an address of malloc()'ed buffer.
If ov is null, this value is discarded without freeing the buffer.
To avoid this, move null-checks before calling selection_new().

Also, remove null-check of the return value of selection_new()
because it always returns non-null.
2022-06-01 21:38:51 +09:00
SHIRAKATA Kentaro 95fdd85b82 split "act_on_act" into separate function 2022-05-29 06:40:44 +09:00
SHIRAKATA Kentaro 3baa00bb1e adjust the function name in impossible() 2022-05-21 00:33:53 +09:00
SHIRAKATA Kentaro 0315cd876a split fixing curse trouble into separate function 2022-05-19 02:42:31 +09:00
SHIRAKATA Kentaro 0b00f97766 kickobjnam on dokick() is assigned only kicking object 2022-05-13 15:51:08 -07:00
SHIRAKATA Kentaro 4da4584633 split getting damages with a kick into separate function 2022-05-10 05:45:39 +09:00
SHIRAKATA Kentaro 037683581f split adjusting attributes into separate function 2022-05-09 20:38:15 +09:00
SHIRAKATA Kentaro 317bc9b3c2 split kicking empty space into separate function 2022-05-07 21:12:01 +09:00
SHIRAKATA Kentaro 397476a8a1 update condition for displaying on #version 2022-05-03 14:39:24 -07:00
SHIRAKATA Kentaro 1a361af084 add msghandler support for win32 2022-05-03 14:39:24 -07:00
SHIRAKATA Kentaro d6079b4ccb Separate some codes for desecratintg high altar
... and remove one goto.
2022-04-29 23:22:19 -07:00
SHIRAKATA Kentaro 0be21a231c remove redundant condition on tty_add_menu()
`newstr` is assigned to `str` or `buf`.
`buf` is an address of an array, and `str` is guarded,
so both are non-NULL.
2022-04-29 23:08:17 -07:00
SHIRAKATA Kentaro 4a79d4195a remove unnecessary null-check on wc_set_window_colors()
mungspaces() returns its argument itself, so `newop` is assigned to `buf`, and always non-null.
`tfg` and `tbg` is assigned to (some addition of) `newop`, so these are also always non-null.
2022-04-24 00:08:52 -07:00
SHIRAKATA Kentaro 949c30dffa remove redundant condition on adj_pit_checks()
supporting is never null, as outer if statement checks it.
2022-04-20 00:00:46 -07:00
SHIRAKATA Kentaro 8497b1c8ec Separate function for offering too soon 2022-04-08 09:39:30 -07:00
SHIRAKATA Kentaro 367ea0e6d6 add initializer on use_tinning_kit()
If poly_when_stoned() is true, an uninitialized buffer kbuf[] is passed to instapetrify().
Although instapetrify() doesn't access it in that situation for now,
it should be initialized anyway for readability.
2022-03-25 15:47:51 +09:00
SHIRAKATA Kentaro 291d872f62 move null-check on savelev()
Move null-check of ttmp before its first use.
2022-03-24 04:16:16 +09:00
SHIRAKATA Kentaro 1c7faa0585 Add explicit cast to void
All other these calls not using a return value have a cast.
2022-03-19 20:50:40 +09:00
SHIRAKATA Kentaro b82f5fa28f remove redundant null-check on untrap_prob()
`ttmp` should not be NULL here, otherwise this function will crash at earlier code.
2022-03-11 09:56:35 -08:00
SHIRAKATA Kentaro 467777539e add explicit cast on somexy() call
All other somexy() calls not using a return value have a cast.
2022-03-10 06:12:01 +09:00
SHIRAKATA Kentaro 757139476f move validations before their first use 2022-02-25 22:41:21 -08:00
SHIRAKATA Kentaro dc7d434f98 add missing initializer of jcp 2022-02-20 14:43:33 -08:00
SHIRAKATA Kentaro bb5150445a Check the return value of nhl_init() on com_pager_core()
nhl_init() can return NULL.
2022-02-12 07:45:46 -08:00
SHIRAKATA Kentaro 7c1dba3f0b remove redundant null-check on christen_orc()
rndorcname() returns buf2 itself, so orcname is never NULL.
2022-02-11 16:52:50 +09:00
SHIRAKATA Kentaro 9bd8bcdcfb move null-check on tin_details()
Move null-check of obj and buf before their first use.
2022-02-10 05:16:29 +09:00
SHIRAKATA Kentaro 128966bfe1 move null-check on savelev()
Move null-check of nhfp before its first use.
2022-02-10 01:25:13 +09:00
SHIRAKATA Kentaro b55954b2a1 Add null-check on repairable_damage()
Add null-check of dam before its first use.
2022-02-09 05:54:27 +09:00
SHIRAKATA Kentaro cf4cc3fa93 add null-check on fill_special_room()
Add null-check of croom before its first use.
2022-02-08 17:20:50 +09:00
SHIRAKATA Kentaro b87dd4423b remove redundant code
The values of lx and ly are always assigned just before their usage.
So, assignments in advance are redundant.
2022-02-05 20:31:17 +09:00
SHIRAKATA Kentaro cf810630de add missing const
If you want to declare a pointer which the address pointed to is constant,
you should declare it as like `static const char *const var = "...";`.

This commit supplies missing `const` and prevents some programming
error in the future.
2022-01-29 11:13:01 -08:00
SHIRAKATA Kentaro a2a40c6b0b fix typo in Guidebook.tex 2022-01-10 21:36:16 +09:00
SHIRAKATA Kentaro 546377581a use %d for short
obj->otyp is short, so corresponding format string is %d.

(from Coverity Scan)
2021-11-24 06:30:00 +09:00
SHIRAKATA Kentaro bfd79f5c9d use %lu for unsigned long
`curr->tid` is unsigned long, so use `%lu`.
2021-10-23 01:07:40 +09:00
SHIRAKATA Kentaro 62e6b5a336 guard lua_close()
nhl_done() can be called with L == NULL.
So lua_close() should be guarded.
2021-10-22 02:13:17 +09:00
SHIRAKATA Kentaro 1f651f8f00 initialize attknum
`attknum` is declared without initialization, and is used on
find_roll_to_hit().  This leads unexpected result.
2021-10-21 08:48:23 -04:00
SHIRAKATA Kentaro 0f36d7ac6e revert MAX_RADIUS change
On 59818fb, MAX_RADIUS was changed from 15 to 16 to intend to support
"radius 0".  But MAX_RADIUS doesn't means the range but outer bound of
the radius table, so it should not be changed, and this change led
possible out-of-bound access on view_from() and do_clear_area() in
vision.c.

This commit reverts the change and avoids the problem.
2021-10-21 08:48:23 -04:00
SHIRAKATA Kentaro ed543d7832 fix pointer precedence 2021-10-21 17:41:13 +09:00
SHIRAKATA Kentaro 96679152ef Supply missing changes
Some changes applied to Guidebook.mn were not applied to Guidebook.tex.
This commit supplies them.
2021-09-25 23:28:16 +09:00
SHIRAKATA Kentaro 83c626b707 delete extra lines 2021-09-23 03:30:57 +09:00