room list update - new room vars overwritten with old ones

You think you've found a bug? Please report it here.

Moderators: Lapo, Bax

Post Reply
fsol
Posts: 7
Joined: 05 Nov 2008, 15:45
Location: Brighton, UK

room list update - new room vars overwritten with old ones

Post by fsol »

Hi,

I'm using AS3 client 1.6.1.

My lobby does some stuff with Room variables, so I've set the 'roomListVars' attribute to true on the zone config.

I noticed that the room vars weren't updating correctly when using getRoomList(), even though the debug XML looks fine. Looking through the code, it seems that if an old room exist, it overwrites the new one's variables:

SysHandler (v.1.3.0) line 176:

Code: Select all

// Handle Room Variables
				if (roomXml.vars.toString().length > 0)
				{
					populateVariables(room.getVariables(), roomXml)			
				}	
				
				/*
				* Merge with current room list data, to avoid destroying previous data
				* @since 1.6.0
				*/
				var oldRoom:Room = roomList[roomId]
				if (oldRoom != null)
				{
					room.setVariables( oldRoom.getVariables() )
					room.setUserList( oldRoom.getUserList() )
				}
				
				roomList[roomId] = room	

in particular, this line:

Code: Select all

room.setVariables( oldRoom.getVariables() )
Shouldn't this merge / update variables individually rather than just overwrite the whole list?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

This is already done in the latest 1.6.8 patch.
Lapo
--
gotoAndPlay()
...addicted to flash games
fsol
Posts: 7
Joined: 05 Nov 2008, 15:45
Location: Brighton, UK

Post by fsol »

Hi -

I'm using the latest patch (1.6.8), which contains these AS3 client classes:

SmartFoxClient 1.6.1

SysHandler 1.3.0

Are these the latest versions?

Cheers
f
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Hi, your version number is correct.
As regards your specific question: the code is correct because it affects only the Rooms that the User is currently joined in, preserving the current state of variables and the User List.

The getRoomList() response from server by default does not contain any info about RoomVariables, unless you specify in your config to also send the RoomVars.

In this case, yes you could have a problem there.
Is this your setup? If so a quick workaround is to comment the line of code you have outlined.
Lapo
--
gotoAndPlay()
...addicted to flash games
fsol
Posts: 7
Joined: 05 Nov 2008, 15:45
Location: Brighton, UK

Post by fsol »

Hi,

Yes, I'm using roomListVars="true" in the zone config file.

Cheers
f
Post Reply