-------------------------------------------------------------------------------------------- Warcraft III Statstring Parsing in C++ Written by Skywing -------------------------------------------------------------------------------------------- static const char *war3races[] = { "random", "humans", "orcs", "undead", "night elves", "unknown" }; } else if(*(DWORD *)teststatstring == 'WAR3') { int Level, BestRace, BestRaceWins; strcpy(statbuf, "Warcraft III: Reign of Chaos ("); if(teststatstring[4] && sscanf(teststatstring+5, "%d %d %d", &Level, &BestRace, &BestRaceWins) == 3) { if(BestRace > 4 || BestRace < 0) BestRace = 5; wsprintf(statbuf+strlen(statbuf), "level %d, best race %s, %d win%s)",Level, war3races[BestRace], BestRaceWins, BestRaceWins == 1 ? "" : "s"); } else if(!teststatstring[4]) { wsprintf(statbuf+strlen(statbuf), "No information available)"); } else { wsprintf(statbuf+strlen(statbuf), "unrecognized format: \"%s\")", teststatstring+5); }