MCPcopy Create free account
hub / github.com/ddnet/ddnet / ToVersion

Function ToVersion

src/engine/client/client.cpp:2430–2448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2428static const TVersion gs_InvalidVersion = std::make_tuple(-1, -1, -1);
2429
2430static TVersion ToVersion(char *pStr)
2431{
2432 int aVersion[3] = {0, 0, 0};
2433 const char *p = strtok(pStr, ".");
2434
2435 for(int i = 0; i < 3 && p; ++i)
2436 {
2437 if(!str_isallnum(p))
2438 return gs_InvalidVersion;
2439
2440 aVersion[i] = str_toint(p);
2441 p = strtok(nullptr, ".");
2442 }
2443
2444 if(p)
2445 return gs_InvalidVersion;
2446
2447 return std::make_tuple(aVersion[0], aVersion[1], aVersion[2]);
2448}
2449
2450void CClient::LoadDDNetInfo()
2451{

Callers 1

LoadDDNetInfoMethod · 0.85

Calls 2

str_isallnumFunction · 0.85
str_tointFunction · 0.85

Tested by

no test coverage detected