Added ac-eras parameter, which enables multiple reward eras by allowing other ac_reward releated parameters to accept comma separated lists of values, one for each era
This commit is contained in:
34
src/util.cpp
34
src/util.cpp
@@ -18,6 +18,8 @@
|
||||
#include "komodo_defs.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#if (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__))
|
||||
#include <pthread.h>
|
||||
@@ -362,6 +364,38 @@ void ParseParameters(int argc, const char* const argv[])
|
||||
}
|
||||
}
|
||||
|
||||
void SplitToi64(const std::string& strVal, int64_t[_MAX_ERAS] *outVals, const int64_t nDefault)
|
||||
{
|
||||
istringstream ss(strVal);
|
||||
vector<int64_t> vec;
|
||||
|
||||
int64_t i, numVals = 0;
|
||||
|
||||
while ( ss.peek() == ' ' )
|
||||
ss.ignore();
|
||||
|
||||
while ( ss >> i )
|
||||
{
|
||||
outVals[numVals] = i;
|
||||
numVals += 1;
|
||||
|
||||
while ( ss.peek() == ' ' )
|
||||
ss.ignore();
|
||||
if ( ss.peek() == ',' )
|
||||
ss.ignore();
|
||||
while ( ss.peek() == ' ' )
|
||||
ss.ignore();
|
||||
}
|
||||
|
||||
if ( numVals > 0 )
|
||||
nDefault = outVals[numVals - 1];
|
||||
|
||||
for ( i=numVals; i < MAX_ERAS; i++ )
|
||||
{
|
||||
outVals[i] = nDefault;
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetArg(const std::string& strArg, const std::string& strDefault)
|
||||
{
|
||||
if (mapArgs.count(strArg))
|
||||
|
||||
Reference in New Issue
Block a user