Memory bug?

Miscellaneous Forums/General Discussion/Memory bug?

All weapons are children to the tBullet type. All wepons overload the collision method. Here is the relevant parts of tBullet:

	Function update_ammo( dt:Float )
		If Not blist Then Return
		
		For Local b:tBullet = EachIn blist
			b.update(dt)
			b.check_collision()
		Next
	EndFunction


	Method collision:Object[]()
		Return CollideImage( gfx_bullet, x,y,0, 1,0 )
	EndMethod

	Method check_collision()
		' Collision with anything?
		Local objarr:Object[] =  collision() 
			
		For Local o:Object = EachIn objarr
			
			If tSoldier(o) Then
				tSoldier(o).Kill()
				impact()
				player_shot_hits:+1
				
				If tLaser(Self) player_shots:+1
				
			ElseIf tPlane(o) Then
				
				If tLaser(Self) Then

					' Don't want the laser to hurt the plane
					' all the way through. Just once and then
					' move on...

					player_shots:+1
					If tPlane(o).laser_immunity <> Self Then
						tPlane(o).take_damage( damage )
						player_shot_hits:+1
					EndIf
				
					' Make sure this laser beam doesn't hurt this
					' plane again.
					tPlane(o).laser_immunity = tLaser(Self)

				Else
					tPlane(o).take_damage( damage )				
					player_shot_hits:+1
				EndIf
				
				impact()
			
			ElseIf tCrate(o) Then
			
				If tEntity.list.contains(o) Then
					If tLaser(Self) player_shots:+1

					tCrate(o).remove()
					impact()
				
					get_random_ammo()
					player_shot_hits:+1
		
				EndIf
				
			Else
				Print "Unknown object hit"	
			EndIf
								
		Next		
	EndMethod


It's the Nail bomb that I have problems with. All it needs to overwrite is the collision method:

	Method collision:Object[]() ' --- This one does not work
		Return CollideImage( gfx_nailbomb, x,y,0, 1,0 )
	EndMethod

	'Method collision:Object[]() ' --- This one works just fine
	'	Return CollideImage( gfx_scatter, x,y,0, 1,0 )
	'EndMethod

The impact() method is different for each type of weapons. In some cases it does nothing, in other it spawns explosions or more bullets (as in the nailbomb type)
I know for sure that the impact() function isn't called at all for the nailbomb.

gfx_nailbomb loads without any problems and displays correctly when the game calls tnailbomb.draw(). It's when it's used in collision the bug appears.
Funny thing is that other images loaded after gfx_nailbomb doesn't have this problem.

CollideImage returns an empty array when I use gfx_nailbomb.


edit:
Yeah, if removing the music doesn't fix the issue, then you probably changed the collision code by accident without noticing.

The only thing that I could accidently change is the collision method inside tNailBomb. But it looks like all the others. except that it uses gfx_nailbomb.

This is a really wierd bug! :/
Or perhaps I'm just blind. I really hope you find a typo somewhere in the code.