Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old December 9, 2015, 09:03   #11
PowerWyrm
Veteran
 
PowerWyrm's Avatar
 
Join Date: Apr 2008
Posts: 1,891
PowerWyrm is on a distinguished road
There's a potential bug I've found while fixing slay/brand power for my variant: slay cache probably doesn't work.

Code:
        int tot_mon_power = 0;

        ...

	/* Look in the cache to see if we know this one yet */
	sv = check_slay_cache(obj);

        /* If it's cached (or there are no slays), return the value */
	if (sv)	{
		log_obj("Slay cache hit\n");
	} else {
                ...
                /* Add up totals */
		tot_mon_power += mon->race->scaled_power;
	}

	q = (dice_pwr * (sv / 100)) / (tot_mon_power / 100);
If it's cached, tot_mon_power is not set... so the calculation of q should crash with a division by zero error (that's what's happening in my variant). No idea why it's not the case in V.
__________________
PWMAngband variant maintainer - check http://www.mangband.org/forum/viewforum.php?f=9 to learn more about this new variant!
PowerWyrm is offline   Reply With Quote
Old December 9, 2015, 10:19   #12
PowerWyrm
Veteran
 
PowerWyrm's Avatar
 
Join Date: Apr 2008
Posts: 1,891
PowerWyrm is on a distinguished road
In my code, slay cache doesn't work because the cache is filled/checked from "fake" artifacts which don't have their slays/brands known. I've fixed that simply by calling object_know_brands_and_slays() inside make_fake_artifact().
__________________
PWMAngband variant maintainer - check http://www.mangband.org/forum/viewforum.php?f=9 to learn more about this new variant!
PowerWyrm is offline   Reply With Quote
Old December 9, 2015, 10:27   #13
PowerWyrm
Veteran
 
PowerWyrm's Avatar
 
Join Date: Apr 2008
Posts: 1,891
PowerWyrm is on a distinguished road
Quote:
Originally Posted by PowerWyrm View Post
In my code, slay cache doesn't work because the cache is filled/checked from "fake" artifacts which don't have their slays/brands known. I've fixed that simply by calling object_know_brands_and_slays() inside make_fake_artifact().
Another reason why the slay cache doesn't work...

Code:
s32b check_slay_cache(const struct object *obj)
{
	int i = 0;

	while ((slay_cache[i].brands != NULL) && (slay_cache[i].slays != NULL)) {
		if (brands_are_equal(obj->brands, slay_cache[i].brands, TRUE) &&
			slays_are_equal(obj->slays, slay_cache[i].slays, TRUE)) 
			break;
		i++;
	}

	return slay_cache[i].value;
}
Code:
bool fill_slay_cache(const struct object *obj, s32b value)
{
	int i = 0;

	while ((slay_cache[i].brands != NULL) && (slay_cache[i].slays != NULL)) {
		if (brands_are_equal(obj->brands, slay_cache[i].brands, TRUE) &&
			slays_are_equal(obj->slays, slay_cache[i].slays, TRUE)) {
			slay_cache[i].value = value;
			return TRUE;
		}
		i++;
	}

	return FALSE;
}
Cache entry doesn't need to have BOTH slay and brand... so in that case the first function returns an invalid entry and the second one returns FALSE. The fix is trivial, replace "&&" in both "while" statements by "||".
__________________
PWMAngband variant maintainer - check http://www.mangband.org/forum/viewforum.php?f=9 to learn more about this new variant!
PowerWyrm is offline   Reply With Quote
Old December 9, 2015, 11:41   #14
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 52
Posts: 6,484
Donated: $60
Nick is on a distinguished road
Quote:
Originally Posted by PowerWyrm View Post
Cache entry doesn't need to have BOTH slay and brand... so in that case the first function returns an invalid entry and the second one returns FALSE. The fix is trivial, replace "&&" in both "while" statements by "||".
That's what happens when I get away from that nice neat 3.5.1 code

Thanks, that will get fixed some time - happily the two bugs cancel each other out and it's only really an efficiency thing for V (if I understand correctly).
__________________
One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them.
Nick is offline   Reply With Quote
Old December 9, 2015, 15:24   #15
Ingwe Ingweron
Veteran
 
Join Date: Jan 2009
Location: Manhattan Beach, CA
Posts: 1,409
Ingwe Ingweron is on a distinguished road
Not a bug, necessarily, but the random name generation starting a new human mage character just popped up "Sauron". Seriously?! Hmmm, maybe the RNG knows something I don't.... Guess it could have been worse, it could have come up with "Morgoth"!
__________________
“We're more of the love, blood, and rhetoric school. Well, we can do you blood and love without the rhetoric, and we can do you blood and rhetoric without the love, and we can do you all three concurrent or consecutive. But we can't give you love and rhetoric without the blood. Blood is compulsory. They're all blood, you see.”
― Tom Stoppard, Rosencrantz and Guildenstern are Dead
Ingwe Ingweron is offline   Reply With Quote
Old December 9, 2015, 16:45   #16
Egavactip
Swordsman
 
Join Date: Mar 2012
Posts: 290
Egavactip is on a distinguished road
Quote:
Originally Posted by Ingwe Ingweron View Post
Not a bug, necessarily, but the random name generation starting a new human mage character just popped up "Sauron". Seriously?! Hmmm, maybe the RNG knows something I don't.... Guess it could have been worse, it could have come up with "Morgoth"!
Oh, it gets worse. Today I got "Trump."
Egavactip is offline   Reply With Quote
Old December 10, 2015, 19:44   #17
Thraalbee
Swordsman
 
Thraalbee's Avatar
 
Join Date: Sep 2010
Location: Stockholm
Posts: 381
Thraalbee is on a distinguished road
100% disarm not true

My Hobbit Ranger just triggerd a summing trap on "D"isarm. That should not happen since the character display says Disarm 100%. Either the display is wrong or the code. Or maybe I don't understand the display. Seems an unlikely bug, could be a that the result is rounded up and I have between 0 and 1% failure rate?
[EDIT: Sorry, I am on 4.0.3]
Thraalbee is offline   Reply With Quote
Old December 10, 2015, 19:54   #18
wobbly
Veteran
 
Join Date: May 2012
Location: Adelaide, Australia
Posts: 1,034
wobbly is on a distinguished road
Also 4.0.3 - The level feelings don't display properly if the item quality kicks in immediately & it tries to dispay danger & item quality at the same time. I have to hit Ctrl-P to see what it just said.
wobbly is offline   Reply With Quote
Old December 11, 2015, 02:45   #19
yyt16384
Scout
 
Join Date: Jan 2015
Posts: 38
yyt16384 is on a distinguished road
Quote:
Originally Posted by Thraalbeast View Post
My Hobbit Ranger just triggerd a summing trap on "D"isarm. That should not happen since the character display says Disarm 100%. Either the display is wrong or the code. Or maybe I don't understand the display. Seems an unlikely bug, could be a that the result is rounded up and I have between 0 and 1% failure rate?
[EDIT: Sorry, I am on 4.0.3]
The displayed value is about disarming dungeon traps. Traps on chests have different power and most of them are more difficult to disarm than dungeon traps.
yyt16384 is offline   Reply With Quote
Old December 11, 2015, 23:17   #20
luneya
Adept
 
Join Date: Aug 2015
Posts: 110
luneya is on a distinguished road
Quote:
Originally Posted by wobbly View Post
Also 4.0.3 - The level feelings don't display properly if the item quality kicks in immediately & it tries to dispay danger & item quality at the same time. I have to hit Ctrl-P to see what it just said.
At a guess, this is a platform specific bug; I don't recall any such problems playing 4.0.3 on OS-X, and I just received a level with immediate quality data in 4.0.4, and it displayed correctly. You'll have to provide more data on how you're running the game before anyone can troubleshoot.
luneya 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
4.0.3 bugs Nick Vanilla 86 December 6, 2015 18:16
4.0.2 Bugs Ingwe Ingweron Vanilla 205 November 13, 2015 02:31
4.0.1 Bugs Elsairon Vanilla 116 September 10, 2015 07:45
Bugs with 3.5 donalde Vanilla 10 February 24, 2014 17:28
Bugs Adley Development 2 October 10, 2010 21:11


All times are GMT +1. The time now is 11:08.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.