![]() |
#1 |
DaJAngband Maintainer
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 927
Donated: $10
![]() |
code help please
It took me a good bit of trial and error to figure out how to assign a random name to an individual ego item so that it looks like a randart. After a while, I finally got it to work, but now I can't save it in the savefile.
I have the random name saved as: char o_ptr->randego_name How can I save that in the savefile with the rest of the o_ptr stuff? There's wr_byte and wr_s16b, etc. but no wr_char, and I don't know how to make one. EDIT: If someone could do me a huge favor and write a wr_char function (and probably a rd_char function for load.c) for me, I'd be very grateful. All of the wr_xxxx functions are at the top of save.c. Last edited by will_asher; March 3, 2010 at 09:20. |
![]() |
![]() |
![]() |
#2 | |
Veteran
Join Date: Apr 2007
Posts: 1,947
Donated: $40
![]() |
Quote:
__________________
takkaria whispers something about options. -more- |
|
![]() |
![]() |
![]() |
#3 |
DaJAngband Maintainer
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 927
Donated: $10
![]() |
Whatever will allow me to save those random names in the savefile would be awesome.
EDIT: Oh. I just noticed there's already an wr_string() which I hadn't noticed. Would I need to declare o_ptr->randego_name as a cptr instead of a char? I don't know the difference between cptr and char. (The computer with my current DaJAngband stuff is not available at the moment or I'd go ahead and try it). |
![]() |
![]() |
![]() |
#4 | |
Hellband maintainer
Join Date: Jul 2007
Location: New York, the Big Apple
Age: 43
Posts: 367
Donated: $120
![]() |
Quote:
T.
__________________
* Are you ready for something else ? Hellband 0.8.8 is out! * |
|
![]() |
![]() |
![]() |
#5 |
DaJAngband Maintainer
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 927
Donated: $10
![]() |
How do I find this bug?
Okay, now I have a completely different coding-related problem:
I had a game of DaJAngband on an older computer where I found a crash bug. So I brought the savefile over to the computer with my compiler/debugger on it to look for the bug, and it didn't crash. I tried making sure the old computer had the newest compile and the exact same files. So the two computers were using the exact same .exe file, the exact same files in the lib folder, and the exact same savefile, but it crashed on the older computer and didn't crash on the computer that has my compiler/debugger on it. I haven't ever knowingly changed anything platform-specific in the code. Both computers are using Windows (although the older one has XP and the newer one has Vista). I don't understand why it would crash on one computer and not the other. How would I go about finding this bug? |
![]() |
![]() |
![]() |
#6 |
Prophet
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,912
Donated: $40
![]() |
If you have a working debugger, you can just track down where it crashes and see what caused the crash. If you don't (can't get gdb to work, etc), you may need to install Visual Studio Express and debug with that. It takes a while to get set up, but learning to debug with VS is a lot easer than with gdb.
Oh yeah, and if you do get it to work, please make the project file available for Angband. Things would be easier on windows if VS were officially supported. |
![]() |
![]() |
![]() |
#7 | |
DaJAngband Maintainer
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 927
Donated: $10
![]() |
Quote:
I had been using VS on (yet) another computer, but that computer kindof died, and I had problems installing VS on the computer I'm using now so I went back to using Dev C++. Its debugger isn't as good, but it does have one. |
|
![]() |
![]() |
![]() |
#8 | |
Prophet
Join Date: Mar 2008
Posts: 2,712
![]() |
Quote:
You might try to track down recent fixes to V that fix these kinds of bugs. Perhaps someone with a better memory can list some of them for you. Unfortunately that won't help if you introduced the bug yourself. |
|
![]() |
![]() |
![]() |
#9 |
Prophet
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,912
Donated: $40
![]() |
I no longer have an XP box, so I can't help there.
MS does distribute an ISO you can burn, if you really get desperate, but it may not crash in a version recompiled in VS. Otherwise, you can try valgrind if you have access to a linux account. It's very good at tracking down bad pointer use. |
![]() |
![]() |
![]() |
#10 | |
Hellband maintainer
Join Date: Jul 2007
Location: New York, the Big Apple
Age: 43
Posts: 367
Donated: $120
![]() |
Quote:
I would compile the game once more in Visual Studio and build a Debug version and try the debug version on your old machine. When it crashes, the Debug version should tell you at least in which file / line the crash happens. T.
__________________
* Are you ready for something else ? Hellband 0.8.8 is out! * |
|
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Code: Notes live where? | camlost | Vanilla | 4 | February 20, 2009 22:11 |
fun with the code (and a big thank you) | will_asher | Idle chatter | 0 | March 3, 2008 05:24 |
Screensaver needs to rewrite some code | APWhite | Vanilla | 0 | October 16, 2007 22:19 |
Looking through the code | K.I.L.E.R | Vanilla | 5 | July 11, 2007 09:01 |
The safe_setuid code | CJNyfalt | Vanilla | 11 | June 26, 2007 04:25 |