Artifact Duplication - Is this a bug?

Where bugs go to lie down and rest

Moderator: Moderator

Message
Author
Soron
Cornac
Posts: 39
Joined: Fri Dec 24, 2010 12:00 am

Re: Artifact Duplication - Is this a bug?

#16 Post by Soron »

Final Master wrote:You clearly don't understand the importance of saves and light then, thinking that the treads are useless to any character.
Yeah, I possibly don't know exactly how useful saves are, true, and I'm sure that a light radius boost would be useful. "Useless" is perhaps too strong, but I was still a little off-put by the high fatigue, given my high mana use playstyle.

Also, while I'm responding: I've now gotten a second Choker of Dread while the original is in my inventory: http://te4.org/characters/1596/tome/157 ... 1cc000edf0

Noel
Thalore
Posts: 121
Joined: Fri Dec 15, 2006 1:49 am

[PATCH] Re: Artifact Duplication - Is this a bug?

#17 Post by Noel »

May have found it.

After finding my second Kor's Fall again, I looked through game.teag. The main file showed that game.uniques was recording the artifact properly. Both times.

Code: Select all

d["uniques"]={
...
["mod.class.Object/Kor's Fall"]=2,
...
}
When creating an object, game.uniques is checked in game/engines/default/engine/Zone.lua by checkFilter(). However, if makeEntity is called with filter = nil, then it doesn't call checkFilter(), so the unique check is skipped.

Calling checkFilter(e, nil) in the non-filter branch of makeEntity should prevent unique duplication (unless there's another code path somewhere that creates entities and doesn't have the uniqueness check).

(although it does look a bit counterintuitive to call checkFilter without a filter...)

Tried to attach diff file, but board is rejecting both .diff and .txt extensions, and I don't feel like playing guess-the-allowed-extension...patch in the text here will probably be tab-damaged...is there a better way to submit a patch?

Patch is against SVN r2283.

Code: Select all

--- game/engines/default/engine/Zone-orig.lua	2011-01-08 03:10:15.000000000 -0500
+++ game/engines/default/engine/Zone.lua	2011-01-08 03:39:30.505331005 -0500
@@ -254,6 +254,8 @@
 		local list = level:getEntitiesList(type)
 		e = self:pickEntity(list)
 		if not e then return nil end
+        -- must call checkFilter() to prevent duplication of uniques (Noel)
+        if not self:checkFilter(e, nil) then return null end
 	end
 
 	if filter then e.force_ego = filter.force_ego end

darkgod
Master of Eyal
Posts: 10751
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Artifact Duplication - Is this a bug?

#18 Post by darkgod »

My hero !
*bumps his head on the wall*
Sometimes looking too hard at the code makes you unable to see the most obvious :/

Thanks!

As for patches you can send them by mail directly (and check here http://forums.te4.org/viewtopic.php?f=36&t=21351 if you want to post more :) ).
I implemented the fix a little differently, it'll retry a few times before giving up.

PS: "null" is invalid in lua, you want "nil", it still works in your case because it tries to get a global variable named "null" which does not exists and thus assumes to be nil ;)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Noel
Thalore
Posts: 121
Joined: Fri Dec 15, 2006 1:49 am

Re: Artifact Duplication - Is this a bug?

#19 Post by Noel »

Doh. Fingers are programmed for SQL. ;)

darkgod
Master of Eyal
Posts: 10751
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Artifact Duplication - Is this a bug?

#20 Post by darkgod »

Should work now :) (attachements as txt)
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Grey
Loremaster
Posts: 3517
Joined: Thu Sep 23, 2010 10:18 pm
Location: London, England
Contact:

Re: Artifact Duplication - Is this a bug?

#21 Post by Grey »

Wow, nice find Noel. These multiple artifacts have been annoying me a lot!
http://www.gamesofgrey.com - My own T-Engine games!
Roguelike Radio - A podcast about roguelikes

Post Reply