OCheckListItem :: ~OCheckListItem ( )
{

    ResetCurrent();


}
Exemplo n.º 2
0
void
WaveComputer::Initialise()
{
  delta_time.Reset();
  ResetCurrent();
  waves.clear();
}
Exemplo n.º 3
0
/*
================
rvClientEntity::RunPhysics
================
*/
void rvClientEntity::RunPhysics( void ) {
	idPhysics* physics = GetPhysics();
	if ( physics ) {
		MakeCurrent();
		physics->Evaluate( gameLocal.time - gameLocal.previousTime, gameLocal.time );
		worldOrigin = physics->GetOrigin();
		worldAxis = physics->GetAxis();
		ResetCurrent();
	}
}
Exemplo n.º 4
0
	ChildToParentEnumerator(LPCITEMIDLIST theFullPidl, bool theChildToParent, bool theCurFolderAsItem)
		: myParentToChild(!theChildToParent), myCurFolderAsItem(theCurFolderAsItem)
	{
		UINT aSize = UtilPidlFunc::PidlSize(theFullPidl);
		myEnumerationPidl = (LPITEMIDLIST) CoTaskMemAlloc(aSize);
		CopyMemory(myEnumerationPidl, (void *)theFullPidl, aSize);

		FillItemVector();
		ResetCurrent();
	}
Exemplo n.º 5
0
void CParticleTools::OnParticleItemFocused(ListItemsVec& items)
{
	PropItemVec props;
	m_EditMode	= emEffect;

    ButtonValue* B;
	B=PHelper().CreateButton	(props,"Transform\\Edit",	"Reset",	ButtonValue::flFirstOnly);
    B->OnBtnClickEvent.bind		(this,&CParticleTools::OnControlClick);
    PHelper().CreateFlag32		(props,"Transform\\Type",	&m_Flags,	flSetXFORM,"Update","Set");
    
    // reset to default
    ResetCurrent	();
    
	if (!items.empty()){
	    for (ListItemsIt it=items.begin(); it!=items.end(); it++){
            ListItem* item = *it;
            if (item){         
                m_EditMode 			= EEditMode(item->Type());
                switch(m_EditMode){
                case emEffect:{
                    PS::CPEDef* def	= ((PS::CPEDef*)item->m_Object);
                	SetCurrentPE	(def);
                    def->FillProp	(EFFECT_PREFIX,props,item);
                }break;
                case emGroup:{
                    PS::CPGDef* def	= ((PS::CPGDef*)item->m_Object);
                	SetCurrentPG	(def);
                    def->FillProp	(GROUP_PREFIX,props,item);
                }break;
                default: THROW;
                }
            }
        }
    }
	m_ItemProps->AssignItems(props);
    UI->RedrawScene();
}
Exemplo n.º 6
0
int main(int argc, char* argv[])
{
	//Reset color
	std::cout << Format_Color("Default", FG) << Format_Color("Default", BG);

	config_um.conf_map = {
		{"FG", "Default"},
		{"BG", "Default"},
		{"Number_FG", "Default"},
		{"Number_BG", "Default"},
		{"Label_FG", "Default"},
		{"Label_BG", "Default"},
		{"Value_FG", "Default"},
		{"Value_BG", "Default"},
		{"Hilight_FG", "Default"},
		{"Hilight_BG", "Default"},
		{"Style", "Long"},
		{"Padding", ""}
	};

	if(argc == 1)
	{
		return PrintHelp();
	}

	for(int a = 1; a < argc; a++)
	{
		if(wolfstring::EndsWith(argv[a], ".wolfmenu"))
		{
			menu_count = true;
			menu_um.LoadFile(argv[a]);
		}

		if(wolfstring::EndsWith(argv[a], ".conf"))
		{
			config_um.LoadFile(argv[a]);
		}
	}

	if(menu_count)
	{
		std::cerr << "Menu count to low. Aborting.\n\n";
		return PrintHelp();
	}

	temp_map = menu_um.conf_map;

	size_t menu_index = 0;
	std::string style = config_um.GetVal("Style");

	while(1)
	{
		std::unordered_map<std::string, std::string> temp_map2 = {};

		if(current != "")
		{
			for(auto zz : temp_map)
			{
				if(wolfstring::StartsWith(zz.first, current))
				{
					temp_map2[zz.first] = zz.second;
				}
			}

			if(temp_map2.empty())
			{
				wolfstring::pstring_n("Nothing in menu.\n");
				ResetCurrent();
				temp_map2 = menu_um.conf_map;
			}
		}

		else
		{
			temp_map2 = menu_um.conf_map;
		}

		for(auto z : temp_map2)
		{
			std::cout << PrintColor(0) << config_um.GetVal("Padding") << PrintColor(1) << menu_index << PrintColor(2) << ": " << PrintColor(3) << z.first << PrintColor(0);
			menu_index++;

			if(style == "Tall")
			{
				printf("\n");
			}

			if(style == "Long")
			{
				printf(" ");
			}
		}

		std::string buffer = "";
		std::cout << "\nCurrent: " << current << " > " << PrintColor(4);
		std::getline(std::cin, buffer);
		std::cout << PrintColor(0);

		if(buffer != "")
		{
			bool number = true;
			for(const char &c : buffer)
			{
				if(!isdigit(c))
				{
					number = false;
					goto out;
				}
			}
			out:

			if(number)
			{
				size_t selection = std::stoi(buffer);

				if(selection < menu_index)
				{
					size_t current_index = 0;

					for(const auto &zzz : temp_map2)
					{
						if(selection == current_index)
						{
							system(zzz.second.c_str());
							return 0;
						}

						current_index++;
					}
				}
			}

			else
			{
				if(buffer == "*")
				{
					ResetCurrent();
				}

				if(wolfstring::v_match(buffer, {"quit", "exit", "\\c"}))
				{
					return 0;
				}

				else
				{
					current += buffer;
				}
			}
		}

		menu_index = 0;

		temp_map = temp_map2;
	}

	return 0;
}
Exemplo n.º 7
0
	STDMETHODIMP Reset()
	{
		ResetCurrent();
		return S_OK;
	}
Exemplo n.º 8
0
void
WaveComputer::Compute(const NMEAInfo &basic,
                      const FlyingState &flight,
                      WaveResult &result,
                      const WaveSettings &settings)
{
  const bool new_enabled = settings.enabled;
  if (new_enabled != last_enabled) {
    last_enabled = new_enabled;

    if (new_enabled) {
      /* the WaveComputer has just been enabled - initialise internal
         state */
      Initialise();
    } else
      /* the WaveComputer has just been disabled - clear the result */
      result.Clear();
  }

  if (!new_enabled) {
    /* we're disabled: bail out */
    assert(result.waves.empty());
    return;
  }

  if (!flight.IsGliding()) {
    /* no wave calculations while not in gliding free-flight */
    ResetCurrent();
    return;
  }

  const auto netto_vario_available = GetNettoVarioAvailable(basic);
  if (!basic.location_available.Modified(last_location_available) ||
      !netto_vario_available.Modified(last_netto_vario_available))
    /* no new data since the last call; need both a new GPS location
       and a vario value */
    return;

  const auto dt = delta_time.Update(basic.time, 0.5, 20);
  if (dt < 0)
    /* time warp */
    Reset();

  if (dt <= 0)
    /* throttle */
    return;

  const auto vario = basic.netto_vario;

  constexpr double threshold(0.5);
  if (vario > threshold) {
    /* positive vario value - feed it to the #LeastSquares instance */

    if (ls.IsEmpty())
      /* initialise the projection each time we inspect a new wave
         "candidate" */
      projection.SetCenter(basic.location);

    auto flat = projection.ProjectFloat(basic.location);
    ls.Update(flat.x, flat.y, vario - threshold / 2);
  }

  if (vario < 0)
    sinking_clock.Add(dt);
  else
    sinking_clock.Subtract(dt);

  const bool sinking = sinking_clock >= dt + 1;
  if (sinking) {
    /* we've been sinking; stop calculating the current wave; prepare
       to flush the #LeastSquares instance */
    if (ls.GetCount() > 30) {
      /* we've been lifting in the wave for some time; see if we
         really spotted a wave */
      const WaveInfo wave = GetWaveInfo(ls, projection,
                                        basic.time_available ? basic.time : 0);
      if (wave.IsDefined())
        /* yes, spotted a wave: copy it from the #LeastSquares
           instance to the list of waves */
        FoundWave(wave);
    }

    ls.Reset();
  }

  if (basic.time_available)
    /* forget all waves which are older than 8 hours */
    Decay(basic.time - 8 * 3600);

  /* fill the #WaveResult */

  result.Clear();

  /* first copy the wave that is currently being calculated (partial
     data) */
  WaveInfo wave = GetWaveInfo(ls, projection,
                              basic.time_available ? basic.time : 0);
  if (wave.IsDefined())
    result.waves.push_back(wave);

  /* now copy the rest */
  for (auto i = waves.begin(), end = waves.end();
       i != end && !result.waves.full(); ++i)
    result.waves.push_back(*i);

  /* remember some data for the next iteration */
  last_location_available = basic.location_available;
  last_netto_vario_available = netto_vario_available;
}