| 138 | | t = '' |
|---|
| 139 | | |
|---|
| 140 | | if node.has_key('PW'): t = t + node['PW'][0] |
|---|
| 141 | | else: t = t + ' ?' |
|---|
| 142 | | if node.has_key('WR'): t = t + ', ' + node['WR'][0] |
|---|
| 143 | | |
|---|
| 144 | | t = t + ' - ' |
|---|
| 145 | | |
|---|
| 146 | | if node.has_key('PB'): t = t + node['PB'][0] |
|---|
| 147 | | else: t = t + ' ?' |
|---|
| 148 | | if node.has_key('BR'): t = t + ', ' + node['BR'][0] |
|---|
| 149 | | |
|---|
| 150 | | if node.has_key('RE'): t = t + ', ' + node['RE'][0] |
|---|
| 151 | | if node.has_key('KM'): t = t + ' (Komi ' + node['KM'][0] + ')' |
|---|
| 152 | | if node.has_key('HA'): t = t + ' (Hcp ' + node['HA'][0] + ')' |
|---|
| 153 | | |
|---|
| 154 | | t = t + '\n' |
|---|
| 155 | | |
|---|
| 156 | | if node.has_key('EV'): t = t + node['EV'][0] + ', ' |
|---|
| 157 | | if node.has_key('RO'): t = t + node['RO'][0] + ', ' |
|---|
| 158 | | if node.has_key('DT'): t = t + node['DT'][0] + '\n' |
|---|
| 159 | | |
|---|
| 160 | | if node.has_key('GC'): |
|---|
| 161 | | gc = node['GC'][0] |
|---|
| 162 | | gc = replace(gc, '\n\r', ' ') |
|---|
| 163 | | gc = replace(gc, '\r\n', ' ') |
|---|
| 164 | | gc = replace(gc, '\r', ' ') |
|---|
| 165 | | gc = replace(gc, '\n', ' ') |
|---|
| 166 | | |
|---|
| 167 | | t = t + gc |
|---|
| 168 | | |
|---|
| 169 | | try: |
|---|
| 170 | | t2 = 'Commentary in ' +\ |
|---|
| 171 | | self.references[self.DBlist[`self.boardsize`][DBindex].namelist[self.DBlist[`self.boardsize`][DBindex].current[indexWithinCurrent]][4]] |
|---|
| 172 | | except: t2 = '' |
|---|
| 173 | | |
|---|
| 174 | | return t, t2 |
|---|
| | 138 | char* t = new char[]; |
|---|
| | 139 | |
|---|
| | 140 | if (node.has_key("PW")) strcat(t, node.getstr("PW", 0)); |
|---|
| | 141 | else strcat(t, " ?"); |
|---|
| | 142 | if (node.has_key("WR")) strcat(t, node.getstr("WR", 0)); |
|---|
| | 143 | |
|---|
| | 144 | strcat(t, " - "); |
|---|
| | 145 | |
|---|
| | 146 | if (node.has_key("PB")) strcat(t, node.getstr("PB", 0)); |
|---|
| | 147 | else strcat(t, " ?"); |
|---|
| | 148 | if (node.has_key("BR")) strcat(t, node.getstr("BR", 0)); |
|---|
| | 149 | |
|---|
| | 150 | if (node.has_key("RE")) strcat(t, node.getstr("RE", 0)); |
|---|
| | 151 | if (node.has_key('KM')) { |
|---|
| | 152 | strcat(t, " (Komi "); |
|---|
| | 153 | strcat(t, node.getstr("KM", 0)); |
|---|
| | 154 | strcat(t, ")"); |
|---|
| | 155 | } |
|---|
| | 156 | if (node.has_key("HA")) { |
|---|
| | 157 | strcat(t, " (Hcp "); |
|---|
| | 158 | strcat(t, node.getstr("HA", 0)); |
|---|
| | 159 | strcat(t, ")"); |
|---|
| | 160 | } |
|---|
| | 161 | |
|---|
| | 162 | strcat(t, "\n"); |
|---|
| | 163 | |
|---|
| | 164 | if (node.has_key("EV")) { |
|---|
| | 165 | strcat(t, node.getstr("EV", 0)); |
|---|
| | 166 | strcat(t, ", "); |
|---|
| | 167 | } |
|---|
| | 168 | if (node.has_key("RO")) { |
|---|
| | 169 | strcat(t, node.getstr("RO", 0)); |
|---|
| | 170 | strcat(t, ", "); |
|---|
| | 171 | } |
|---|
| | 172 | if (node.has_key("DT")) { |
|---|
| | 173 | strcat(t, node.getstr("DT", 0)); |
|---|
| | 174 | strcat(t, "\n"); |
|---|
| | 175 | } |
|---|
| | 176 | |
|---|
| | 177 | if (node.has_key("GC")) { |
|---|
| | 178 | char* s = node.getstr("GC", 0); |
|---|
| | 179 | char* gc = new char[strlen(s)+1]; |
|---|
| | 180 | int gcIndex = 0 |
|---|
| | 181 | for(int i=0; i<strlen(s); i++) |
|---|
| | 182 | if (s[i] != '\n' && s[i] != '\r') gc[gcIndex++] = s[i]; |
|---|
| | 183 | else gc[gcIndex++] = ' '; |
|---|
| | 184 | gc[gcIndex] = 0; |
|---|
| | 185 | strcat(t, gc); |
|---|
| | 186 | delete [] gc; |
|---|
| | 187 | } |
|---|
| | 188 | |
|---|
| | 189 | char* t2 = new char[]; |
|---|
| | 190 | try { |
|---|
| | 191 | t2 = 'Commentary in ' +\ |
|---|
| | 192 | self.references[self.DBlist[`self.boardsize`][DBindex].namelist[self.DBlist[`self.boardsize`][DBindex].current[indexWithinCurrent]][4]]; |
|---|
| | 193 | } |
|---|
| | 194 | catch() else t2 = ''; |
|---|
| | 195 | |
|---|
| | 196 | strcpy ...; |
|---|
| | 197 | delete [] t; |
|---|
| | 198 | delete [] t2; |
|---|
| | 199 | return t, t2; |
|---|