コード例 #1
0
// alias for readability, both turn right | left
inline bool areSameSide(const RouteStep &lhs, const RouteStep &rhs)
{
    const auto is_left = [](const RouteStep &step) {
        return hasModifier(step, DirectionModifier::Straight) ||
               hasLeftModifier(step.maneuver.instruction);
    };

    const auto is_right = [](const RouteStep &step) {
        return hasModifier(step, DirectionModifier::Straight) ||
               hasRightModifier(step.maneuver.instruction);
    };

    return (is_left(lhs) && is_left(rhs)) || (is_right(lhs) && is_right(rhs));
}
コード例 #2
0
double EU3Country::getBadboyLimit() const
{
	double badboyLimit = 30.0;

	// gov effects
	if (government == "despotic_monarchy" || government == "tribal_despotism")
		badboyLimit += 10.0;

	// modifier effects
	if (hasModifier("the_licensing_of_the_press_act"))
		badboyLimit -= 3.0;
	if (hasModifier("the_witchcraft_act"))
		badboyLimit -= 2.0;
	if (hasModifier("the_education_act"))
		badboyLimit -= 2.0;
	if (hasModifier("revocation_of_restraint_of_appeals"))
		badboyLimit -= 2.0;
	if (hasModifier("colonial_expansions"))
		badboyLimit -= 3.0;
	if (hasModifier("hire_privateers"))
		badboyLimit -= 3.0;
	if (hasModifier("the_anti_piracy_act"))
		badboyLimit -= 3.0;

	// ruler effects (DIP, tribal MIL) not taken into account - assume the best (DIP 8/MIL 8)
	badboyLimit += 8.0;

	// legitimacy effect (-5 at 0, +5 at 100)
	badboyLimit += 10 * (legitimacy - 0.5);

	return badboyLimit;
}
コード例 #3
0
 wxString KeyboardShortcut::shortcutMenuItemString(const wxString& name) const {
     if (!hasKey())
         return name;
     
     wxString result;
     result << name << "\t";
     if (hasModifier())
         result << modifierMenuString() << "+";
     result << keyMenuString();
     return result;
 }
コード例 #4
0
ファイル: view_object.cpp プロジェクト: bstahly/keeperrl
vector<string> ViewObject::getLegend() const {
  vector<string> ret { description };
  if (getAttribute(Attribute::LEVEL) > -1)
    ret[0] = ret[0] + ", level " + getAttributeString(Attribute::LEVEL);
  if (getAttribute(Attribute::EFFICIENCY) > -1)
    ret[0] = ret[0] + ", efficiency " + getAttributeString(Attribute::EFFICIENCY);
  if (getAttribute(Attribute::ATTACK) > -1)
    ret.push_back("Attack " + getAttributeString(Attribute::ATTACK) +
          " defense " + getAttributeString(Attribute::DEFENSE));
  if (hasModifier(Modifier::PLANNED))
    ret.push_back("Planned");
  if (hasModifier(Modifier::SLEEPING))
    ret.push_back("Sleeping");
  if (position.x > -1)
    ret.push_back(toString(position.x) + ", " + toString(position.y));
#ifndef RELEASE
  ret.push_back("Morale " + getAttributeString(Attribute::MORALE));
#endif
  append(ret, adjectives);
  return ret;
}
コード例 #5
0
 bool KeyboardShortcut::alwaysShowModifier() const {
     switch (m_key) {
         case WXK_BACK:
         case WXK_TAB:
         case WXK_RETURN:
         case WXK_ESCAPE:
         case WXK_SPACE:
         case WXK_DELETE:
         case WXK_END:
         case WXK_HOME:
         case WXK_LEFT:
         case WXK_UP:
         case WXK_RIGHT:
         case WXK_DOWN:
         case WXK_INSERT:
         case WXK_PAGEUP:
         case WXK_PAGEDOWN:
             return false;
         case WXK_F1:
         case WXK_F2:
         case WXK_F3:
         case WXK_F4:
         case WXK_F5:
         case WXK_F6:
         case WXK_F7:
         case WXK_F8:
         case WXK_F9:
         case WXK_F10:
         case WXK_F11:
         case WXK_F12:
         case WXK_F13:
         case WXK_F14:
         case WXK_F15:
         case WXK_F16:
         case WXK_F17:
         case WXK_F18:
         case WXK_F19:
         case WXK_F20:
         case WXK_F21:
         case WXK_F22:
         case WXK_F23:
         case WXK_F24:
             return true;
         default:
             if (!hasModifier())
                 return false;
             if (m_modifier1 == WXK_SHIFT && m_modifier2 == WXK_NONE)
                 return false;
             return true;
     }
 }
コード例 #6
0
 wxString KeyboardShortcut::asJsonString() const {
     wxString str;
     str << "{ key:" << key() << ", modifiers: [";
     
     bool hadModifier = false;
     for (size_t i = 0; i < 3; ++i) {
         if (hasModifier(i)) {
             if (hadModifier)
                 str << ", ";
             str << modifier(i);
             hadModifier = true;
         } else {
             hadModifier = false;
         }
     }
     
     str << "] }";
     
     return str;
 }
コード例 #7
0
ファイル: UserInputMapper.cpp プロジェクト: rabedik/hifi
bool UserInputMapper::addInputChannel(Action action, const Input& input, const Input& modifier, float scale) {
    // Check that the device is registered
    if (!getDeviceProxy(input)) {
        qDebug() << "UserInputMapper::addInputChannel: The input comes from a device #" << input.getDevice() << "is unknown. no inputChannel mapped.";
        return false;
    }
    
    auto inputChannel = InputChannel(input, modifier, action, scale);

    // Insert or replace the input to modifiers
    if (inputChannel.hasModifier()) {
        auto& modifiers = _inputToModifiersMap[input.getID()];
        modifiers.push_back(inputChannel._modifier);
        std::sort(modifiers.begin(), modifiers.end());
    }

    // Now update the action To Inputs side of things
    _actionToInputsMap.insert(ActionToInputsMap::value_type(action, inputChannel));

    return true;
}
コード例 #8
0
ファイル: disposition.cpp プロジェクト: burner/vmime
void disposition::addModifier(const string& modifier)
{
	if (!hasModifier(modifier))
		m_modifiers.push_back(utility::stringUtils::toLower(modifier));
}