View Single Post
Old February 19, 2018, 09:06   #8
Join Date: May 2016
Posts: 306
t4nk is on a distinguished road
Another thing I've noticed is that J (shift+j, run to the south in roguelike keyset) doesn't make @ run, but instead drops stuff from inventory (edit: now that I look at the stack trace, I realize that @ sets traps ). And sometimes it makes the program crash (in x11). Backtrace:
Program received signal SIGSEGV, Segmentation fault.
book_sort_comp_hook (u=0x7fffffffdcb0,
    v=<optimized out>, a=<optimized out>, b=<optimized out>)
          at object2.c:9763
9763			if (s1_ptr->cast[i].class == *why) break;
(gdb) bt
#0  book_sort_comp_hook (u=0x7fffffffdcb0,
        v=<optimized out>, a=<optimized out>, b=<optimized out>)
            at object2.c:9763
#1  0x0000555555693bf2 in ang_sort_aux (u=u@entry=0x7fffffffdcb0,
        v=v@entry=0x7fffffffdc3e, p=p@entry=0, q=29)
            at xtra2.c:4187
#2  0x0000555555693c6a in ang_sort (u=u@entry=0x7fffffffdcb0,
        v=v@entry=0x7fffffffdc3e, n=<optimized out>)
            at xtra2.c:4221
#3  0x0000555555632a3e in fill_book (o_ptr=o_ptr@entry=0x7ffff7f6e0a8,
        book=book@entry=0x7fffffffdcb0, num=num@entry=0x7fffffffdca0)
            at object2.c:9912
#4  0x000055555559bea9 in get_spell (sn=sn@entry=0x7fffffffdf1c,
        prompt=prompt@entry=0x5555556c3f55 "use",
        o_ptr=0x7ffff7f6e0a8, known=known@entry=0 '\000')
            at cmd5.c:163
#5  0x000055555563130a in pick_trap (y=9, x=39, player=player@entry=1 '\001')
            at object2.c:8143
#6  0x0000555555587381 in player_set_trap_or_spike (item=<optimized out>) at cmd2.c:2912
#7  0x000055555559ef7d in do_cmd_item (command=command@entry=41) at cmd6.c:254
#8  0x00005555555a3392 in process_command () at dungeon.c:2458
#9  0x00005555555a8725 in process_player () at dungeon.c:3286
#10 dungeon () at dungeon.c:3659
#11 play_game (new_game=<optimized out>) at dungeon.c:4094
#12 0x000055555556da4d in main (argc=1, argv=0x7fffffffe268) at main.c:614
Originally Posted by droof View Post
Those explicit fallthroughs were GCC 7 warnings, but I think they are convenient. I might've fixed one code bug while conservatively checking and adding them. I wanted to remove all kinds of warnings, so I can easily spot any mistakes I'd make in the code and fix anything that could overflow. Unangband crashed occasionally and I didn't experience that with my version anymore. But I should've removed the -g -Werror flags before releasing. I should probably suppress all warnings for release.
Or you can just
#ifndef RELEASE
    __attribute__ ((fallthrough));
Or some such, and then compile with -DRELEASE for release.

I tried to add unicode symbols for some terrain and monsters using char32_t, where unicode fits in a single char or single array element for convenience. But I had a lot of trouble with integrating it and unicode icons are very incomplete on my system. 95% of the useful animal icons are missing. So I might drop this idea.
Yes. The C language doesn't have much support for Unicode. As for symbols, that depends on the font, some are more capable than others. I think ultimately, .png tilesheet is the right (and easiest) way for a roguelike game, or, alternatively, libfreetype + some font guaranteed to have necessary symbols, distributed with the game (and not some default one from x11 or terminal emulator on the user's system, since you don't know what that might be).

Maybe I should expand the "display monster" terminal in favor of my integrated sidebar, since terminals are more dynamic and are the standard in angband variants probably for a good reason.
Well, the reason is that it was easy to do it like that...

Not single-window integrated UI elements like GCU and Sangband SDL, although I'm used to single-window integration because most other games I play do that.
Multiple windows some have drawbacks: their decorations (the header, with the "close" and "minimize" and other buttons) take some space, and they look unprofessional and lazy (which is true ). Few applications use multiple windows, even though it's easy, and the users always demand "docked" mode (some examples: Lazarus (IDE for Pascal), GNU Image Manipulation Program).
I'm pretty sure most people prefer single window UI (I'm one of them).

Last edited by t4nk; February 19, 2018 at 09:15.
t4nk is offline   Reply With Quote