aboutsummaryrefslogtreecommitdiff
path: root/assets/manual_img/screenshot_20161203_223055.png
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2020-07-26 18:53:16 +0200
committerorwell96 <orwell@bleipb.de>2020-07-26 18:53:16 +0200
commit00031064a5ef66306fe49eb7ee5fa6dfe1454238 (patch)
tree540532e59a88d61a9f5464186ddae39c5ce24a48 /assets/manual_img/screenshot_20161203_223055.png
parentd65ba80df77432849b3cf852619706632a4e4408 (diff)
downloadadvtrains-00031064a5ef66306fe49eb7ee5fa6dfe1454238.tar.gz
advtrains-00031064a5ef66306fe49eb7ee5fa6dfe1454238.tar.bz2
advtrains-00031064a5ef66306fe49eb7ee5fa6dfe1454238.zip
Do not unload wagons when a player that is logged in sits in itrelease-2.1.3
Diffstat (limited to 'assets/manual_img/screenshot_20161203_223055.png')
0 files changed, 0 insertions, 0 deletions
ass="hl kwc">std::string QuicktuneValue::getString() { switch(type){ case QVT_NONE: return "(none)"; case QVT_FLOAT: return ftos(value_QVT_FLOAT.current); } return "<invalid type>"; } void QuicktuneValue::relativeAdd(float amount) { switch(type){ case QVT_NONE: break; case QVT_FLOAT: value_QVT_FLOAT.current += amount * (value_QVT_FLOAT.max - value_QVT_FLOAT.min); if(value_QVT_FLOAT.current > value_QVT_FLOAT.max) value_QVT_FLOAT.current = value_QVT_FLOAT.max; if(value_QVT_FLOAT.current < value_QVT_FLOAT.min) value_QVT_FLOAT.current = value_QVT_FLOAT.min; break; } } static std::map<std::string, QuicktuneValue> g_values; static std::vector<std::string> g_names; std::mutex *g_mutex = NULL; static void makeMutex() { if(!g_mutex){ g_mutex = new std::mutex(); } } std::vector<std::string> getQuicktuneNames() { return g_names; } QuicktuneValue getQuicktuneValue(const std::string &name) { makeMutex(); MutexAutoLock lock(*g_mutex); std::map<std::string, QuicktuneValue>::iterator i = g_values.find(name); if(i == g_values.end()){ QuicktuneValue val; val.type = QVT_NONE; return val; } return i->second; } void setQuicktuneValue(const std::string &name, const QuicktuneValue &val) { makeMutex(); MutexAutoLock lock(*g_mutex); g_values[name] = val; g_values[name].modified = true; } void updateQuicktuneValue(const std::string &name, QuicktuneValue &val) { makeMutex(); MutexAutoLock lock(*g_mutex); std::map<std::string, QuicktuneValue>::iterator i = g_values.find(name); if(i == g_values.end()){ g_values[name] = val; g_names.push_back(name); return; } QuicktuneValue &ref = i->second; if(ref.modified) val = ref; else{ ref = val; ref.modified = false; } }