Repository navigation
Remove dead stores from the options and status builders - #52
Conversation
Critlist
left a comment
There was a problem hiding this comment.
Thanks for this one! You're right that these are dead stores, but most of them are original 1.0.3 lines. Since restoHack is focused on preserving the original source, I'd like to leave those lines intact:
bchx -= ddx; bchy -= ddy;inbchit()(hack.apply.c)mon = 0;andmon = 0; /* he died */indothrow()(hack.do.c)magr->data = pa = &dog;/&la_doginhitmm()(hack.fight.c)struct obj *otmp = fobj;instackobj()(hack.invent.c)nk = 1;andnk = u.nr_killed[tmp](hack.mon.c)
The len += ones in the options and status code are ours, though, so those are fair game.
Could you trim this down to just the modern ones? The compiler drops the original stores anyway, so there's no cost to leaving them. If any of them trip a warning you'd like gone, wrapping them in a /* Original 1984: ... */ comment is totally fine. If you're ever unsure, the untouched source is in docs/historical/original-source/.
276e2c0 to
472b828
Compare
|
Thanks, this is exactly what I asked for! One catch, though, and it's my fault for merging in this order: #59 just landed, and it changed Could you rebase onto master and drop the |
8975bfd to
472b828
Compare
Only the modern code is touched: the trailing len/remaining updates that nothing reads while building the options string. The 1984 dead stores in bchit(), dothrow(), hitmm(), stackobj() and killed() stay as they are; the compiler drops them anyway and the original source is the point. The status-line half is left out: since Critlist#59 bot() appends at newbot + len, so len is live there and the updates cannot be dropped.
472b828 to
f2e9622
Compare
|
Rebased onto master and dropped the |
Trimmed to the modern code only: the trailing
len/remainingupdates in the options string and status line that nothing reads. The 1984 dead stores inbchit(),dothrow(),hitmm(),stackobj()andkilled()are untouched. Verified: GCC 14 and Clang 22 build with no warnings.