objsetitemdata and itmgetdata problem

Bug reports for the different beta versions of transcendence.
Post Reply
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

objsetitemdata and itmgetdata problem

Post by Atarlost » Thu Mar 08, 2012 1:53 am

I'm having inexplicable problems with itemdata. "lastMunition" is not getting stored, even though "fireCount" is with identical syntax.

Code: Select all

(setq WE_fireUnlauncher (lambda nil
	(block (ammolist launcher shot speed munition lastMunition fireCount maxCount)
		(setq maxCount (typGetStaticData (itmGetUnid gItem) 'TotalShots))
		(if (not maxCount) (setq maxCount 1))
		(setq fireCount (itmGetData gItem "fireCount"))
		(setq ammolist (itmGetData gItem "ammolist"))
		(setq launcher (typGetStaticData (itmGetUnid gItem) 'VirtualLauncher))
		(setq lastMunition (objGetitemData gSource gItem "lastMunition"))
		(if (or (not fireCount) (gr fireCount maxCount))
			(setq fireCount 1)
		)
		; determine ammo type
		(if (eq 1 fireCount)
			(enum ammolist ammo
				(if (not munition)
					(if (objHasItem gSource (itmCreate ammo 1))
						(setq munition ammo)
					)
				)
			)
			(setq munition lastMunition)
		)
		(if munition
			(block nil
				(setq speed (typGetDataField munition "speed"))
				(if (if (eq 1 fireCount) (objRemoveItem gSource (itmCreate munition 1)) True) 
					(block nil
						(setq shot (sysCreateWeaponFire munition gSource aFirePos aFireAngle speed aTargetObj nil aWeaponBonus))
						(objIncVel shot (objGetVel gSource))
					)
				)
			)
			;; else don't fire!
		)
		(objsetitemData gSource gItem "fireCount" (add 1 fireCount))
		(objsetitemData gSource gItem "lastMunition" munition)
		true
	)
))
I'm currently using objsetdata and objgetdata with name mangling as a substitute and that does work, which demonstrates that the statements are being executed.

The only thing I can think of to explain this is that objsetitemdata silently fails if more than two keys are placed on an item. Whyever this is failing it is doing so silently. This is bad.

I don't have the time to set up a better test case right now since I'm in the middle of a rats nest of interlocking bugs.
Literally is the new Figuratively

alterecco
Fleet Officer
Fleet Officer
Posts: 1656
Joined: Wed Jan 14, 2009 3:08 am
Location: Enslaved by the Iocrym

Re: objsetitemdata and itmgetdata problem

Post by alterecco » Thu Mar 08, 2012 4:26 pm

It's the same problem as the one we had earlier (in the unlauncher iirc). objSetItemData returns a new item struct. So i am pretty certain that the second time through, you are not setting data on the same item.
Get your own Galactic Omni Device
Get it now. It's free!!
Image

User avatar
Star Weaver
Militia Commander
Militia Commander
Posts: 311
Joined: Sun Nov 07, 2010 10:20 pm
Location: . . . between the stars and the warm black sky . . .

Re: objsetitemdata and itmgetdata problem

Post by Star Weaver » Tue Jun 05, 2012 1:05 pm

I recently filed a ticket which may be relevant to your interests: http://wiki.neurohack.com/transcendence/trac/ticket/802
Image
Image
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest