Load opponent logo based on handle in ICS play (WB)
authorH.G. Muller <h.g.muller@hccnet.nl>
Thu, 29 Nov 2012 19:25:35 +0000 (20:25 +0100)
committerH.G. Muller <h.g.muller@hccnet.nl>
Thu, 29 Nov 2012 19:59:31 +0000 (20:59 +0100)
The logos for handles on FICS are sought in folder logos\freeches.org\*.bmp,
etc. If no logo for the handle is found there, the logo of the ICS is
displayed as usual.

winboard/winboard.c

index cc4b5a9..88092ac 100644 (file)
@@ -1006,8 +1006,14 @@ LoadLogo(ChessProgramState *cps, int n, Boolean ics)
       }\r
   } else if(appData.autoLogo) {\r
       if(ics) { // [HGM] logo: in ICS mode second can be used for ICS\r
-       sprintf(buf, "logos\\%s.bmp", appData.icsHost);\r
-       cps->programLogo = LoadImage( 0, buf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );\r
+       char *opponent = "";\r
+       if(gameMode == IcsPlayingWhite) opponent = gameInfo.black;\r
+       if(gameMode == IcsPlayingBlack) opponent = gameInfo.white;\r
+       sprintf(buf, "logos\\%s\\%s.bmp", appData.icsHost, opponent);\r
+       if(!*opponent || !(cps->programLogo = LoadImage( 0, buf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ))) {\r
+           sprintf(buf, "logos\\%s.bmp", appData.icsHost);\r
+           cps->programLogo = LoadImage( 0, buf, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );\r
+       }\r
       } else\r
       if(appData.directory[n] && appData.directory[n][0]) {\r
         SetCurrentDirectory(appData.directory[n]);\r