Example #1
0
bool JPEGInstance::QueryOptions( Array<ImageOptions>& imageOptions, Array<void*>& formatOptions )
{
   m_queriedOptions = true;

   /*
    * Format-independent options
    */
   ImageOptions options;
   if ( !imageOptions.IsEmpty() )
      options = *imageOptions;

   /*
    * Format-specific options
    */
   JPEGFormat::FormatOptions* jpeg = nullptr;

   if ( !formatOptions.IsEmpty() )
   {
      JPEGFormat::FormatOptions* o = JPEGFormat::FormatOptions::FromGenericDataBlock( *formatOptions );
      if ( o != nullptr )
         jpeg = o;
   }

   bool reusedFormatOptions = jpeg != nullptr;
   if ( !reusedFormatOptions )
      jpeg = new JPEGFormat::FormatOptions;

   /*
    * Override embedding options, if requested.
    */
   JPEGFormat::EmbeddingOverrides overrides = JPEGFormat::DefaultEmbeddingOverrides();

   if ( overrides.overrideICCProfileEmbedding )
      options.embedICCProfile = overrides.embedICCProfiles;

   JPEGOptionsDialog dlg( options, jpeg->options );

   if ( dlg.Execute() == StdDialogCode::Ok )
   {
      jpeg->options = dlg.jpegOptions;

      if ( imageOptions.IsEmpty() )
         imageOptions.Add( dlg.options );
      else
         *imageOptions = dlg.options;

      if ( formatOptions.IsEmpty() )
         formatOptions.Add( (void*)jpeg );
      else
         *formatOptions = (void*)jpeg;

      return true;
   }

   if ( !reusedFormatOptions )
      delete jpeg;

   return false;
}
Example #2
0
bool JPCInstance::QueryOptions( Array<ImageOptions>& imageOptions, Array<void*>& formatOptions )
{
   m_queriedOptions = true;

   // Format-independent options

   ImageOptions options;
   if ( !imageOptions.IsEmpty() )
      options = *imageOptions;

   // Format-specific options

   JPEG2000FormatOptions* jpc = nullptr;

   if ( !formatOptions.IsEmpty() )
   {
      JPEG2000FormatOptions* o = JPEG2000FormatOptions::FromGenericDataBlock( *formatOptions );
      if ( o != nullptr )
         jpc = o;
   }

   bool reusedFormatOptions = jpc != nullptr;
   if ( !reusedFormatOptions )
      jpc = new JPEG2000FormatOptions( IsCodeStream() );

   if ( !IsCodeStream() )
   {
      // Override embedding options, if requested.

      JP2Format::EmbeddingOverrides overrides = JP2Format::DefaultEmbeddingOverrides();

      if ( overrides.overrideICCProfileEmbedding )
         options.embedICCProfile = overrides.embedICCProfiles;
   }

   JPEG2000OptionsDialog dlg( options, m_jp2Options, IsCodeStream() );

   if ( dlg.Execute() == StdDialogCode::Ok )
   {
      jpc->options = dlg.jp2Options;

      if ( imageOptions.IsEmpty() )
         imageOptions.Add( dlg.options );
      else
         *imageOptions = dlg.options;

      if ( formatOptions.IsEmpty() )
         formatOptions.Add( (void*)jpc );
      else
         *formatOptions = (void*)jpc;

      return true;
   }

   if ( !reusedFormatOptions )
      delete jpc;

   return false;
}
Example #3
0
// Commit
//------------------------------------------------------------------------------
/*virtual*/ bool FunctionSettings::Commit( NodeGraph & /*nodeGraph*/, const BFFIterator & funcStartIter ) const
{
    // using a cache plugin?
    AStackString<> cachePluginDLL;
    if ( !GetString( funcStartIter, cachePluginDLL, ".CachePluginDLL" ) )
    {
        return false;
    }
    FBuild::Get().SetCachePluginDLL( cachePluginDLL );
    if ( !cachePluginDLL.IsEmpty() )
    {
        FLOG_INFO( "CachePluginDLL: '%s'", cachePluginDLL.Get() );
    }

    // try to get the cache path from the config
    const BFFVariable * cachePathVar;
    if ( !GetString( funcStartIter, cachePathVar, ".CachePath" ) )
    {
        return false;
    }
    if ( cachePathVar )
    {
        s_CachePath = cachePathVar->GetString();

        // override environment default only if not empty
        if ( s_CachePath.IsEmpty() == false )
        {
            FBuild::Get().SetCachePath( s_CachePath );
        }
    }

    // "Workers"
    Array< AString > workerList;
    if ( !GetStrings( funcStartIter, workerList, ".Workers" ) )
    {
        return false;
    }
    if ( !workerList.IsEmpty() )
    {
        FBuild::Get().SetWorkerList( workerList );
    }

    // "Environment"
    Array< AString > environment;
    if ( !GetStrings( funcStartIter, environment, ".Environment" ) )
    {
        return false;
    }
    if ( !environment.IsEmpty() )
    {
        ProcessEnvironment( environment );
    }

    return true;
}
Example #4
0
// PopulateString
//------------------------------------------------------------------------------
bool Function::PopulateString( const BFFIterator & iter, void * base, const ReflectedProperty & property, const BFFVariable * variable ) const
{
	Array< AString > strings;
	if ( !PopulateStringHelper( iter, property.HasMetaData< Meta_Path >(), property.HasMetaData< Meta_File >(), variable, strings ) )
	{
		return false; // PopulateStringHelper will have emitted an error
	}

	if ( variable->IsString() )
	{
		// Handle empty strings
		if ( strings.IsEmpty() || strings[0].IsEmpty() )
		{
			Error::Error_1004_EmptyStringPropertyNotAllowed( iter, this, variable->GetName().Get() );
			return false;
		}

		if ( strings.GetSize() != 1 )
		{
			Error::Error_1050_PropertyMustBeOfType( iter, this, variable->GetName().Get(), BFFVariable::VAR_ARRAY_OF_STRINGS, BFFVariable::VAR_STRING );
			return false;
		}

		// String to String
		property.SetProperty( base, strings[0] );
		return true;
	}

	Error::Error_1050_PropertyMustBeOfType( iter, this, variable->GetName().Get(), variable->GetType(), BFFVariable::VAR_STRING );
	return false;
}
Example #5
0
void Bot::AttachToUser (void)
{
	// SyPB Pro P.29 - small change
	if (GetGameMod () != 0)
		return;

	/*
	// SyPB Pro P.15
	if (!FNullEnt (m_moveTargetEntity))
		return;
		*/

   // this function forces bot to join to user
   Array <edict_t *> foundUsers;

   // search friends near us
   for (int i = 0; i < engine->GetMaxClients (); i++)
   {
      if (!(g_clients[i].flags & CFLAG_USED) || !(g_clients[i].flags & CFLAG_ALIVE) || g_clients[i].team != GetTeam (GetEntity ()) || g_clients[i].ent == GetEntity ())
         continue;

      if (EntityIsVisible (g_clients[i].origin) && !IsValidBot (g_clients[i].ent))
         foundUsers.Push (g_clients[i].ent);
   }

   if (foundUsers.IsEmpty ())
      return;

   m_targetEntity = foundUsers.GetRandomElement ();

   ChatterMessage (Chatter_LeadOnSir);
   PushTask (TASK_FOLLOWUSER, TASKPRI_FOLLOWUSER, -1, 0.0, true);
}
Example #6
0
bool FileSystemInfo::FolderExists(String path) const
{
	if(IsNull(path))
		return true;
	if(path.Find('*') >= 0 || path.Find('?') >= 0)
		return false;
	Array<FileInfo> fi = Find(path, 1);
	return !fi.IsEmpty() && fi[0].is_directory;
}
Example #7
0
// GetNameForNode
//------------------------------------------------------------------------------
bool Function::GetNameForNode( const BFFIterator & iter, const ReflectionInfo * ri, AString & name ) const
{
	// get object MetaData
	const Meta_Name * nameMD = ri->HasMetaData< Meta_Name >();
	ASSERT( nameMD ); // should not call this on types without this MetaData

	// Format "Name" as ".Name" - TODO:C Would be good to eliminate this string copy
	AStackString<> propertyName( "." );
	propertyName += nameMD->GetName();

	// Find the value for this property from the BFF
	const BFFVariable * variable = BFFStackFrame::GetVar( propertyName );
    if ( variable == nullptr )
    {
        Error::Error_1101_MissingProperty( iter, this, propertyName );
        return false;        
    }
	if ( variable->IsString() )
	{
		Array< AString > strings;
		if ( !PopulateStringHelper( iter, nullptr, ri->HasMetaData< Meta_File >(), variable, strings ) )
		{
			return false; // PopulateStringHelper will have emitted an error
		}

		// Handle empty strings
		if ( strings.IsEmpty() || strings[0].IsEmpty() )
		{
			Error::Error_1004_EmptyStringPropertyNotAllowed( iter, this, variable->GetName().Get() );
			return false;
		}

		if ( strings.GetSize() != 1 )
		{
			Error::Error_1050_PropertyMustBeOfType( iter, this, variable->GetName().Get(), BFFVariable::VAR_ARRAY_OF_STRINGS, BFFVariable::VAR_STRING );
			return false;
		}

		// Check that name isn't already used
		NodeGraph & ng = FBuild::Get().GetDependencyGraph();
		if ( ng.FindNode( strings[0] ) )
		{
			Error::Error_1100_AlreadyDefined( iter, this, strings[0] );
			return false;
		}

		name = strings[0];
		return true;
	}

	Error::Error_1050_PropertyMustBeOfType( iter, this, variable->GetName().Get(), variable->GetType(), BFFVariable::VAR_STRING );
	return false;
}
Example #8
0
Rect Ctrl::GetWorkArea() const
{
	GuiLock __;
	static Array<Rect> rc;
	if(rc.IsEmpty()) 
		GetWorkArea(rc);
	
	Point pt = GetScreenRect().TopLeft();
	for (int i = 0; i < rc.GetCount(); i++)
		if(rc[i].Contains(pt))
			return rc[i];
	return GetPrimaryWorkArea();
}
Example #9
0
// VSProjectConfig::Load
//------------------------------------------------------------------------------
/*static*/ bool VSProjectConfig::Load( NodeGraph & nodeGraph, IOStream & stream, Array< VSProjectConfig > & configs )
{
    ASSERT( configs.IsEmpty() );

    uint32_t numConfigs( 0 );
    if ( !stream.Read( numConfigs ) )
    {
        return false;
    }
    configs.SetSize( numConfigs );
    for ( uint32_t i=0; i<numConfigs; ++i )
    {
        VSProjectConfig & cfg = configs[ i ];

        if ( stream.Read( cfg.m_SolutionPlatform ) == false ) { return false; }
        if ( stream.Read( cfg.m_SolutionConfig ) == false ) { return false;  }

        if ( stream.Read( cfg.m_Platform ) == false ) { return false; }
        if ( stream.Read( cfg.m_Config ) == false ) { return false; }

        if ( !Node::LoadNode( nodeGraph, stream, cfg.m_Target ) ) { return false; }

        if ( stream.Read( cfg.m_BuildCommand ) == false ) { return false; }
        if ( stream.Read( cfg.m_RebuildCommand ) == false ) { return false; }
        if ( stream.Read( cfg.m_CleanCommand ) == false ) { return false; }

        if ( stream.Read( cfg.m_Output ) == false ) { return false; }
        if ( stream.Read( cfg.m_PreprocessorDefinitions ) == false ) { return false; }
        if ( stream.Read( cfg.m_IncludeSearchPath ) == false ) { return false; }
        if ( stream.Read( cfg.m_ForcedIncludes ) == false ) { return false; }
        if ( stream.Read( cfg.m_AssemblySearchPath ) == false ) { return false; }
        if ( stream.Read( cfg.m_ForcedUsingAssemblies ) == false ) { return false; }
        if ( stream.Read( cfg.m_AdditionalOptions ) == false ) { return false; }
        if ( stream.Read( cfg.m_OutputDirectory ) == false ) { return false; }
        if ( stream.Read( cfg.m_IntermediateDirectory ) == false ) { return false; }
        if ( stream.Read( cfg.m_LayoutDir ) == false ) { return false; }
        if ( stream.Read( cfg.m_LayoutExtensionFilter ) == false ) { return false; }
        if ( stream.Read( cfg.m_Xbox360DebuggerCommand ) == false ) { return false; }
        if ( stream.Read( cfg.m_DebuggerFlavor ) == false ) { return false; }
        if ( stream.Read( cfg.m_AumidOverride ) == false ) { return false; }
        if ( stream.Read( cfg.m_PlatformToolset ) == false ) { return false; }
        if ( stream.Read( cfg.m_DeploymentType ) == false ) { return false; }
        if ( stream.Read( cfg.m_DeploymentFiles ) == false ) { return false; }

        if ( stream.Read( cfg.m_LocalDebuggerCommandArguments ) == false ) { return false; }
        if ( stream.Read( cfg.m_LocalDebuggerWorkingDirectory ) == false ) { return false; }
        if ( stream.Read( cfg.m_LocalDebuggerCommand ) == false ) { return false; }
        if ( stream.Read( cfg.m_LocalDebuggerEnvironment ) == false ) { return false; }
    }
    return true;
}
Example #10
0
Bot *BotControl::FindOneValidAliveBot (void)
{
   // this function finds one bot, alive bot :)

   Array <int> foundBots;

   for (int i = 0; i < engine->GetMaxClients (); i++)
   {
      if (m_bots[i] != null && IsAlive (m_bots[i]->GetEntity ()))
         foundBots.Push (i);
   }

   if (!foundBots.IsEmpty ())
      return m_bots[foundBots.GetRandomElement ()];

   return null;
}
Example #11
0
// FormatName
//------------------------------------------------------------------------------
/*static*/ void DirectoryListNode::FormatName( const AString & path,
											   const Array< AString > * patterns,
											   bool recursive,
											   const Array< AString > & excludePaths,
                                               const Array< AString > & excludeFiles,
											   AString & result )
{
	ASSERT( path.EndsWith( NATIVE_SLASH ) );
	AStackString<> patternString;
	if ( patterns )
	{
		const size_t numPatterns = patterns->GetSize();
		for ( size_t i=0; i<numPatterns; ++i )
		{
			if ( i > 0 )
			{
				patternString += '<';
			}
			patternString += (*patterns)[ i ];
		}
	}
	result.Format( "%s|%s|%s|", path.Get(),
								  patternString.Get(),
								  recursive ? "true" : "false" );

	const AString * const end = excludePaths.End();
	for ( const AString * it = excludePaths.Begin(); it!=end; ++it )
	{
		const AString & excludePath = *it;
		ASSERT( excludePath.EndsWith( NATIVE_SLASH ) );
		result += excludePath;
		result += '<';
	}

    if ( !excludeFiles.IsEmpty() )
    {
        result += '|';
        const AString * const endFiles = excludeFiles.End();
        for ( const AString * itFiles = excludeFiles.Begin(); itFiles != endFiles; ++itFiles )
        {
            const AString & excludedFile = *itFiles;
            result += excludedFile;
            result += '<';
        }
    }
}
Example #12
0
// Load (SLNDependency)
//------------------------------------------------------------------------------
/*static*/ bool SLNDependency::Load( IOStream & stream, Array< SLNDependency > & slnDeps )
{
    ASSERT( slnDeps.IsEmpty() );

    uint32_t num( 0 );
    if ( !stream.Read( num ) )
    {
        return false;
    }
    slnDeps.SetSize( num );
	for ( SLNDependency & deps : slnDeps )
    {
        if ( stream.Read( deps.m_Projects ) == false ) { return false; }
        if ( stream.Read( deps.m_Dependencies ) == false ) { return false; }
    }
    return true;
}
Example #13
0
	int ColorTableLookup(unsigned int ColorArgb)
	{
		if (m_ColorTable.IsEmpty())
		{
			CONSOLE_SCREEN_BUFFER_INFOEX ConsoleInfo;
			ConsoleInfo.cbSize = sizeof(CONSOLE_SCREEN_BUFFER_INFOEX);
			GetConsoleScreenBufferInfoEx(m_ConsoleHandle, &ConsoleInfo);

			for (int i = 0; i < 16; i++)
			{
				m_ColorTable.Add(Color::FromAbgr(ConsoleInfo.ColorTable[i]));
			}
		}

		Color TargetColor(ColorArgb);
		return TargetColor.FindClosestPaletteIndex(m_ColorTable);
	}
Example #14
0
// VSProjectFileType::Load
//------------------------------------------------------------------------------
/*static*/ bool VSProjectFileType::Load( IOStream & stream, Array< VSProjectFileType > & fileTypes )
{
    ASSERT( fileTypes.IsEmpty() );

    uint32_t numFileTypes( 0 );
    if ( !stream.Read( numFileTypes ) )
    {
        return false;
    }
    fileTypes.SetSize( numFileTypes );
    for ( uint32_t i=0; i<numFileTypes; ++i )
    {
        VSProjectFileType & ft = fileTypes[ i ];

        if ( stream.Read( ft.m_FileType ) == false ) { return false; }
        if ( stream.Read( ft.m_Pattern ) == false ) { return false; }
    }
    return true;
}
Example #15
0
// SLNSolutionFolder::Load
//------------------------------------------------------------------------------
/*static*/ bool SLNSolutionFolder::Load( IOStream & stream, Array< SLNSolutionFolder > & solutionFolders )
{
    ASSERT( solutionFolders.IsEmpty() );

    uint32_t numSolutionFolders( 0 );
    if ( !stream.Read( numSolutionFolders ) )
    {
        return false;
    }
    solutionFolders.SetSize( numSolutionFolders );
    for ( uint32_t i=0; i<numSolutionFolders; ++i )
    {
        SLNSolutionFolder & sln = solutionFolders[ i ];

        if ( stream.Read( sln.m_Path ) == false ) { return false; }
        if ( stream.Read( sln.m_ProjectNames ) == false ) { return false; }
    }
    return true;
}
Example #16
0
// GetInputs
//------------------------------------------------------------------------------
bool FunctionObjectList::GetInputs( const BFFIterator & iter, Dependencies & inputs ) const
{
	NodeGraph & ng = FBuild::Get().GetDependencyGraph();

	// do we want to build files via a unity blob?
    Array< AString > inputUnities;
    if ( !GetStrings( iter, inputUnities, ".CompilerInputUnity", false ) ) // not required
	{
		return false;
	}
    for ( const auto& unity : inputUnities )
    {
        Node * n = ng.FindNode( unity );
		if ( n == nullptr )
		{
			Error::Error_1104_TargetNotDefined( iter, this, "CompilerInputUnity", unity );
			return false;
		}
		if ( n->GetType() != Node::UNITY_NODE )
		{
			Error::Error_1102_UnexpectedType( iter, this, "CompilerInputUnity", unity, n->GetType(), Node::UNITY_NODE );
			return false;
		}
		inputs.Append( Dependency( n ) );
    }

	// do we want to build a files in a directory?
	const BFFVariable * inputPath = BFFStackFrame::GetVar( ".CompilerInputPath" );
	if ( inputPath )
	{
		// get the optional pattern and recurse options related to InputPath
		Array< AString > patterns;
		if ( !GetStrings( iter, patterns, ".CompilerInputPattern", false ) )
		{
			return false; // GetString will have emitted an error
		}
		if ( patterns.IsEmpty() )
		{
			patterns.Append( AStackString<>( "*.cpp" ) );
		}

		// recursive?  default to true
		bool recurse = true;
		if ( !GetBool( iter, recurse, ".CompilerInputPathRecurse", true, false ) )
		{
			return false; // GetBool will have emitted an error
		}

		// Support an exclusion path
		Array< AString > excludePaths;
		if ( !GetFolderPaths( iter, excludePaths, ".CompilerInputExcludePath", false ) )
		{
			return false; // GetFolderPaths will have emitted an error
		}

        Array< AString > filesToExclude;
        if ( !GetStrings( iter, filesToExclude, ".CompilerInputExcludedFiles", false ) ) // not required
        {
            return false; // GetStrings will have emitted an error
        }
	    CleanFileNames( filesToExclude );

		// Input paths
		Array< AString > inputPaths;
		if ( !GetFolderPaths( iter, inputPaths, ".CompilerInputPath", false ) )
		{
			return false; // GetFolderPaths will have emitted an error
		}

		Dependencies dirNodes( inputPaths.GetSize() );
		if ( !GetDirectoryListNodeList( iter, inputPaths, excludePaths, filesToExclude, recurse, &patterns, "CompilerInputPath", dirNodes ) )
		{
			return false; // GetDirectoryListNodeList will have emitted an error
		}
		inputs.Append( dirNodes );
	}

	// do we want to build a specific list of files?
	if ( !GetNodeList( iter, ".CompilerInputFiles", inputs, false ) )
	{
		// helper will emit error
		return false;
	}

	return true;
}
Example #17
0
//------------------------------------------------------------------------------------------------------------------------------------------------------
VOID StatusBar::SetParts( Array<INT> PartSizes )
{
  if (!PartSizes.IsEmpty())
    SendMessage( SB_SETPARTS, PartSizes.Length(), (LPARAM)&PartSizes[0] );
}
#define CATCH_CONFIG_MAIN
#include "../../libs/catch.h"
#include "../../Templates.h"
using namespace Templates;


int array[] = {1, 3, 5, 7, 9};

TEST_CASE("Should create empty Array", "[Array][Creation]") {
    Array<int> instance;
    REQUIRE(instance.Capacity() > 0);
    REQUIRE(instance.IsEmpty());
}

TEST_CASE("Should create Array with capacity", "[Array][Creation]"){
    Array<int> instance(4);
    REQUIRE(instance.Capacity() == 4);
    REQUIRE(instance.IsEmpty());
}

TEST_CASE("Should create Array with more capacity", "[Array][Creation]"){
    Array<int> instance(25);
    REQUIRE(instance.Capacity() == 25);
}

TEST_CASE("Should create Array with negative capacity", "[Array][Creation]"){
    Array<int> instance(-5);
    REQUIRE(instance.Capacity() > 0);
}

TEST_CASE("Should create Array with default capacity if zero capacity passed", "[Array][Creation]"){
// Commit
//------------------------------------------------------------------------------
/*virtual*/ bool FunctionCSAssembly::Commit( NodeGraph & nodeGraph, const BFFIterator & funcStartIter ) const
{
	// make sure all required variables are defined
	const BFFVariable * compiler;
	const BFFVariable * compilerOptions;
	const BFFVariable * compilerOutput;
	if ( !GetString( funcStartIter, compiler, ".Compiler", true ) ||
		 !GetString( funcStartIter, compilerOptions, ".CompilerOptions", true ) ||
		 !GetString( funcStartIter, compilerOutput, ".CompilerOutput", true ) )
	{
		return false;
	}

	Dependencies staticDeps( 32, true );

	// do we want to build a files in a directory?
	const BFFVariable * inputPath = BFFStackFrame::GetVar( ".CompilerInputPath" );
	if ( inputPath )
	{
		// get the optional pattern and recurse options related to InputPath
		Array< AString > patterns;
		if ( !GetStrings( funcStartIter, patterns, ".CompilerInputPattern", false ) )
		{
			return false; // GetString will have emitted an error
		}
		if ( patterns.IsEmpty() )
		{
			patterns.Append( AStackString<>( "*.cs" ) );
		}

		// recursive?  default to true
		bool recurse = true;
		if ( !GetBool( funcStartIter, recurse, ".CompilerInputPathRecurse", true, false ) )
		{
			return false; // GetBool will have emitted an error
		}

		// Support an exclusion path
		Array< AString > excludePaths;
		if ( !GetFolderPaths( funcStartIter, excludePaths, ".CompilerInputExcludePath", false ) )
		{
			return false; // GetFolderPaths will have emitted an error
		}

        Array< AString > filesToExclude(0, true);
        if ( !GetStrings( funcStartIter, filesToExclude, ".CompilerInputExcludedFiles", false ) ) // not required
        {
            return false; // GetStrings will have emitted an error
        }
	    CleanFileNames( filesToExclude );

		// Input paths
		Array< AString > inputPaths;
		if ( !GetFolderPaths( funcStartIter, inputPaths, ".CompilerInputPath", false ) )
		{
			return false; // GetFolderPaths will have emitted an error
		}

		Dependencies dirNodes( inputPaths.GetSize() );
		if ( !GetDirectoryListNodeList( nodeGraph, funcStartIter, inputPaths, excludePaths, filesToExclude, recurse, &patterns, "CompilerInputPath", dirNodes ) )
		{
			return false; // GetDirectoryListNodeList will have emitted an error
		}
		staticDeps.Append( dirNodes );
	}

	// do we want to build a specific list of files?
	if ( !GetNodeList( nodeGraph, funcStartIter, ".CompilerInputFiles", staticDeps, false ) )
	{
		// helper will emit error
		return false;
	}

	if ( staticDeps.IsEmpty() )
	{
		Error::Error_1006_NothingToBuild( funcStartIter, this );
		return false;
	}

	// additional references?
	Dependencies extraRefs( 0, true );
	if ( !GetNodeList( nodeGraph, funcStartIter, ".CompilerReferences", extraRefs, false ) )
	{
		// helper function will have emitted an error
		return false;
	}

    // Pre-build dependencies
	Dependencies preBuildDependencies;
	if ( !GetNodeList( nodeGraph, funcStartIter, ".PreBuildDependencies", preBuildDependencies, false ) )
	{
		return false; // GetNodeList will have emitted an error
	}

	// Create library node which depends on the single file or list
	if ( nodeGraph.FindNode( compilerOutput->GetString() ) )
	{
		Error::Error_1100_AlreadyDefined( funcStartIter, this, compilerOutput->GetString() );
		return false;
	}
	Node * csNode = nodeGraph.CreateCSNode( compilerOutput->GetString(),
									 staticDeps,
									 compiler->GetString(),
									 compilerOptions->GetString(),
									 extraRefs,
									 preBuildDependencies );

	// should we create an alias?
	return ProcessAlias( nodeGraph, funcStartIter, csNode );
}
Example #20
0
	virtual bool   IsEmpty() const                   { return key.IsEmpty(); }
Example #21
0
void DecalTrace (entvars_t *pev, TraceResult *trace, int logotypeIndex)
{
   // this function draw spraypaint depending on the tracing results.

   static Array <String> logotypes;

   if (logotypes.IsEmpty ())
   {
      logotypes = String ("{biohaz;{graf004;{graf005;{lambda06;{target;{hand1").Split (";");
   }

   int entityIndex = -1, message = TE_DECAL;
   int decalIndex = (*g_engfuncs.pfnDecalIndex) (logotypes[logotypeIndex]);

   if (decalIndex < 0)
      decalIndex = (*g_engfuncs.pfnDecalIndex) ("{lambda06");

   if (trace->flFraction == 1.0f)
      return;

   if (!FNullEnt (trace->pHit))
   {
      if (trace->pHit->v.solid == SOLID_BSP || trace->pHit->v.movetype == MOVETYPE_PUSHSTEP)
         entityIndex = ENTINDEX (trace->pHit);
      else
         return;
   }
   else
      entityIndex = 0;

   if (entityIndex != 0)
   {
      if (decalIndex > 255)
      {
         message = TE_DECALHIGH;
         decalIndex -= 256;
      }
   }
   else
   {
      message = TE_WORLDDECAL;

      if (decalIndex > 255)
      {
         message = TE_WORLDDECALHIGH;
         decalIndex -= 256;
      }
   }

   if (logotypes[logotypeIndex].Has ("{"))
   {
      MESSAGE_BEGIN (MSG_BROADCAST, SVC_TEMPENTITY);
         WRITE_BYTE (TE_PLAYERDECAL);
         WRITE_BYTE (ENTINDEX (ENT (pev)));
         WRITE_COORD (trace->vecEndPos.x);
         WRITE_COORD (trace->vecEndPos.y);
         WRITE_COORD (trace->vecEndPos.z);
         WRITE_SHORT (static_cast <short> (ENTINDEX (trace->pHit)));
         WRITE_BYTE (decalIndex);
      MESSAGE_END ();
   }
   else
   {
      MESSAGE_BEGIN (MSG_BROADCAST, SVC_TEMPENTITY);
         WRITE_BYTE (message);
         WRITE_COORD (trace->vecEndPos.x);
         WRITE_COORD (trace->vecEndPos.y);
         WRITE_COORD (trace->vecEndPos.z);
         WRITE_BYTE (decalIndex);

      if (entityIndex)
         WRITE_SHORT (entityIndex);

      MESSAGE_END();
   }
}
// Commit
//------------------------------------------------------------------------------
/*virtual*/ bool FunctionCopyDir::Commit( const BFFIterator & funcStartIter ) const
{
	// Get input paths
	Array< AString > inputPaths;
	if ( !GetFolderPaths( funcStartIter, inputPaths, ".SourcePaths", true ) )
	{
		return false; // GetFolderPaths will have emitted an error
	}

	// get the optional params
	Array< AString > patterns;
	bool recurse = true;
	Array< AString > excludePaths;
	if ( !GetStrings( funcStartIter, patterns, ".SourcePathsPattern" ) ||
		 !GetBool( funcStartIter, recurse, ".SourcePathsRecurse", true ) || // recursive by default
		 !GetStrings( funcStartIter, excludePaths, ".SourceExcludePaths" ) )
	{
		return false; // Get* will have emitted error
	}

	// convert input paths to DirectoryListNodes
	Dependencies staticDeps( inputPaths.GetSize() );
	if ( !GetDirectoryListNodeList( funcStartIter, inputPaths, excludePaths, Array< AString >(), recurse, patterns.IsEmpty() ? nullptr : &patterns, ".SourcePaths", staticDeps ) )
	{
		return false; // GetDirectoryListNodeList will have emitted an error
	}

	// Get output path
	AStackString<> destPath;
	if ( !GetString( funcStartIter, destPath, ".Dest", true ) )
	{
		return false;
	}
	PathUtils::FixupFolderPath( destPath );

	// Pre-build dependencies
	Dependencies preBuildDeps;
	if ( !GetNodeList( funcStartIter, ".PreBuildDependencies", preBuildDeps, false ) )
	{
		return false; // GetNodeList will have emitted an error
	}

	// sanity check we defined something useful
	if ( staticDeps.IsEmpty() )
	{
		Error::Error_1006_NothingToBuild( funcStartIter, this );
		return false;
	}

	// check node doesn't already exist
	NodeGraph & ng = FBuild::Get().GetDependencyGraph();	
	if ( ng.FindNode( m_AliasForFunction ) )
	{
		Error::Error_1100_AlreadyDefined( funcStartIter, this, m_AliasForFunction );
		return false;
	}

	// create our node
	ng.CreateCopyDirNode( m_AliasForFunction, staticDeps, destPath, preBuildDeps );
	return true;
}