Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old May 23, 2009, 13:15   #31
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,923
Donated: $40
takkaria is on a distinguished road
To get rid of the snprintf() error, switch to using strnfmt() instead. VC++ doesn't support snprintf() and strnfmt() is what angband uses instead everywhere else.
__________________
takkaria whispers something about options. -more-
takkaria is offline   Reply With Quote
Old May 23, 2009, 18:39   #32
will_asher
DaJAngband Maintainer
 
will_asher's Avatar
 
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 927
Donated: $10
will_asher is on a distinguished road
I got it built in V++! I started over making sure not to select CLR empty project, as you suggested and it got rid of all the errors except the snprintf one, and I replaced that with strnfmt(). (The snprintf() was in a piece of Eddie's code) When I started the project the first time, I didn't know what CLR meant and thought it might just be 'clear empty project'.

Anyway, I ran it and it crashed again after I took less than 10 steps from the stairs where I started. V++ pointed me to the distance() function. hmmm, is it bad if one of the 'x' values is negative?

I think I've narrowed it down to my get_random_des() function in melee2.c
__________________
Will_Asher

Play DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home
will_asher is offline   Reply With Quote
Old May 23, 2009, 18:48   #33
PaulBlay
Knight
 
Join Date: Jan 2009
Posts: 657
PaulBlay is on a distinguished road
Quote:
Originally Posted by will_asher View Post
Anyway, I ran it and it crashed again after I took less than 10 steps from the stairs where I started. V++ pointed me to the distance() function. hmmm, is it bad if one of the 'x' values is negative?
That's very odd, because it won't crash for me.

Did you use the files.c and dungeon.c source files that I emailed you? That's the only difference I can think of off hand. (Although I can't see how they could be involved)

As for the 'distance' function, it should never return a negative. It also seems unlikely (but not impossible, I suppose) that that any of x1, y1, x2 and y2 should be negative.

Code:
				y = rand_spread(dy, dis);
				x = rand_spread(dx, dis);
				d = distance(dy, dx, y, x);
[EDIT] OK, I take that back. Given the above code it is quite likely for y2 or x2 to be negative.
__________________
Currently turning (Angband) Japanese.
PaulBlay is offline   Reply With Quote
Old May 23, 2009, 18:56   #34
PaulBlay
Knight
 
Join Date: Jan 2009
Posts: 657
PaulBlay is on a distinguished road
You could do this if you want to be cautious.

Code:
			/* Pick a (legal) location */
			while (1)
			{
				y = rand_spread(dy, dis);
				x = rand_spread(dx, dis);
				/* Ignore illegal locations */
				if (!in_bounds_fully(y, x)) continue;
				d = distance(dy, dx, y, x);
				if ((d >= min) && (d <= dis)) break;
			}
but, like I said, it didn't crash for me before then.
__________________
Currently turning (Angband) Japanese.
PaulBlay is offline   Reply With Quote
Old May 23, 2009, 19:09   #35
will_asher
DaJAngband Maintainer
 
will_asher's Avatar
 
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 927
Donated: $10
will_asher is on a distinguished road
Did you try going into the dungeon and coming back to town? If it has to do with my get_random_des() function, then it wouldn't crash unless a roaming monster was generated (one that's awake before noticing the player). Then again, if it has to do with that function I don't understand why it only crashes in town.
__________________
Will_Asher

Play DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home
will_asher is offline   Reply With Quote
Old May 23, 2009, 19:18   #36
PaulBlay
Knight
 
Join Date: Jan 2009
Posts: 657
PaulBlay is on a distinguished road
Quote:
Originally Posted by will_asher View Post
Did you try going into the dungeon and coming back to town?
Yes.

Quote:
If it has to do with my get_random_des() function, then it wouldn't crash unless a roaming monster was generated (one that's awake before noticing the player). Then again, if it has to do with that function I don't understand why it only crashes in town.
Stick a break point at the start and end of get_random_des() and skip through it a few times with F5. If it crashes half way through then it probably is get_random_des. (Although I guess you've probably already got that far?)
__________________
Currently turning (Angband) Japanese.
PaulBlay is offline   Reply With Quote
Old May 23, 2009, 19:33   #37
will_asher
DaJAngband Maintainer
 
will_asher's Avatar
 
Join Date: Apr 2007
Location: San Antonio, TX
Posts: 927
Donated: $10
will_asher is on a distinguished road
It crashed inside get_random_des().

What does this mean?:
The thread 'Win32 Thread' (0x17cc) has exited with code 0 (0x0).
__________________
Will_Asher

Play DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home
will_asher is offline   Reply With Quote
Old May 23, 2009, 19:38   #38
PaulBlay
Knight
 
Join Date: Jan 2009
Posts: 657
PaulBlay is on a distinguished road
Quote:
Originally Posted by will_asher View Post
It crashed inside get_random_des().

What does this mean?:
The thread 'Win32 Thread' (0x17cc) has exited with code 0 (0x0).
Well, frankly it's not much help as messages go.

What I suggest you try now is to narrow down where in get_random_des it crashes. You could do that by either stepping through with F11 or by adding / moving breakpoints.
__________________
Currently turning (Angband) Japanese.
PaulBlay is offline   Reply With Quote
Old May 23, 2009, 19:43   #39
Atarlost
Swordsman
 
Join Date: Apr 2007
Posts: 441
Atarlost is on a distinguished road
You know, being level 0 isn't the only thing unique about the town. It's also the only small level. You may be making assumptions about dungeon size somewhere in your monster roaming code.
__________________
One Ring to rule them all. One Ring to bind them.
One Ring to bring them all and in the darkness interrupt the movie.
Atarlost is offline   Reply With Quote
Old May 23, 2009, 19:56   #40
PaulBlay
Knight
 
Join Date: Jan 2009
Posts: 657
PaulBlay is on a distinguished road
Quote:
Originally Posted by Atarlost View Post
It's also the only small level.
Good point. Actually I think I mentioned in a completely unrelated thread that the in_bounds_fully macro should check against TOWN_WID and TOWN_HGT not DUNGEON_WID and DUNGEON_HGT when on dlvl 0.
__________________
Currently turning (Angband) Japanese.
PaulBlay is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[FA] Crash Bug Zikke Variants 8 February 19, 2009 04:20
r1264 bug: crash at prompt (Windows) Colbey Vanilla 11 February 13, 2009 16:39
Entro crash Zikke Variants 2 February 2, 2009 20:08
Elemental attacks destroying inventory items - challenging or frustrating? hugorune Vanilla 24 January 28, 2009 08:23
YASD - the most frustrating death in the world Big Al AAR 13 February 2, 2008 18:31


All times are GMT +1. The time now is 12:42.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.