I'm having problems updating values in TList.

BlitzMax Forums/BlitzMax Programming/I'm having problems updating values in TList.

First off, all the code is not listed in the while loop so please don't focus on that part of the code. I do have it working going backwards thru the TList.


Now I'm not using the for...eachin loop because I want to go through the list backwards.
When I get to my previous link I want to update the type info but when I do that and get back to the main loop my changes didn't take.

The problem I'm having is with 'lstObject'.
I want to increment 'lstObject.ypos_i' by 55 but when I leave my loop the change doesn't take.

I test this by running a for...eachin loop after it and it doesn't show the value has been changed.


Type TTile
	Field xpos_i:Int
	Field ypos_i:Int
	Field zpos_i:Int
	Field tileColor:String
	Field pic:TImage
End Type

Type TEngine Extends TTile
	Global Tilelist:TList = New TList

	Method GoThruListBackwards() 
	   Local LastTEngineObject:TLink
	   Local CurrentTEngineObject:TLink
	   Local lstObject:TEngine
	
	   LastTEngineObject = Tilelist.LastLink() 
	   lstObject = TEngine(LastTEngineObject._value) 
			
	   While(1) 
	     CurrentTEngineObject = LastTEngineObject.PrevLink() 
	     If CurrentTEngineObject = Null
		Exit
	     EndIf
	     lstObject = TEngine(CurrentTEngineObject._value) 
	
             lstObject.ypos_i:+55   ***This Doesn't Take***

	   Wend

           '**When I iterate thru the list my ypos hasn't been
           '**updated
           For k:TEngine = Eachin TileList
           Next

	End Method
End Type


SuperStrict

Type TTile
	Field xpos_i:Int
	Field ypos_i:Int
	Field zpos_i:Int
	Field tileColor:String
'	Field pic:TImage
End Type

Type TEngine Extends TTile
	Global Tilelist:TList = New TList

	Method GoThruListBackwards() 
	   Local LastTEngineObject:TLink
	   Local CurrentTEngineObject:TLink
	   Local lstObject:TEngine
	
	   LastTEngineObject = Tilelist.LastLink() 
	   lstObject = TEngine(LastTEngineObject._value) 
			
	   While True 
			lstObject.ypos_i:+55   '***This Doesn't Take***

			CurrentTEngineObject = LastTEngineObject.PrevLink() 
			If CurrentTEngineObject = Null
				Exit
		    EndIf
			lstObject = TEngine(CurrentTEngineObject._value) 
	
			LastTEngineObject = CurrentTEngineObject
		Wend

           '**When I iterate thru the list my ypos hasn't been
           '**updated
       For Local k:TTile = EachIn TileList
			DebugLog k.ypos_i
       Next

	End Method
	
	Method AddTile(t:TTile)
		Tilelist.AddLast(t)	
	End Method
	
End Type


Local eng:TEngine = New TEngine

eng.AddTile(New TEngine)
eng.AddTile(New TEngine)

eng.GoThruListBackwards()

eng.GoThruListBackwards()


Thanks for that!