void Crosstable::Destroy () { for (uint player=0; player < PlayerCount; player++) { playerDataT * pdata = PlayerData[player]; ASSERT (pdata != NULL); #ifdef WINCE my_Tcl_Free((char*)pdata->name); #else delete[] pdata->name; #endif for (uint opp = 0; opp < PlayerCount; opp++) { clashT * clash = pdata->firstClash[opp]; while (clash != NULL) { clashT * temp = clash->next; #ifdef WINCE my_Tcl_Free((char*)clash); #else delete clash; #endif clash = temp; } } #ifdef WINCE my_Tcl_Free((char*)pdata); #else delete pdata; #endif } }
void my_free(void * address) { ASSERT(address!=NULL); #ifdef WINCE my_Tcl_Free((char*)address); #else free(address); #endif }
// scid_TB_init: // Initialises the tablebases given a directory string. All the tables // to be used must be in the directory; subdirectories are not // scanned. However, the directory string may have more than one // dircetory in it, separated by commas (,) or semicolons (;). // Returns the same value as scid_TB_MaxPieces(). uint scid_TB_Init (const char * egtb_path) { EGTB_maxpieces = (uint) IInitializeTb ((char *) egtb_path); #ifdef WINCE if (EGTB_cache != NULL) { my_Tcl_Free( (char *) EGTB_cache); } EGTB_cache = (byte *)my_Tcl_Alloc(sizeof(byte [EGTB_cachesize])); #else if (EGTB_cache != NULL) { delete[] (byte *) EGTB_cache; } EGTB_cache = new byte [EGTB_cachesize]; #endif FTbSetCacheSize (EGTB_cache, EGTB_cachesize); return EGTB_maxpieces; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // TreeCache::Delete(): // void TreeCache::Delete () { if (CacheSize > 0) { ASSERT (Cache != NULL); for (uint i=0; i < NumInUse; i++) { if (Cache[i].cfilter != NULL) { delete Cache[i].cfilter; } } #ifdef WINCE my_Tcl_Free((char*) Cache); #else delete[] Cache; #endif } CacheSize = 0; NumInUse = 0; Cache = NULL; MostRecentIndex = 0; }