result_t SingleDataField::create(const string id, const unsigned char length, const string name, const string comment, const string unit, const PartType partType, int divisor, map<unsigned int, string> values, const string constantValue, const bool verifyValue, SingleDataField* &returnField) { DataType* dataType = DataTypeList::getInstance()->get(id, length==REMAIN_LEN ? (unsigned char)0 : length); if (!dataType) { return RESULT_ERR_NOTFOUND; } unsigned char bitCount = dataType->getBitCount(); unsigned char byteCount = (unsigned char)((bitCount + 7) / 8); if (dataType->isAdjustableLength()) { // check length if ((bitCount % 8) != 0) { if (length == 0) { bitCount = 1; // default bit count: 1 bit } else if (length <= bitCount) { bitCount = length; } else { return RESULT_ERR_OUT_OF_RANGE; // invalid length } byteCount = (unsigned char)((bitCount + 7) / 8); } else if (length == 0) { byteCount = 1; //default byte count: 1 byte } else if (length <= byteCount || length == REMAIN_LEN) { byteCount = length; } else { return RESULT_ERR_OUT_OF_RANGE; // invalid length } } if (!constantValue.empty()) { returnField = new ConstantDataField(name, comment, unit, dataType, partType, byteCount, constantValue, verifyValue); return RESULT_OK; } if (dataType->isNumeric()) { NumberDataType* numType = (NumberDataType*)dataType; if (values.empty() && numType->hasFlag(DAY)) { for (unsigned int i = 0; i < sizeof(dayNames) / sizeof(dayNames[0]); i++) values[numType->getMinValue() + i] = dayNames[i]; } result_t result = numType->derive(divisor, bitCount, numType); if (result!=RESULT_OK) { return result; } if (values.empty()) { returnField = new SingleDataField(name, comment, unit, numType, partType, byteCount); return RESULT_OK; } if (values.begin()->first < numType->getMinValue() || values.rbegin()->first > numType->getMaxValue()) { return RESULT_ERR_OUT_OF_RANGE; } returnField = new ValueListDataField(name, comment, unit, numType, partType, byteCount, values); return RESULT_OK; } if (divisor != 0 || !values.empty()) { return RESULT_ERR_INVALID_ARG; // cannot set divisor or values for string field } returnField = new SingleDataField(name, comment, unit, (StringDataType*)dataType, partType, byteCount); return RESULT_OK; }
bool work() { int x, y, z; scanf("%d", &x); if (!x) return false; switch(x) { case 1: scanf("%d%d", &y, &z); a.insert(make_pair(z, y)); break; case 3: if (a.empty()) { printf("%d\n", 0); } else { it t = a.begin(); printf("%d\n", t -> second); a.erase(t); } break; case 2: if (a.empty()) { printf("%d\n", 0); } else { it t = a.end(); --t; printf("%d\n", t -> second); a.erase(t); } break; } return true; }
result_t SingleDataField::derive(string name, string comment, string unit, const PartType partType, int divisor, map<unsigned int, string> values, vector<SingleDataField*>& fields) { if (m_partType != pt_any && partType == pt_any) return RESULT_ERR_INVALID_PART; // cannot create a template from a concrete instance bool numeric = m_dataType->isNumeric(); if (!numeric && (divisor != 0 || !values.empty())) return RESULT_ERR_INVALID_ARG; // cannot set divisor or values for non-numeric field if (name.empty()) name = m_name; if (comment.empty()) comment = m_comment; if (unit.empty()) unit = m_unit; DataType* dataType = m_dataType; if (numeric) { NumberDataType* numType = (NumberDataType*)m_dataType; result_t result = numType->derive(divisor, 0, numType); if (result != RESULT_OK) return result; dataType = numType; } if (values.empty()) { fields.push_back(new SingleDataField(name, comment, unit, dataType, partType, m_length)); } else { fields.push_back(new ValueListDataField(name, comment, unit, (NumberDataType*)dataType, partType, m_length, values)); } return RESULT_OK; }
VecX<T>& operator+=(VecX<T> const &a) { if (a.data.empty() && a.px.empty()) return *this; rank = rank < a.rank ? a.rank : rank; if (!px.empty() && !a.px.empty()) { for (it_cmap it=a.px.begin(); it!=a.px.end(); ++it) { if (px[it->first] + it->second == 0) continue; px[it->first] = px[it->first] + it->second; } } else if(!px.empty()) { data = a.data; for (it_cmap it=px.begin(); it!=px.end(); ++it) data[it->first] = data[it->first] + it->second; px.clear(); } else if(!a.px.empty()) { if (!data.empty()) { for (it_cmap it=a.px.begin(); it!=a.px.end(); ++it) data[it->first] = data[it->first] + it->second; } else { px = a.px; } } else { if (!data.empty()) { for (int i=0; i<rank; ++i) data[i] = data[i] + a.data[i]; } else { data = a.data; } } return *this; }
void info() { cout<<endl<<"--------------------------------"<<endl; cout<<" Rank:\t"<<rank<<endl; cout<<" Contains:\t"<<(!px.empty()?px.size():data.size())<<endl; cout<<"Size(1 el):\t"<<sizeof(T)<<" bytes"<<endl; cout<<"Total size:\t~"<<data.size()*sizeof(typename vector<T>::value_type) + px.size()*sizeof(typename map<int_8,T>::value_type)<<" bytes"<<endl; cout<<"Compressed:\t"<<(!px.empty()?"Yes":"No")<<endl; if (!px.empty()) cout<<" Dense:\t"<<(double)px.size()/rank*100<<"%"<<endl; cout<<"--------------------------------"<<endl; }
~SharedLRU() { contents.clear(); lru.clear(); if (!weak_refs.empty()) { lderr(cct) << "leaked refs:\n"; dump_weak_refs(*_dout); *_dout << dendl; assert(weak_refs.empty()); } }
int main() { long long int opern, value, temp, highest; char type[10]; bool h**o, hetro; cin>>opern; while (opern--) { scanf("%s %lld", type, &value); value += MOD; h**o = false; hetro = false; if (type[0] == 'i') { data[value]++; temp = data[value]; save[temp * FACT + value] = true; if (temp > 1) { save.erase((temp - 1) * FACT + value); } } else { if (data[value] > 0) { if (data[value] == 1) { save.erase(FACT + value); data.erase(value); } else { data[value]--; temp = data[value]; save[temp * FACT + value] = true; save.erase((temp + 1) * FACT + value); } } } if (!save.empty() && !data.empty()) { highest = save.rbegin()->first; highest = highest / FACT; } else { highest = 0; } if (highest > 1) { h**o = true; } if (save.size() > 1 && data.size() > 1) { hetro = true; } if (h**o && hetro) { printf("both\n"); // << endl; } else if (h**o && !hetro) { printf("h**o\n"); } else if (!h**o && hetro) { printf("hetero\n"); } else { printf("neither\n"); } } return 0; }
void adjust(map<int, int>& small, int& ns, map<int, int>& large, int& nl) { if(small.empty() || large.empty()) return; int s = small.rbegin()->first; int l = large.begin()->first; if(s > l) { del(small, s); del(large, l); small[l]++; large[s]++; } }
void CsvWriter::write(ostream & output, map<int, list<Rule> > rules) { // write header if (rules.empty()) return; map<string, string>::iterator at; for (at=rules.begin()->second.front().attributes.begin(); at!=rules.begin()->second.front().attributes.end(); ++at) { output << at->first << ";"; } output << rules.begin()->second.front().class_attribute.second << endl; map<int, list<Rule> >::iterator im; for (im=rules.begin(); im!=rules.end(); ++im) { list<Rule>::iterator ir; for (ir=im->second.begin(); ir!=im->second.end(); ++ir) { map<string, string>::iterator ia; for (ia=ir->attributes.begin(); ia!=ir->attributes.end(); ++ia) { if (ia->second!="") { output << ia->second; } output << ";"; } output << ir->decision; output << endl; } } output.flush(); }
const vector<std::string> &TulipMaterialDesignIcons::getSupportedIcons() { if (iconCodePoint.empty()) { initIconCodePoints(); } return iconsNames; }
GLenum LuaFBOs::ParseAttachment(const string& name) { static map<string, GLenum> attachMap; if (attachMap.empty()) { attachMap["depth"] = GL_DEPTH_ATTACHMENT_EXT; attachMap["stencil"] = GL_STENCIL_ATTACHMENT_EXT; attachMap["color0"] = GL_COLOR_ATTACHMENT0_EXT; attachMap["color1"] = GL_COLOR_ATTACHMENT1_EXT; attachMap["color2"] = GL_COLOR_ATTACHMENT2_EXT; attachMap["color3"] = GL_COLOR_ATTACHMENT3_EXT; attachMap["color4"] = GL_COLOR_ATTACHMENT4_EXT; attachMap["color5"] = GL_COLOR_ATTACHMENT5_EXT; attachMap["color6"] = GL_COLOR_ATTACHMENT6_EXT; attachMap["color7"] = GL_COLOR_ATTACHMENT7_EXT; attachMap["color8"] = GL_COLOR_ATTACHMENT8_EXT; attachMap["color9"] = GL_COLOR_ATTACHMENT9_EXT; attachMap["color10"] = GL_COLOR_ATTACHMENT10_EXT; attachMap["color11"] = GL_COLOR_ATTACHMENT11_EXT; attachMap["color12"] = GL_COLOR_ATTACHMENT12_EXT; attachMap["color13"] = GL_COLOR_ATTACHMENT13_EXT; attachMap["color14"] = GL_COLOR_ATTACHMENT14_EXT; attachMap["color15"] = GL_COLOR_ATTACHMENT15_EXT; } map<string, GLenum>::const_iterator it = attachMap.find(name); if (it != attachMap.end()) { return it->second; } return 0; }
void Grapher::labelYOrderedPoints(map<float, float> const& _data, int _maxCount, float _minFactor) const { int ly = active.top() + 6; int pc = 0; if (_data.empty()) return; float smallestAllowed = prev(_data.end())->first * _minFactor; BOOST_REVERSE_FOREACH (auto peak, _data) if ((peak.first > smallestAllowed || _minFactor == 0) && pc < _maxCount) { int x = xTP(peak.second); int y = yTP(peak.first); p->setPen(QColor::fromHsvF(float(pc) / _maxCount, 1.f, 0.5f, 0.5f)); p->drawEllipse(QPoint(x, y), 4, 4); p->drawLine(x, y - 4, x, ly + 6); QString f = QString::fromStdString(pLabel(xT(peak.second), yT(peak.first))); int fw = p->fontMetrics().width(f); p->drawLine(x + 16 + fw + 2, ly + 6, x, ly + 6); p->setPen(QColor::fromHsvF(0, 0.f, .35f)); p->fillRect(QRect(x+12, ly-6, fw + 8, 12), QBrush(QColor(255, 255, 255, 160))); p->drawText(QRect(x+16, ly-6, 160, 12), Qt::AlignVCenter, f); ly += 14; ++pc; } }
bool TulipMaterialDesignIcons::isIconSupported(const std::string &iconName) { if (iconCodePoint.empty()) { initIconCodePoints(); } return iconCodePoint.find(iconName.c_str()) != iconCodePoint.end(); }
ll forbidden(ll n) { if (n < 4) return 0; if (n < 9) return 1; if (n < 13) return 2; static map<ll,ll> memo; if (memo.empty()) { ll p = 1; ll q = 0; while (0 < p) { memo[p] = q; q = 8*q + 2*p; p *= 10; } } if (memo.count(n)) return memo[n]; ll m = floor_log(n); ll a = n / m; ll b = n - a * m; ll result = 0; for (auto i : range(a)) { result += (i == 4 or i == 9) ? m : forbidden(m); } result += (a == 4 or a == 9) ? b+1 : forbidden(b); return memo[n] = result; }
static void InitEntities() { if( !g_mapEntitiesToChars.empty() ) return; static struct Entity { char c; const char *pEntity; } const EntityTable[] = { { '&', "amp", }, { '\"', "quot", }, { '\'', "apos", }, { '<', "lt", }, { '>', "gt", } }; for( unsigned i = 0; i < ARRAYLEN(EntityTable); ++i ) { const Entity &ent = EntityTable[i]; g_mapEntitiesToChars[ent.pEntity] = RString(1, ent.c); g_mapCharsToEntities[ent.c] = ent.pEntity; } }
void LocalizerImpl::saveUnknown(const string &file) { if (!unknown.empty()) { ofstream fout(file.c_str(), ios::trunc|ios::out); for (map<string, string>::iterator it = unknown.begin(); it!=unknown.end(); ++it) { string value = it->second; string key = it->first; if (value.empty()) { value = key; int nl = value.find(newline); int n2 = value.find("."); if (nl!=string::npos || n2!=string::npos) { while (nl!=string::npos) { value.replace(nl, newline.length(), "\\n"); nl = value.find(newline); } key = "help:" + itos(value.length()) + itos(value.find_first_of(".")); } } fout << key << " = " << value << endl; } } }
void TriggerExplosion ( Texture* tex, GLfloat x, GLfloat y, GLfloat Blastradius ) { cout<<"TriggerExplosion: ExplosionsList.size()="<<ExplosionsList.size() <<endl; bStartshaking = true; //exit(50); // int i; cout<<"------------->explosion() called"<<endl; //add new element to the map if ( ExplosionsList.empty() ) ExplosionsList[0]=explosion(); else ExplosionsList[ ( ExplosionsList.rbegin() )->first+1]=explosion(); cout<<"------------->explosion() call finished"<<endl; //exit(0); ExplosionsList[ExplosionsList.size()-1].iterateSheets = true; ExplosionsList[ExplosionsList.size()-1].animationTimer.Start(); ExplosionsList[ExplosionsList.size()-1].Load ( tex, 4, 4 ); ExplosionsList[ExplosionsList.size()-1].Scale ( Blastradius/30.0 ); // for ( i=0; i < ExplosionsList.size(); i++ ) { ExplosionsList[ExplosionsList.size()-1].x = x; ExplosionsList[ExplosionsList.size()-1].y = y; ExplosionsList[ExplosionsList.size()-1].Active = true; ExplosionsList[ExplosionsList.size()-1].CurrentFrame = 0; ExplosionsList[ExplosionsList.size()-1].startTicks = Timer[0].GetTicks(); cout<<"setting speed"<<endl; ExplosionsList[ExplosionsList.size()-1].setAnimationSpeed ( 16.0f ); // } cout<<"explosion at ("<<ExplosionsList[ExplosionsList.size()-1].x<<","<<ExplosionsList[ExplosionsList.size()-1].y<<")"<<endl; }
void DBFlush(bool fShutdown) { // Flush log data to the actual data file // on all files that are not in use printf("DBFlush(%s)\n", fShutdown ? "true" : "false"); CRITICAL_BLOCK(cs_db) { dbenv.txn_checkpoint(0, 0, 0); map<string, int>::iterator mi = mapFileUseCount.begin(); while (mi != mapFileUseCount.end()) { string strFile = (*mi).first; int nRefCount = (*mi).second; if (nRefCount == 0) { dbenv.lsn_reset(strFile.c_str(), 0); mapFileUseCount.erase(mi++); } else mi++; } if (fShutdown) { char** listp; if (mapFileUseCount.empty()) dbenv.log_archive(&listp, DB_ARCH_REMOVE); dbenv.close(0); fDbEnvInit = false; } } }
TSaslClient::TSaslClient(const string& mechanisms, const string& authenticationId, const string& protocol, const string& serverName, const map<string,string>& props, sasl_callback_t* callbacks) { conn = NULL; if (!props.empty()) { throw SaslServerImplException("Properties not yet supported"); } int result = sasl_client_new(protocol.c_str(), serverName.c_str(), NULL, NULL, callbacks, 0, &conn); if (result != SASL_OK) { if (conn) { throw SaslServerImplException(sasl_errdetail(conn)); } else { throw SaslServerImplException(sasl_errstring(result, NULL, NULL)); } } if (!authenticationId.empty()) { /* TODO: setup security property */ /* sasl_security_properties_t secprops; // populate secprops result = sasl_setprop(conn, SASL_AUTH_EXTERNAL, authenticationId.c_str()); */ } chosenMech = mechList = mechanisms; authComplete = false; clientStarted = false; }
string find_symbol (int addr) { map<uint16_t,string>::iterator mi; mi = exports.upper_bound(addr); if (exports.empty() || mi == exports.begin()) { std::stringstream ss; ss << '$' << std::hex << addr; return ss.str(); } else { mi--; if (mi->first == addr) return mi->second; else { std::stringstream ss; ss << mi->second << "+" << addr - mi->first; return ss.str(); } } }
static void get_dup_producer_names(map<BString, int32>& dups) { int32 id = 0; BMidiProducer* prod; while ((prod=BMidiRoster::NextProducer(&id)) != NULL) { if (!prod->IsLocal()) { BString name(prod->Name()); dup_name_map::iterator it = dups.find(name); if (it != dups.end()) (*it).second = (*it).second + 1; else { dups.insert(dup_name_map::value_type(name, 1)); } } } dup_name_map::iterator i; for (i = dups.begin(); i != dups.end(); i++) { if (i->second < 2) { dups.erase(i); /* THIS IS ABSOLUTELY NECESSARY -- if you try to iterate * over begin() when the map is empty(), it just hangs. */ if (dups.empty()) break; i = dups.begin(); } } for (i = dups.begin(); i != dups.end(); i++) { i->second = 1; } }
int main() { int kase; scanf("%d", &kase); while(kase --) { int C, n; tree.clear(); scanf("%d%d", &C, &n); x[0] = y[0] = w[0] = dist[0] = 0; for(int i = 1; i <= n; i++) scanf("%d%d%d", &x[i], &y[i], &w[i]), w[i] += w[i-1], dist[i] = dist[i-1] + abs(x[i] - x[i-1]) + abs(y[i] - y[i-1]), manhattan[i] = abs(x[i]) + abs(y[i]); f[0] = 0; tree[0] = 0; for(int i = 1; i <= n; i++) { int j = tree.begin()->second; while(!tree.empty() && w[i] - w[j] > C) tree.erase(tree.begin()->first), j = tree.begin()->second; f[i] = func(j) + dist[i] + manhattan[i]; tree[func(i)] = i; } printf("%d\n", f[n]); if(kase) printf("\n"); } return 0; }
static SRV call_cn(string iCommand, deque<string>& iArguments, deque<string>& oValues) { // 名前と命令を関連付けたmap typedef SRV (*Command)(deque<string>&, deque<string>&); static map<string, Command> theMap; if ( theMap.empty() ) { // 初回準備 #define d(iName) \ SRV _##iName(deque<string>&, deque<string>&); \ theMap[ #iName ] = _##iName // 命令一覧の宣言と関連付け。 d(at); #undef d } // 命令の存在を確認 map<string, Command>::const_iterator i = theMap.find(iCommand); if ( i==theMap.end() ) { return SRV(400, string()+"Error: '"+iCommand+"'という名前の命令は定義されていません。"); } // 実際に呼ぶ return i->second(iArguments, oValues); }
static uint char_type(sint32 c) { static map<sint, uint> _map; if (_map.empty()) { _map['K'] = RedKing; _map['G'] = RedAdvisor; _map['A'] = RedAdvisor; _map['B'] = RedBishop; _map['E'] = RedBishop; _map['R'] = RedRook; _map['H'] = RedKnight; _map['N'] = RedKnight; _map['C'] = RedCannon; _map['P'] = RedPawn; _map['k'] = BlackKing; _map['g'] = BlackAdvisor; _map['a'] = BlackAdvisor; _map['b'] = BlackBishop; _map['e'] = BlackBishop; _map['r'] = BlackRook; _map['h'] = BlackKnight; _map['n'] = BlackKnight; _map['c'] = BlackCannon; _map['p'] = BlackPawn; } if (_map.find(c) != _map.end()) return _map[c]; return InvaildPiece; }
result_t ValueListDataField::derive(string name, string comment, string unit, const PartType partType, int divisor, map<unsigned int, string> values, vector<SingleDataField*>& fields) { if (m_partType != pt_any && partType == pt_any) return RESULT_ERR_INVALID_PART; // cannot create a template from a concrete instance if (name.empty()) name = m_name; if (comment.empty()) comment = m_comment; if (unit.empty()) unit = m_unit; if (divisor != 0 && divisor != 1) return RESULT_ERR_INVALID_ARG; // cannot use divisor != 1 for value list field if (!values.empty()) { NumberDataType* num = (NumberDataType*)m_dataType; if (values.begin()->first < num->getMinValue() || values.rbegin()->first > num->getMaxValue()) return RESULT_ERR_INVALID_ARG; // cannot use divisor != 1 for value list field } else values = m_values; fields.push_back(new ValueListDataField(name, comment, unit, (NumberDataType*)m_dataType, partType, m_length, values)); return RESULT_OK; }
static sint type_char(uint32 t) { static map<uint, sint> _map; if (_map.empty()) { _map[RedKing] = 'K'; _map[RedAdvisor] = 'A'; _map[RedBishop] = 'B'; _map[RedRook] = 'R'; _map[RedKnight] = 'N'; _map[RedCannon] = 'C'; _map[RedPawn] = 'P'; _map[BlackKing] = 'k'; _map[BlackAdvisor] = 'a'; _map[BlackBishop] = 'b'; _map[BlackRook] = 'r'; _map[BlackKnight] = 'n'; _map[BlackCannon] = 'c'; _map[BlackPawn] = 'p'; } if (_map.find(t) != _map.end()) return _map[t]; return 0; }
VPtr lower_bound(const K& key) { VPtr val; list<VPtr> to_release; { Mutex::Locker l(lock); bool retry = false; do { retry = false; if (weak_refs.empty()) break; typename map<K, WeakVPtr>::iterator i = weak_refs.lower_bound(key); if (i == weak_refs.end()) --i; val = i->second.lock(); if (val) { lru_add(i->first, val, &to_release); } else { retry = true; } if (retry) cond.Wait(lock); } while (retry); } return val; }
// ---------------------------------------------------------------------------- ESpecType SpecType( const string& spectype ) // ---------------------------------------------------------------------------- { static map<string, ESpecType> typemap; if ( typemap.empty() ) { typemap["Integer"] = eType_Integer; typemap["Float"] = eType_Float; typemap["Flag"] = eType_Flag; typemap["Character"] = eType_Character; typemap["String"] = eType_String; } try { return typemap[spectype]; } catch( ... ) { AutoPtr<CObjReaderLineException> pErr( CObjReaderLineException::Create( eDiag_Warning, 0, "CVcfReader::xProcessMetaLineInfo: Unrecognized line or record type.", ILineError::eProblem_GeneralParsingError) ); pErr->Throw(); return eType_String; } };
long primeNumber(long n, map<long, int>& pCache){ long s, i, p = 0; map<long, int>::iterator it; if(n < 0) return -1; else if(n == 0) return 0; else if(n == 1) return 1; if(!pCache.empty()){ for(it = pCache.begin(); it != pCache.end(); ++it){ p = it->first; //cout<<it->first<<" -> "<<it->second<<endl; if(n % p == 0){ //cout<<it->second<<endl; pCache[p] = (it->second)+1; return p; }else if(p > n){ pCache.insert(pair<long, int>(n, 1)); return n; } } } s = (long)(sqrt(n)+1); for(i = 2; i <= s; i++){ if(n % i == 0){ if(i > p) pCache.insert(pair<long, int>(i, 1)); return i; } } pCache.insert(pair<long, int>(n, 1)); return n; //itself is a prime number; }
const std::map<std::string, int>& CCobUnitScriptNames::GetScriptMap() { if (!scriptMap.empty()) return scriptMap; const vector<string>& n = GetScriptNames(); for (size_t i = 0; i < n.size(); ++i) { scriptMap.insert(pair<string, int>(n[i], i)); } // support the old naming scheme scriptMap.insert(pair<string, int>("QueryPrimary", COBFN_QueryPrimary)); scriptMap.insert(pair<string, int>("QuerySecondary", COBFN_QueryPrimary + COBFN_Weapon_Funcs * 1)); scriptMap.insert(pair<string, int>("QueryTertiary", COBFN_QueryPrimary + COBFN_Weapon_Funcs * 2)); scriptMap.insert(pair<string, int>("AimPrimary", COBFN_AimPrimary)); scriptMap.insert(pair<string, int>("AimSecondary", COBFN_AimPrimary + COBFN_Weapon_Funcs * 1)); scriptMap.insert(pair<string, int>("AimTertiary", COBFN_AimPrimary + COBFN_Weapon_Funcs * 2)); scriptMap.insert(pair<string, int>("AimFromPrimary", COBFN_AimFromPrimary)); scriptMap.insert(pair<string, int>("AimFromSecondary", COBFN_AimFromPrimary + COBFN_Weapon_Funcs * 1)); scriptMap.insert(pair<string, int>("AimFromTertiary", COBFN_AimFromPrimary + COBFN_Weapon_Funcs * 2)); scriptMap.insert(pair<string, int>("FirePrimary", COBFN_FirePrimary)); scriptMap.insert(pair<string, int>("FireSecondary", COBFN_FirePrimary + COBFN_Weapon_Funcs * 1)); scriptMap.insert(pair<string, int>("FireTertiary", COBFN_FirePrimary + COBFN_Weapon_Funcs * 2)); //for (std::map<string, int>::const_iterator it = scriptMap.begin(); it != scriptMap.end(); ++it) { // LOG_L(L_DEBUG, "COBFN: %s -> %3d", it->first.c_str(), it->second); //} return scriptMap; }