pzorin / qgo

qGo is a Go Client (IGS, WING, LGS, WBaduk/CyberORO, Tygem, Tom, and eWeiqi) based on Qt 5. No active development is happening nor should any be expected.
GNU General Public License v2.0
81 stars 34 forks source link

Handicap stones not shown when opening sgf file #40

Closed ldrone closed 9 years ago

ldrone commented 9 years ago

Opening an existing sgf game does not draw handicap stones on board.

Changing line 44 in file game_interfaces/qgoboardlocalinterface.cpp fixes it: if (gameData->handicap) // && gameData->fileName.isEmpty())

I'm not sure if this is the proper fix, that is, why the second condition is necessary.

pzorin commented 9 years ago

The second condition is necessary because the handicap is stored in 2 places in the SGF file: the HA[] property contains the number of handicap stones, but has no effect on the board setup by the SGF specification. The handicap stones' position is set using the AB[] property, see http://www.red-bean.com/sgf/go.html#HA When a new game with fixed handicap placement is created, there is no file to read the handicap placement from, so the handicap is set up by a special function.

Your problem can be interpreted in 2 ways:

  1. The handicap stones are not drawn immediately but appear after the first move is displayed. I had an error like that once but it has been fixed long ago (in particular current master).
  2. The handicap stones just don't exist and the game develops as if they aren't there. The likely reason in this case is a corrupt SGF file lacking AB[] properties. Again, there was a bug in one of the previous versions which caused the HA[] property to be written, but the AB[] properties to be omitted. If this is the case for your SGF files, I recommend adding appropriate AB[] properties manually for the time being (you can add it right after HA[] at the beginning of the file). You probably should not use qgo's editing functionality for that because it behaves strangely (I haven't fixed it because I don't have a clear idea of how it should behave)