void SPItemN (string &s, const string &tag, string &item) { int i = 0; unsigned int ii = 0; item = ""; if (s.size() == 0 || tag.size() == 0) return; string tg = "[" + tag + "]"; i = SPosN (s, tg); if (i < 0) return; ii = i + tg.size(); while (s[ii] != '[' && s[ii] != '#' && ii < s.size()) { item += s[ii]; ii++; } }
void CEvents::MakeUnlockList (const string& unlockstr) { for (size_t event=0; event<EventList.size(); event++) { for (size_t cup=0; cup<EventList[event].cups.size(); cup++) { EventList[event].cups[cup]->Unlocked = false; } } for (size_t event=0; event<EventList.size(); event++) { for (size_t cup=0; cup<EventList[event].cups.size(); cup++) { const string& cp = GetCup (event, cup); bool passed = SPosN (unlockstr, cp) != string::npos; if (cup < 1) EventList[event].cups[0]->Unlocked = true; if (passed) { EventList[event].cups[cup]->Unlocked = true; if (cup+1 < EventList[event].cups.size()) EventList[event].cups[cup+1]->Unlocked = true; } } } }
void CEvents::MakeUnlockList (string unlockstr) { int event, cup, passed; string cp; for (event=0; event<numEvents; event++) { for (cup=0; cup<EventList[event].num_cups; cup++) { Unlocked[event][cup] = false; } } for (event=0; event<numEvents; event++) { for (cup=0; cup<EventList[event].num_cups; cup++) { cp = GetCup (event, cup); passed = SPosN (unlockstr, cp); if (cup < 1) Unlocked[event][0] = true; if (passed >= 0) { Unlocked[event][cup] = true; Unlocked[event][cup+1] = true; } } } }
int SPPosN (string &s, const string &tag) { string tg = "[" + tag + "]"; return SPosN (s, tg); }
bool SPExistsN (string &s, const string &tag) { string tg = "[" + tag + "]"; int i = SPosN (s, tg); if (i < 0) return false; return true; }