示例#1
0
void PacketPump::AddQueue( const short queueID )
{
	if ( m_SendQueues.find( queueID ) == m_SendQueues.end( ) )
		m_SendQueues.emplace( std::pair<short, LocklessQueue<const Message*>*>( queueID, pNew( LocklessQueue<const Message*> ) ) );
	else
		Logger::Log( "Attempted to add already existing SendQueue", "PacketPump", LogSeverity::WARNING_MSG );
}
示例#2
0
	Button* GUIEngine::AddButton( const rString& name, Rectangle boundingBox, const rString& parent )
	{
		Button* btn = pNew( Button, name, parent, boundingBox );
		btn->GetTextDefinitionRef().FontID = m_CurrentFontID;
		AddChild( name, btn, parent );
		return btn;
	}
示例#3
0
	TextBox* GUIEngine::AddTextBox( const rString& name, Rectangle boundingBox, const rString& parent )
	{
		TextBox* txtBox = pNew( TextBox, name, parent, boundingBox );
		txtBox->GetTextDefinitionRef().FontID = m_CurrentFontID;
		AddChild( name, txtBox, parent );
		return txtBox;
	}
示例#4
0
    intrusive_ptr<Document> Document::clone() {
        const size_t n = vFieldName.size();
	intrusive_ptr<Document> pNew(Document::create(n));
        for(size_t i = 0; i < n; ++i)
            pNew->addField(vFieldName[i], vpValue[i]);

        return pNew;
    }
示例#5
0
 //! The method returns pool instance
 static stream_compound_pool& get()
 {
     tls_ptr_type& ptr = base_type::get();
     this_type* p = ptr.get();
     if (!p)
     {
         log::aux::unique_ptr< this_type > pNew(new this_type());
         ptr.reset(pNew.get());
         p = pNew.release();
     }
     return *p;
 }
示例#6
0
 //! The method returns pool instance
 static stream_compound_pool& get()
 {
     tls_ptr_type& ptr = base_type::get();
     register this_type* p = ptr.get();
     if (!p)
     {
         std::auto_ptr< this_type > pNew(new this_type());
         ptr.reset(pNew.get());
         p = pNew.release();
     }
     return *p;
 }
示例#7
0
void PolygonLine :: computeIntersectionPoints(Element *element, std :: vector< FloatArray > &oIntersectionPoints)
{
    printf("Warning: entering  PolygonLine :: computeIntersectionPoints(Element *element, std::vector< FloatArray > &oIntersectionPoints).\n");
#ifdef __BOOST_MODULE

    if ( !boundingBoxIntersects(element) ) {
        return;
    }


    for ( int i = 1; i <= element->giveNumberOfBoundarySides(); i++ ) {
        std :: vector< FloatArray >oneLineIntersects;
        ///@todo Move semantics or something would be useful here to avoid multiple copies.
        FloatArray a = * element->giveDofManager ( i )->giveCoordinates();
        FloatArray b;
        if ( i != element->giveNumberOfBoundarySides() ) {
            b = * element->giveDofManager ( i + 1 )->giveCoordinates();
        } else {
            b = * element->giveDofManager ( 1 )->giveCoordinates();
        }

        Line l(a, b);

        computeIntersectionPoints(& l, oneLineIntersects);
        for ( FloatArray &interSect: oneLineIntersects ) {
            // Check that the intersection point has not already been identified.
            // This may happen if the crack intersects the element exactly at a node,
            // so that intersection is detected for both element edges in that node.

            // TODO: Set tolerance in a more transparent way.
            double distTol = 1.0e-9;

            bool alreadyFound = false;

            bPoint2 pNew( interSect.at(1), interSect.at(2) );

            for ( FloatArray &pInterSect: oIntersectionPoints ) {
                bPoint2 pOld( pInterSect.at(1), pInterSect.at(2) );

                if ( bDist(pOld, pNew) < distTol ) {
                    alreadyFound = true;
                    break;
                }
            }

            if ( !alreadyFound ) {
                oIntersectionPoints.push_back(interSect);
            }
        }
    }
#endif
}
示例#8
0
	void GUIEngine::InitializeRoot(int windowWidth, int windowHeight)
	{
		if( !m_RootWindow )
		{
			m_RootWindow = pNew( Window, "RootWindow", "", Rectangle( 0, 0, windowWidth, windowHeight ) );
			m_Windows.emplace( "RootWindow", m_RootWindow );
			m_RootWindow->Open();
		}
		else
		{
			m_RootWindow->SetSize( windowWidth, windowHeight );
		}
	}
示例#9
0
	void GUIEngine::Initialize( int windowWidth, int windowHeight )
	{
		g_Graphics2D.Initialize();

		m_RootWindow = pNew( Window, "RootWindow", "", Rectangle( 0, 0, windowWidth, windowHeight ) );
		m_Windows.emplace( "RootWindow", m_RootWindow );
		m_RootWindow->Open();
		//InitializeRoot( windowWidth, windowHeight );

		m_ScriptFunctions.RegisterFunctions();
		
		m_CurrentFontID = FONT_ID_DEFAULT_12;
	}
示例#10
0
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
    if (nrhs != 4)
    {
        mexPrintf("Usage: alpha = LineSearch(prevScores, newScores, labels, lossType)\n");
        mexErrMsgTxt("Incorrect input format\n");
    }

#define mPrevScores (prhs[0])
#define mNewScores (prhs[1])
#define mLabels (prhs[2])
#define mLossType (prhs[3])

    if (nlhs != 1)
        mexErrMsgTxt("One output arg expected");

    char lossName[40];
    if ( mxGetString(mLossType, lossName, sizeof(lossName)) != 0 )
        mexErrMsgTxt("Error reading options.loss");

    SQB::LossType sqbLoss = SQB::ExpLoss;

    if (strcmp(lossName, "exploss") == 0)
        sqbLoss = SQB::ExpLoss;
    else if ( strcmp(lossName, "logloss") == 0 )
        sqbLoss = SQB::LogLoss;
    else if ( strcmp(lossName, "squaredloss") == 0 )
        sqbLoss = SQB::SquaredLoss;
    else
        mexErrMsgTxt("options.loss contains an invalid value");


    MatlabInputMatrix<WeightsType> pPrev( mPrevScores, 0, 1, "prevScores" );
    MatlabInputMatrix<WeightsType> pNew( mNewScores, pPrev.rows(), 1, "newScores" );
    MatlabInputMatrix<WeightsType> pLabels( mLabels, pPrev.rows(), 1, "labels" );

    // create mappings
    ArrayMapType prevMap( pPrev.data(), pPrev.rows(), pPrev.cols() );
    ArrayMapType newMap( pNew.data(), pNew.rows(), pNew.cols() );
    ArrayMapType labelsMap( pLabels.data(), pLabels.rows(), pLabels.cols() );



    SQB::LineSearch< ArrayType, ArrayMapType >  LS( prevMap, newMap, labelsMap, sqbLoss );

    WeightsType alpha = LS.run();

    MatlabOutputMatrix<WeightsType>   outMatrix( &plhs[0], 1, 1 );
    outMatrix.data()[0] = alpha;
}
示例#11
0
void SSWindow::Startup( SubsystemCollection* const ) {
	m_Window = pNew( gfx::Window );
	gfx::WindowSettings ws;
	ws.Title = m_WindowTitle;
	ws.OpenGL = true;
	ws.Width = 1600;
	ws.Height = 900;
	ws.Vsync = true;
	m_Window->Initialize( ws );

	glewExperimental = GL_TRUE;
	glewInit();
	g_ResourceManager.StartWorkerThread(m_Window->GetWindow(), m_Window->GetContext());
	g_ModelBank.Init();
}
示例#12
0
/**
 * Creates a content node and appends it to the list of children
 * in "this".
 *
 * @param pcszContent
 * @return
 */
ContentNode* ElementNode::addContent(const char *pcszContent)
{
    // libxml side: create new node
    xmlNode *plibNode;
    if (!(plibNode = xmlNewText((const xmlChar*)pcszContent)))
        throw std::bad_alloc();
    xmlAddChild(m_plibNode, plibNode);

    // now wrap this in C++
    ContentNode *p = new ContentNode(this, plibNode);
    boost::shared_ptr<ContentNode> pNew(p);
    m->children.push_back(pNew);

    return p;
}
示例#13
0
core::Error createHunspell(const FilePath& affPath,
                           const FilePath& dicPath,
                           boost::shared_ptr<SpellChecker>* pHunspell)
{
   // create the hunspell engine
   boost::shared_ptr<HunspellSpellChecker> pNew(new HunspellSpellChecker());

   // initialize it
   Error error = pNew->initialize(affPath, dicPath);
   if (error)
      return error;

   // return
   *pHunspell = boost::shared_static_cast<SpellChecker>(pNew);
   return Success();
}
示例#14
0
PDevice::PDevice(PContext* context)
    : m_context(context)
{
    m_state = P_DEVICE_STATE_UNINITIALIZED;
    m_inputEventQueue = P_NULL;

    for (pUint32 i = 0; i < P_KEY_COUNT; ++i)
    {
        m_keyStates[i] = P_KEY_DEVICE_STATE_UP;
    }
    
    m_state = P_DEVICE_STATE_ACTIVE;

    m_orientation = P_DEVICE_ORIENTATION_LANDSCAPE;
    m_orientationAngle = P_DEVICE_ORIENTATION_ANGLE_0;

    m_inputEventQueue = pNew(PInputEventQueue(this));
}
示例#15
0
/**
 * Creates a new child element node and appends it to the list
 * of children in "this".
 *
 * @param pcszElementName
 * @return
 */
ElementNode* ElementNode::createChild(const char *pcszElementName)
{
    // we must be an element, not an attribute
    if (!m_plibNode)
        throw ENodeIsNotElement(RT_SRC_POS);

    // libxml side: create new node
    xmlNode *plibNode;
    if (!(plibNode = xmlNewNode(NULL,        // namespace
                                (const xmlChar*)pcszElementName)))
        throw std::bad_alloc();
    xmlAddChild(m_plibNode, plibNode);

    // now wrap this in C++
    ElementNode *p = new ElementNode(m_pelmRoot, this, plibNode);
    boost::shared_ptr<ElementNode> pNew(p);
    m->children.push_back(pNew);

    return p;
}
示例#16
0
文件: pmain.cpp 项目: suyu0925/backup
/*
void setupScene(PContext* context)
{
    PScene* scene = context->getScene();
    PLayer* layer = pNew(PLayer(scene));

    // sprint 1 mesh (stream) -> suyu, resource -> lihw
    PMesh* mesh = context->getResourceManager()->retainMesh("object.mes");
    PTexture* texture = context->getResourceManager()->retainTexture("texture.png");
    PShader* shader = context->getResourceManager()->retainShader("vert.glsl", "frag.glsl");

    // sprint 2
    PDrawable* drawable = pNew(PDrawable(layer));
    drawable->getMaterial()->setShader(shader);
    drawable->getMaterial()->addTexture(texture);
    drawable->getGeometry()->setMesh(mesh);
    
    // sprint 1 -> jihao
    layer->getCamera()->setPosition(10, 0, 0);
    layer->getCamera()->setOrientation(0, 0, 0, 0, 1, 0);
    layer->getCamera()->setProjection(P_CAMERA_PROJECTION_PERSPECTIVE);

    // sprint 3
    layer->getCulling()->setCulling(P_CULLING_DEFAULT);
    layer->getSorting()->setSorting(P_SORTING_DEFAULT); 
    
    // sprint 1 -> jihao
    layer->getRenderTarget()->setViewport(-1, -1, -1, -1);
    layer->getRenderTarget()->setStencilWritable(false);
    layer->getRenderTarget()->setFrameBuffer(P_NULL);

    // sprint 1, object hierachy -> PData/PObject -> suyu
}
*/
void pMain(int argc, char* argv[])
{
    pAssert(PActivity::s_activity != P_NULL);

    if (PActivity::s_activity != P_NULL)
    {
        PContextProperties contextProperties;
        contextProperties.m_contextName = PString("default");
        contextProperties.m_multisamples = 2;

        PContext* context = pNew(PContext(contextProperties));
        PActivity::s_activity->addContext(context);

        //setupScene(context);
    }
    else
    {
        pLogError("No running activity");
    }
}
示例#17
0
	Window* GUIEngine::AddWindow( rString name, Rectangle boundingBox, rString parent , bool border )
	{
		Window* newWindow = pNew( Window, name, parent, boundingBox, border );
		bool success = false;
		for( auto& windowIt : m_Windows )
		{
			if( parent == windowIt.second->GetName() )
				success = windowIt.second->AddChild( name, newWindow );
		}
		
		if( success )
		{
			m_Windows.emplace( name, newWindow );
			return newWindow;
		}
		else
		{
			Logger::Log( "Failed to add window: " + name, "GUIEngine", LogSeverity::ERROR_MSG );
			pDelete( newWindow );
			return nullptr;
		}
	}
示例#18
0
void gfx::MaterialBank::LoadMaterials(rString filename)
{
	Model dummy;
	ObjectImporter assetImporter;
	assetImporter.LoadObject(filename, dummy);
	rVector<RoboMat> mats = assetImporter.GetMaterials();
	
	for ( auto& it : mats )
	{
		Material* mat = pNew( Material );
		mat->SetBaseColor(vec3(it.Color[0],it.Color[1],it.Color[2]));
		mat->SetSpecularColor(vec3(it.Specularity[0],it.Specularity[1],it.Specularity[2]));
		mat->SetName(it.Name);
		if(it.HasAlbedoMap)
		{
			mat->SetAlbedoTexture(it.AlbedoTex);
		}
		if(it.HasBumpMap)
		{
			mat->SetNormalTexture(it.BumpTex);
		}
		if(it.HasRoughMap)
		{
			mat->SetRoughnessTexture(it.RoughTex);
		}
		if(it.HasMetalMap)
		{
			mat->SetMetalTexture(it.MetalTex);
		}
		if(it.HasGlowMap)
		{
			mat->SetGlowTexture(it.GlowTex);
		}
		m_Materials.push_back( mat );
		m_MatMap.emplace(mat->GetName(),mat);
	}
	//TODOHJ: HAX for restarting
	m_TextureAtlasses = pNewArray(TextureAtlas,Texture_Atlas_Type::Count);
}
示例#19
0
	Text* GUIEngine::AddText( const rString& name, TextDefinition textDefinition, const rString& parent )
	{
		textDefinition.FontID = m_CurrentFontID;
		
		Rectangle boundingBox;
		
		if( textDefinition.BoundsSize.x == -1 )
		{
			glm::ivec2 windowSize = g_GUI.GetWindowSize( parent );
			boundingBox.Width = windowSize.x;
			boundingBox.Height = windowSize.y;
		}
		else
		{
			boundingBox.Width = textDefinition.BoundsSize.x;
			boundingBox.Height = textDefinition.BoundsSize.y;
		}
		
		Text* txt = pNew( Text, name, textDefinition, parent, boundingBox );
		AddChild( name, txt, parent );
		return txt;
	}
示例#20
0
/**
 * Private implementation.
 * @param elmRoot
 */
void Node::buildChildren(const ElementNode &elmRoot)       // private
{
    // go thru this element's attributes
    xmlAttr *plibAttr = m_plibNode->properties;
    while (plibAttr)
    {
        const char *pcszKey;
        boost::shared_ptr<AttributeNode> pNew(new AttributeNode(elmRoot, this, plibAttr, &pcszKey));
        // store
        m->attribs[pcszKey] = pNew;

        plibAttr = plibAttr->next;
    }

    // go thru this element's child elements
    xmlNodePtr plibNode = m_plibNode->children;
    while (plibNode)
    {
        boost::shared_ptr<Node> pNew;

        if (plibNode->type == XML_ELEMENT_NODE)
            pNew = boost::shared_ptr<Node>(new ElementNode(&elmRoot, this, plibNode));
        else if (plibNode->type == XML_TEXT_NODE)
            pNew = boost::shared_ptr<Node>(new ContentNode(this, plibNode));
        if (pNew)
        {
            // store
            m->children.push_back(pNew);

            // recurse for this child element to get its own children
            pNew->buildChildren(elmRoot);
        }

        plibNode = plibNode->next;
    }
}
示例#21
0
Volume* Ray::CalculateWorld( const glm::mat4& world, const glm::vec3& position, const glm::quat& orientation, const float scale ) const
{
	Volume* worldVolume = pNew( Ray );
	CalculateWorld( world, position, orientation, scale, worldVolume );
	return worldVolume;
}
示例#22
0
Volume* HeightMap::CalculateWorld( const glm::mat4& world, const glm::vec3& position, const glm::quat& orientation, const float scale ) const
{
    Volume* worldVolume = pNew( HeightMap, this->HeightFunction );
	CalculateWorld( world, position, orientation, scale, worldVolume );
	return worldVolume;
}
示例#23
0
	Sprite*GUIEngine::AddSprite( const rString& name, SpriteDefinition spriteDefinition, const rString& parent )
	{
		Sprite* sprite = pNew( Sprite, name, spriteDefinition, parent );
		AddChild( name, sprite, parent );
		return sprite;
	}	
示例#24
0
QMap<int, double> TutorialUnit::moveHaptic(QMap<int, double> axes)
{
    QMap<int, double> force;
    if(axes.empty()){
        stop();
        return force;
    }

    if(mHapticStartAxes.empty()){
        mHapticStartAxes = axes;
        mStartPosition = QPointF(getPosition().x, getPosition().y);
    }

    qDebug() << "=========================";
    qDebug() << "Start: " << mHapticStartAxes[Tc::Haptic::AxisX] << "," << mHapticStartAxes[Tc::Haptic::AxisX];
    qDebug() << "Current: " << axes[Tc::Haptic::AxisX] << "," << axes[Tc::Haptic::AxisX];

    axes[Tc::Haptic::AxisX] -= mHapticStartAxes[Tc::Haptic::AxisX];
    axes[Tc::Haptic::AxisY] -= mHapticStartAxes[Tc::Haptic::AxisY];
    axes[Tc::Haptic::AxisZ] -= mHapticStartAxes[Tc::Haptic::AxisZ];

    QPointF p(axes[Tc::Haptic::AxisX], axes[Tc::Haptic::AxisY]);
    qDebug() << "Delta: " << axes[Tc::Haptic::AxisX] << "," << axes[Tc::Haptic::AxisX];

    // 1. Converte p to the rotated coordinate system
    // Rotation around "z"-axis, all values in radian
    // => R = [[cos(yaw),-sin(yaw)][sin(yaw), cos(yaw)]]
    // => x' = p.x() * cos(yaw) - p.y() * sin(yaw)
    //    y' = p.x() * sin(yaw) + p.y() * cos(yaw)
    double yawRad = qDegreesToRadians(mHapticStartAxes[Tc::Haptic::AxisYaw]);
    QPointF pNew(p.x() * qCos(yawRad) + p.y() * qSin(yawRad), p.x() * -qSin(yawRad) + p.y() * qCos(yawRad));

    double targetX = qBound<double>(0.0, mStartPosition.x() + pNew.x() * IMAGE_WIDTH, IMAGE_WIDTH);
    double targetY = qBound<double>(0.0, mStartPosition.y() + pNew.y() * IMAGE_HEIGHT, IMAGE_HEIGHT);
    QPointF targetPosition(targetX, targetY);

    qDebug() << "New: " << pNew.x() << "," << pNew.y() << " (" << mHapticStartAxes[Tc::Haptic::AxisYaw] << ")";
    qDebug() << "Target: " << targetX << "," << targetY;

    //qDebug() << p << ";" << targetPosition;

    //setPosition(targetPosition);

    return force;

    // Create return value

    // Check if robot is in "bounds"
    /*QPointF currentPosition = QPointF(getPosition().x, getPosition().y);
    QRect workspace = QRect(50,50,500,300);

    if(currentPosition.x() < workspace.left()){
        // Robot left workspace on left hand side
        force[Tc::Haptic::AxisX] = abs(currentPosition.x()-workspace.left())*10.0;
    } else if(workspace.right() < currentPosition.x()){
        // Robot left workspace on right hand side
        force[Tc::Haptic::AxisX] = abs(currentPosition.x()-workspace.right())*-10.0;
    }

    if(currentPosition.y() < workspace.top()){
        // Robot left workspace on the top
        force[Tc::Haptic::AxisY] = abs(currentPosition.y()-workspace.top())*-10.0;
    } else if(workspace.bottom() < currentPosition.y()){
        // Robot left workspace on the bottom
        force[Tc::Haptic::AxisY] = abs(currentPosition.y()-workspace.bottom())*10.0;
    }*/


}
示例#25
0
文件: main.cpp 项目: suyu0925/backup
int main(int argc, char* argv[])
{
    int exitCode = EXIT_SUCCESS;

    PActivity* activity = pNew(PActivity(argc, argv));
    
    // Enable memory leak checks and heap validation. 
    _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF);
    _CrtSetBreakAlloc(-1);
    
    pMain(argc, argv);

    // Set console title.
    SetConsoleTitle(L"protoss debug console");
    
    // Disable the close button of the console window.
    HWND hConsoleWindow = GetConsoleWindow();
    if (hConsoleWindow != NULL)
    {
        HMENU hMenu = GetSystemMenu(hConsoleWindow, 0);
        if (hMenu != NULL)
        {
            DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND);
            DrawMenuBar(hConsoleWindow);
        }
    }

    PContext* context = activity->findContext(pUint32(0));
    pAssert(context != P_NULL);
    if (context == P_NULL)
    {
        exitCode = EXIT_FAILURE;
        pDelete(activity);
        return exitCode;
    }

    PWin32Window window(context);

    if (!window.create())
    {
        exitCode = EXIT_FAILURE;
        pDelete(activity);
        return exitCode;
    }
    
    // Initialize the context. 
    // kzaPlatformSetInstanceHandle(context, GetModuleHandle(NULL));
    context->setState(P_CONTEXT_STATE_UNINITIALIZED);
    if (!context->initialize())
    {
        exitCode = EXIT_FAILURE;
    }

    if (!context->onInitialized())
    {
        context->setState(P_CONTEXT_STATE_ERROR);
    }
    else
    {
        pLogDebug("Starting program main loop");
        context->setState(P_CONTEXT_STATE_RUNNING);
    }

    if (context->getState() == P_CONTEXT_STATE_ERROR)
    {
        exitCode = EXIT_FAILURE;
    }

    // The mainloop of window.
    window.run();

    // Right before destroy the context, user might have
    // something to do.
    context->onDestroy();

    context->destroy();
    
    // Destroy native window.
    window.destroy();

    // Destroy the activity
    pDelete(activity);

    // If debugger is present, a pause is required to keep the console output
    // visible. Otherwise the pause is automatic. 
    if (IsDebuggerPresent())
    {
        system("pause");
    }

    return exitCode;
}
示例#26
0
AIPlayer::AIPlayer(int team,bool useNeuralNet): Subscriber("AIPlayer" + rToString( team ) )
{
	m_IsNeuralNetAI = useNeuralNet;
	m_Team = team;

	rVector<ResourceComponent*> knownStaticResources = Terrain::GetInstance()->GetResourceList();

	for (int i = 0; i < knownStaticResources.size(); i++)
	{
		FoodLocation food;
		food.TilePointer = knownStaticResources[i]->TilePointer;
		food.ClaimedBySquad = -1;
		m_Brain.FoodLocations.push_back(food);
#if AI_RENDER_DEBUG == 1
		knownStaticResources[i]->TilePointer->DebugInfo = 5;
#endif
	}


	rVector<Entity> controlPoints = g_SSControlPoint.GetControlPoints();
	float shortest = 5000;
	glm::vec3 squadPos;

	squadPos = g_GameData.GetSpawnPoints()[m_Team];

	glm::vec3 positionToHold;
	int numberOfControlPoints = static_cast<int>(controlPoints.size());
	for (int i = 0; i < numberOfControlPoints; i++)
	{
		OwnerComponent* cpc = GetDenseComponent<OwnerComponent>(controlPoints[i]);

		if (cpc->OwnerID == m_Team)
			continue;

		glm::vec3 controlPointPos = GetDenseComponent<PlacementComponent>(controlPoints[i])->Position;

		int dist = static_cast<int>(glm::distance(controlPointPos, squadPos));

		Tile* t = Terrain::GetInstance()->GetTile(controlPointPos.x + 5, controlPointPos.z + 5);

		ValuableArea valArea;
		valArea.Radius = 30;
		valArea.Reason = VALUE_REASON::VALUE_REASON_CONTROL_POINT;
		valArea.TilePointer = t;
		valArea.Value = dist*(2 - (cpc->OwnerID != m_Team));
		valArea.ClaimedBySquad = -1;
		valArea.Target = controlPoints[i];

		m_ValuableAreas.push_back(valArea);
	}

	m_Brain.DelayUpdateWorldView  += m_Team*0.1f;

	m_NInPuts = PERCEPTION_NUMBER_OF_PERCEPTIONS;
	m_NOutPuts = DECISION_NUMBER_OF_DECISIONS;


	m_Genes.PreferredUpgrade.resize(5);
	for (int i = 0; i < m_Genes.PreferredUpgrade.size();i++)
	{
		m_Genes.PreferredUpgrade[i] = i;
	}

	LoadGenes();

// 	rVector<UpgradeData> upgrades = g_SSUpgrades.GetUpgradeArray();
// 	
// 	for (int i = 0; i < upgrades.size(); i++)
// 	{
// 
// 		m_Genes.PreferredUpgrade.push_back(1);
// 	}

	m_Decisions.resize(m_NOutPuts);
	m_Perceptions.resize(m_NInPuts);
	m_WantedOutputs.resize(m_NOutPuts);
	m_Outputs.resize(m_NOutPuts);
	m_TrainingVector.resize(m_NOutPuts);

	if (m_IsNeuralNetAI)
	{
		m_Net = pNew(NeuralNet, m_NInPuts, m_NOutPuts, 2, m_NInPuts, m_Team);
		m_Net->ReadWeights();
	}

	m_SimInterests = MessageTypes::AI_MSG;
	g_SSMail.RegisterSubscriber(this);
}
示例#27
0
	Slider* GUIEngine::AddSlider(const rString& name, Rectangle boundingBox, const rString& parent)
	{
		Slider* slider = pNew( Slider, name, parent, boundingBox );
		AddChild( name, slider, parent );
		return slider;
	}
示例#28
0
	ProgressBar* GUIEngine::AddProgressBar( const rString& name, Rectangle boundingBox, const rString& parent )
	{
		ProgressBar* progressBar = pNew( ProgressBar, name, parent, boundingBox );
		AddChild( name, progressBar, parent );
		return progressBar;
	}
Subsystem* SSParticles::CreateNew( ) const {
	return pNew( SSParticles, SSParticles::ID );
}
示例#30
0
	ComboBox* GUIEngine::AddComboBox( const rString& name, Rectangle boundingBox, const rString& parent )
	{
		ComboBox* cmboBox = pNew( ComboBox, name, parent, boundingBox );
		AddChild( name, cmboBox, parent );
		return cmboBox;
	}