![]() |
#41 | |
NPPAngband Maintainer
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
![]() |
Quote:
155 * C++ defines its own bool type, so we hack around it */ 156 #undef bool 157 #define bool bool_hack a coule lines later, bool is re-defined anyway, either through stdbool.h, or it is defined as a char for the systems that don't have STDBOOH_H... /* * Use a real bool type where possible */ #ifdef HAVE_STDBOOL_H #include <stdbool.h> #define TRUE true #define FALSE false #else /* Use a char otherwise */ typedef char bool; #undef TRUE #undef FALSE #define TRUE 1 #define FALSE 0 |
|
![]() |
![]() |
![]() |
#42 | |
Veteran
Join Date: Apr 2007
Posts: 1,950
Donated: $40
![]() |
Quote:
__________________
takkaria whispers something about options. -more- |
|
![]() |
![]() |
![]() |
#43 | |
NPPAngband Maintainer
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
![]() |
Quote:
That line gave me half of a page of compiler errors. "bool_hack" doesn't seem to be defined or exist anywhere else in the angband source. Actually, according to google, it doesn't exist anywhere else in the world either. So I removed it and all the compiler errors went away. Am I missing something & do I need bool_hack defined? Am I reading that other code correctly? It looks like the line before undefines bool, and a couple lines later, if HAVE_STDBOOL_H, bool is defined by stdbool.h, and if I don't, it is defined as a bool. So why would bool_hack need to be defined? Thanks. |
|
![]() |
![]() |
![]() |
#44 | |
Knight
Join Date: Apr 2007
Posts: 590
![]() |
Quote:
1) ditch the #define (which invokes undefined behavior all versions of C++) 2) only bother with typedef'ing bool in C 3) Keep the rest of the code.
__________________
Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg. Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.) Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011 |
|
![]() |
![]() |
![]() |
#45 |
Prophet
Join Date: Apr 2007
Location: Seattle, WA
Posts: 6,726
Donated: $40
![]() |
A better workaround is to ditch all the stuff around bool, and change the compiler option -c89... to -c99
Then do a global replace TRUE by true and FALSE by false. The messing around with non-standard boolean types is a highly undesirable archaism. |
![]() |
![]() |
![]() |
#46 |
Knight
Join Date: Apr 2007
Posts: 590
![]() |
Requiring C99 means dropping support for both MSVC (C89 compiler only) and native MingW32 (recent standard header releases don't compile as C99).
__________________
Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg. Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.) Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011 |
![]() |
![]() |
![]() |
#47 |
Prophet
Join Date: Apr 2007
Location: Seattle, WA
Posts: 6,726
Donated: $40
![]() |
MSVC doesn't support full c99, but it does support the intersection of c99 with C++.
So bool is ok, but it's a built-in. (Dont' include stdbool.h) |
![]() |
![]() |
![]() |
#48 |
NPPAngband Maintainer
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
![]() |
I have a bug that should be simple to fix, but I don't know where to do it.
The game crashes if I use the up, down, left, or right direction keys on my keyboard without the numlock on, but the diagonal direction keys work fine. It crashes on this line, in textui_process_command. assert(p_ptr->command_cmd >= CHAR_MIN && p_ptr->command_cmd <= CHAR_MAX); If the numlock is on, the p_ptr->command is 59, and if numlock is off, the direction keys are between 138-141, and the game crashes. Again, the diagonal keys work fine either way Isn't there a pref file that converts certain keyboard commands like this? I know the 138 is above the 127 limit, but I can't figure out why it would be crashing the game. I have assert.h declared in h-basic.h just like in Angband. Any thoughts or suggestions? I am stumped. Thanks. |
![]() |
![]() |
![]() |
#49 | |
Vanilla maintainer
Join Date: Apr 2007
Location: Canberra, Australia
Age: 57
Posts: 9,465
Donated: $60
![]() ![]() |
Quote:
If I understand assert correctly, that is what it does - if the condition is not satisfied, it terminates the program. Good luck ![]()
__________________
One for the Dark Lord on his dark throne In the Land of Mordor where the Shadows lie. |
|
![]() |
![]() |
![]() |
#50 |
NPPAngband Maintainer
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
![]() |
Thanks! With that help I found it. Strangely, utting in the updated pref-win.prf fromthe current angband into NPP causes the crashes. If I keep the current one from NPPAngband it works fine.
|
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Trying to understand Ranger playing mechanics | dormouse | Vanilla | 5 | December 15, 2009 11:43 |
Angband Code Interface to GUI | meeshoo | Vanilla | 50 | February 3, 2009 17:18 |
I finally understand how diving quicker can be "safer" | Wraitheist | Vanilla | 13 | September 19, 2008 17:25 |
strange C code in Angband (am I reading this right?) | will_asher | Idle chatter | 3 | February 4, 2008 09:07 |
Angband source branches vs trac | ctate | Vanilla | 1 | July 14, 2007 11:43 |