Page 1 of 1

[beta 20b] Crash when a worm cast gravity well

Posted: Sat Feb 05, 2011 4:36 pm
by Marcotte
Hard crash, as the game seg fault. (beta 20b, self-compiled, on linux 64 bits)

Here is the end of the log:

Code: Select all

gigantic gravity worm	91676	dumb ai talents can use	Gravity Well	T_GRAVITY_WELL
gigantic gravity worm	91676	dumb ai talents can use	Gravity Spike	T_GRAVITY_SPIKE
dumb ai uses	T_GRAVITY_WELL
[LOG]	Gigantic gravity worm casts Gravity Well.
USING	table: 0x176a760	Gravity Well
[SPELL] friendly fire chance	0
Lua Error: /data/damage_types.lua:1085: attempt to index local 'target' (a nil value)
	At [C]:-1 
	At /data/damage_types.lua:1085 projector
	At /engine/Map.lua:847 processEffects
	At /mod/class/Game.lua:713 onTurn
	At /engine/GameEnergyBased.lua:95 tick
	At /engine/GameTurnBased.lua:44 tick
	At /mod/class/Game.lua:635 
 ----------------  Stack Dump ----------------
--------------- Stack Dump Finished ---------------
23 frames in 1.277 seconds = 18.011 FPS (28 keyframes)
 ----------------  Stack Dump ----------------
Segmentation fault

Re: [beta 20b] Crash when a worm cast gravity well

Posted: Sat Feb 05, 2011 5:54 pm
by edge2054
I left out a targeting check.

1079 in damage types should be.

Code: Select all

-- Gravity damage
newDamageType{
	name = "gravity", type = "GRAVITY",
	projector = function(src, x, y, type, dam)
		DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam)
		local target = game.level.map(x, y, Map.ACTOR)
		if target then
			if target:checkHit(src:combatSpellpower(), target:combatPhysicalResist(), 0, 95, 20) and target:canBe("pin") then
				target:setEffect(target.EFF_PINNED, 2, {}, true)
			else
				game.logSeen(target, "%s resists!", target.name:capitalize())
			end
		end
	end,
}
DG I'll send this in a patch probably later today. It didn't crash the release copy (or at least didn't when I tested though it did produce a lot of errors).

*edit* Patch sent.