Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > ToME

Reply
 
Thread Tools Display Modes
Old October 24, 2012, 02:52   #1
Therem Harth
Knight
 
Join Date: Jan 2008
Posts: 926
Therem Harth is on a distinguished road
T2: fine in 32-bit, Lua error in 64-bit

I've noticed that (in ToME 2.3.5) hitting escape in the Geomancy spell menu produces a Lua error on 64-bit Linux. The error indicates that the game attempted to index a nil variable in the function get_affect() in lib/core/s_aux.lua. It's not fatal, but it is quite unsightly.

What's weird is that the 32-bit Linux version is perfectly okay.

(2.3.9-ah also doesn't have this issue.)

Anyone know why an error like this might occur only in 64-bit mode?
Therem Harth is offline   Reply With Quote
Old October 24, 2012, 05:42   #2
AnonymousHero
Veteran
 
AnonymousHero's Avatar
 
Join Date: Jun 2007
Posts: 1,393
AnonymousHero is on a distinguished road
It may be that a function prototype/declaration in the *.pkg file differs from the declaration in the *.h file.
AnonymousHero is offline   Reply With Quote
Old October 24, 2012, 17:04   #3
Therem Harth
Knight
 
Join Date: Jan 2008
Posts: 926
Therem Harth is on a distinguished road
Thanks...

Looking at the stack traceback, BTW, it looks to me like cast_school_spell() is being invoked even when you hit the escape key - and thus invoked on a spell that doesn't exist, producing the error. Not sure why; escape is supposed to produce a value of -1, which should be caught by an if statement and cause cast_school_spell not to be invoked:

Code:
		s = get_school_spell("cast", "is_ok_spell", 63)
		if (s ~= -1) then
			cast_school_spell(s, spell(s))
		end
Maybe there is some kind of type mismatch on 64-bit, that's preventing the value from being properly recognized?
Therem Harth is offline   Reply With Quote
Old October 24, 2012, 18:32   #4
AnonymousHero
Veteran
 
AnonymousHero's Avatar
 
Join Date: Jun 2007
Posts: 1,393
AnonymousHero is on a distinguished road
It's probably a declaration mismatch on the return of the function then. -1 in two-completement in 32-bit has a tendency to not stay -1 when "converted" (without sign extension, or a random adjacent garbage)
AnonymousHero is offline   Reply With Quote
Old October 24, 2012, 18:58   #5
Therem Harth
Knight
 
Join Date: Jan 2008
Posts: 926
Therem Harth is on a distinguished road
Looks like you're right, it's a u32b getting converted to an int. Thank you.

Edit: wait, u32b? How are we supposed to get -1 with an unsigned integer?

Edit 2: yes, making get_school_spell return an int instead of a u32b worked. Hurray.

Last edited by Therem Harth; October 24, 2012 at 19:05.
Therem Harth 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
Bit of advice? Leiferra Vanilla 7 August 26, 2011 06:08
Unused monster bit flags? Hajo Development 2 August 28, 2010 10:47
Game crash - 3.1.2 Win 7 64 bit kurie Vanilla 4 February 23, 2010 02:37
Something a bit different Aknight Variants 22 June 25, 2008 21:13
Will we get rid of the 32 bit flag variables? Bandobras Vanilla 18 December 22, 2007 14:54


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


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