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.
frustrating crash bug
Collapse
X
-
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.cWill_Asher
aka LibraryAdventurer
My old variant DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)Comment
-
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);
Currently turning (Angband) Japanese.Comment
-
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; }
Currently turning (Angband) Japanese.Comment
-
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
aka LibraryAdventurer
My old variant DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)Comment
-
Yes.
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.Currently turning (Angband) Japanese.Comment
-
It crashed inside get_random_des().
What does this mean?:
The thread 'Win32 Thread' (0x17cc) has exited with code 0 (0x0).Will_Asher
aka LibraryAdventurer
My old variant DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)Comment
-
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.Comment
-
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.Comment
-
Comment
-
Hooray!! I added a define for in_town_fully, and changed this
Code:/* Ignore illegal locations */ if (!in_bounds_fully(y, x)) continue;
Code:/* Ignore illegal locations */ if ((p_ptr->depth) && (!in_bounds_fully(y, x))) continue; else if (!in_town_fully(y, x)) continue;
Thanks for the help!Will_Asher
aka LibraryAdventurer
My old variant DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)Comment
-
I do a lot of things that way actually. I wouldn't know how to do it from scratch without help, so I just copy it from something similar and tweak it.
The monster roaming code choses a random destination for the monster to go towards using stuff copied from the teleportaiton code.Will_Asher
aka LibraryAdventurer
My old variant DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)Comment
-
-
I did that and it gives me an error saying "missing ";" before '&&'" and points to the lines where in_bounds_fully is referenced.Will_Asher
aka LibraryAdventurer
My old variant DaJAngband:
http://sites.google.com/site/dajangbandwebsite/home (defunct and so old it's forked from Angband 3.1.0 -I think- but it's probably playable...)Comment
Comment