Side Selection Dialog Appearing twicw

In my development of new SOR Module after running my game it is now showing the side selection dialog twice. Only occurs when I run via Open … and not after Edit … and then running the module.

This has just recently started happening. Not sure where to look for this problem? Help appreciated.

Thus spake comdotski:

In my development of new SOR Module after running my game it is now
showing the side selection dialog twice. Only occurs when I run via Open
… and not after Edit … and then running the module.

This has just recently started happening. Not sure where to look for
this problem? Help appreciated.

Have you been hand-editing the buildFile? If so, you might have
inadvertantly duplicated one of the XML elements which handles sides.


J.

I don’t think so, although it is possible as I have looked at the buildfile and may have done something by mistake.

What should I look for?

Thus spake comdotski:

I don’t think so, although it is possible as I have looked at the
buildfile and may have done something by mistake.

What should I look for?

I can’t say off the top of my head. Would you post the module so we
can have a look?


J.

Before I post (it is a big file), can I just mention that this only occurs if I initially select as the player side. Selecting one of the others that I have defined in the player sides for the game seems to work as expected.

I this doesn’t trigger anything let me know and I will post.

Thanks.

comdotski

Thus spake comdotski:

Before I post (it is a big file), can I just mention that this only
occurs if I initially select as the player side. Selecting
one of the others that I have defined in the player sides for the game
seems to work as expected.

I this doesn’t trigger anything let me know and I will post.

That’s useful to know for testing, but doesn’t indicate anything about
the problem to me.


J.

PM sent with link.

Thus spake comdotski:

PM sent with link.

I can replicate the problem. I’m looking into the cause now.


J.

Thanks - look forward to your response.

Thus spake comdotski:

Thanks - look forward to your response.

This isn’t just your module—it seems to happen for others as well.


J.

Bug or feature ?

Thus spake comdotski:

Bug or feature ?

Bug.


J.

OK thanks - its no major problem. I guess it goes into the queue for a potential fix? Should I report it under another forum?

Thus spake comdotski:

OK thanks - its no major problem. I guess it goes into the queue for a
potential fix?

I’ve found the code which is at fault—it’s was added in trunk@5772,
and was part of a fix for Bug 2806392, in which the observer could
erroneously end up with a password. I’ll let you know when it’s fixed.

Should I report it under another forum?

No need.


J.

Thus spake Joel Uckelman:

Thus spake comdotski:

OK thanks - its no major problem. I guess it goes into the queue for a
potential fix?

I’ve found the code which is at fault—it’s was added in trunk@5772,
and was part of a fix for Bug 2806392, in which the observer could
erroneously end up with a password. I’ll let you know when it’s fixed.

Hey Brent, I’m looking at the code you added to PlayerRoster.isFinished()
in trunk@5772 and am not succeeding in understanding the reasoning
behind it. (Maybe you don’t remember anymore, since it was from 2009.)

So, we have this:

// If we are already recorded as a player (i.e. in Saved Game), then
// the step is only finished if we are not the Observer.
final PlayerInfo newPlayerInfo = new PlayerInfo(
  GameModule.getUserId(),
  GlobalOptions.getInstance().getPlayerId(), null
);

if (players.contains(newPlayerInfo)) {
  final PlayerInfo pi = players.get(players.indexOf(newPlayerInfo));
  return ! OBSERVER.equals(pi.getSide());
}

// Step is not finished
return false;

The fact that selecting observer causes false to be returned here is
what makes the Welcome Wizard pop up again asking the user to select
a side. The comment makes me think this is intentional, but I don’t
get why it would be.

Is there some reason why this can’t simply be:

final PlayerInfo newPlayerInfo = new PlayerInfo(
  GameModule.getUserId(),
  GlobalOptions.getInstance().getPlayerId(), null
);

return players.contains(newPlayerInfo);


J.

Hi Joel,

I have a vague memory of this.

There was a problem where Observers where being written into the Player List and saved in save games along with their passwords. Then, when you tried to to load those saved games, the Observer position was already taken. This code seems to be working around that and saying that even if you are recorded in the Player List, the step should fail (and cause the side selection step to appear) if you are recorded in the Player List as the Observer.

There must be another change somewhere that fixes the problem of Observers the Player List being written to the saved game (!)

Brent.

Thus spake Brent Easton:

Hi Joel,

I have a vague memory of this.

There was a problem where Observers where being written into the Player
List and saved in save games along with their passwords. Then, when you
tried to to load those saved games, the Observer position was already
taken. This code seems to be working around that and saying that even if
you are recorded in the Player List, the step should fail (and cause the
side selection step to appear) if you are recorded in the Player List as
the Observer.

That sounds familiar. This fix was in 3.1.7.

There must be another change somewhere that fixes the problem of
Observers the Player List being written to the saved game (!)

I wonder if the fixes for Bugs 4363 and 4259, both of which were in
3.1.19, are those changes.


J.

Thus spake Brent Easton:

There was a problem where Observers where being written into the Player
List and saved in save games along with their passwords. Then, when you
tried to to load those saved games, the Observer position was already
taken. This code seems to be working around that and saying that even if
you are recorded in the Player List, the step should fail (and cause the
side selection step to appear) if you are recorded in the Player List as
the Observer.

I tested my change by:

  1. Setting a password.
  2. Starting a game as observer, moving a piece, saving.
  3. Deleting the prefs file for the module (to ensure that nothing is
    picking up the password I used).
  4. Opening the saved game.
  5. Selecting observer.

Does this test what I should be testing, to ensure that I’m not
reintroducing the problem you fixed?


J.

I’ve uploaded a build with my proposed fix, 3.2.12-svn9050-obstest:

vassalengine.sourceforge.net/builds/

Please give this a try.

Hi Joel,
The code you are modifying didn’t fix the original bug, it was a work around to fix the symptom of the bug that had occurred earlier, most likely by bug 4259.
Brent.