void GridNavigationComponent::Update(float a_dt)
{
  GameobjectComponent::Update(a_dt);

  if (m_wander)
  {
    if (!m_activePath)
    {
      GridObject* grid = m_pathfinder->GetGridObject();
      if (grid)
        RequestPath(grid->GetRandomPositionOnGrid());
    }
  }

  TraversePath(a_dt);
  DrawDebug();
}
Beispiel #2
0
ManSearchPath::ManSearchPath
	(
	CDEEnvironment * user,
	const char *     envvar,
	const char *     sep
	) : SearchPath(user, envvar, sep)
{
    if (user->DTMANPATH())
	search_path = user->FactoryManPath() + "," + *user->DTMANPATH();
    else
	search_path = user->FactoryManPath();

    // add OS manpath now so duplicate path elements can be removed by Normalize
    // Normalize should recognize both ':' and ',' as separators.

    if (!user->OS()->MANPATH().isNull())
        search_path += ":" + user->OS()->MANPATH();

    NormalizePath();
    TraversePath();
}
Beispiel #3
0
/**********************************************************************
 *
 * InfoLibSearchPath
 *
 *	this constructor creates DTINFOLIBSEARCHPATH in a three-step 
 *	process.
 *
 *	1. gathers environment variables and defaults to create a 
 *	   colon-separated list of paths
 *	2. normalizes the list into host:/path format
 *	3. builds the final version of the path
 *
 *	Hierarchy of search paths:
 *		DTSPUSERINFOLIB
 *		DTSPUSERAPPHOSTS
 *		System Administrator's configuration directory
 *		DTSPSYSINFOLIB
 *		DTSPSYSAPPHOSTS
 *		Factory location
 *
 **********************************************************************/
InfoLibSearchPath::InfoLibSearchPath
	(
	CDEEnvironment * user,
	const char *     envvar,
	const char *     sep
	) : SearchPath(user, envvar, sep)
{
    CString oldSysAdmConfig = user->sysAdmConfig;
    CString oldFactoryInstall = user->factoryInstall;

    // Need to re-initialize the defaults.
    user->sysAdmConfig   = "/etc/dt";
    user->factoryInstall = "/usr/dt";

    if (user->DTINFOLIBSP()) {
	if (user->DTUSERINFOLIBSP()) {
	    search_path = *user->DTUSERINFOLIBSP() + ",";
	    if (user->DTUSERAPPSP())
		search_path += *user->DTUSERAPPSP() + ",";
	    if (!user->DTINFOLIBSP()->contains(user->OS()->LocalHost(),",",":") &&
		(!user->DTAPPSP() ||
		 !user->DTAPPSP()->contains(user->OS()->LocalHost(),",",":")))
		search_path += user->SysAdmConfig() + ",";
	    search_path += *user->DTINFOLIBSP() + ",";
	    if (user->DTINFOLIBSP()->contains(user->OS()->LocalHost(),",",":") &&
		user->DTAPPSP() &&
		user->DTAPPSP()->contains(user->SysAdmConfig(),",",","))
		search_path.replace(user->OS()->LocalHost() + ":,","");
	    if (user->DTAPPSP())
		search_path += *user->DTAPPSP() + ",";
	    search_path += user->FactoryInstall();
	}
        else {
	    if (user->DTUSERAPPSP())
		search_path = *user->DTUSERAPPSP() + ",";
	    if (!user->DTINFOLIBSP()->contains(user->OS()->LocalHost(),",",":") &&
		(!user->DTAPPSP() ||
		 !user->DTAPPSP()->contains(user->OS()->LocalHost(),",",":")))
		search_path += user->SysAdmConfig() + ",";
	    search_path += *user->DTINFOLIBSP() + ",";
	    if (user->DTINFOLIBSP()->contains(user->OS()->LocalHost(),",",":") &&
		user->DTAPPSP() &&
		user->DTAPPSP()->contains(user->SysAdmConfig(),",",","))
		search_path.replace(user->OS()->LocalHost() + ":,","");
	    if (user->DTAPPSP())
		search_path += *user->DTAPPSP() + ",";
	    search_path += user->FactoryInstall();
	}
    }
    else if (user->DTUSERINFOLIBSP()) {
	search_path = *user->DTUSERINFOLIBSP() + ",";

	if (user->DTUSERAPPSP())
	    search_path += *user->DTUSERAPPSP() + ",";

	search_path += user->SysAdmConfig() + ",";
	if (user->DTAPPSP())
	    search_path += *user->DTAPPSP() + ",";
	search_path += user->FactoryInstall();
    }
    else {
	if (user->DTUSERAPPSP())
	    search_path = *user->DTUSERAPPSP() + ",";

	search_path += user->SysAdmConfig() + ",";
	if (user->DTAPPSP())
	    search_path += *user->DTAPPSP() + ",";
	search_path += user->FactoryInstall();
    }

    if (options->CheckingUser())
    {
	if (user->DTAPPSP())
	    search_path = *user->DTAPPSP();
    }

    NormalizePath();
    TraversePath();

    user->sysAdmConfig = oldSysAdmConfig;
    user->factoryInstall = oldFactoryInstall;
}