void MainWindow::creatureFromClipboard( ) {
     QClipboard& clipboard = *QApplication::clipboard();
     bool* success = new bool;
     Creature* creature = Creature::fromXml(
             clipboard.text(QClipboard::Clipboard).toStdString(),
             success);
     if (*success) {
         setCreature(*creature);
         addCreatureToWorld();
     }
     showCreatureXmlMessage(*success);
     delete success;
 }
 void EvolutionOfMorphologyAndBehavior::setupCreatures() {
     for (int i = 0; i < getPopulationSize(); ++i) {
         setCreature(i, new Creature(getBodyParts(), getBodyParts() - 1,
                 getHiddenLayers(), getNeuronsPerLayer()));
     }
     std::vector<TreeOfNodes*>* morphs = TreeGenerator::createAllTrees(getBodyParts());
     setNumberOfMorphologies(morphs->size());
     _morphologies = new TreeOfNodes*[morphs->size()];
     for (int i = 0; i < morphs->size(); ++i) {
         setMorphology(i, morphs->at(i));
     }
     delete morphs;
 }
Exemplo n.º 3
0
void CCreatureSet::addToSlot(SlotID slot, CreatureID cre, TQuantity count, bool allowMerging/* = true*/)
{
	const CCreature *c = VLC->creh->creatures[cre];

	if(!hasStackAtSlot(slot))
	{
		setCreature(slot, cre, count);
	}
	else if(getCreature(slot) == c && allowMerging) //that slot was empty or contained same type creature
	{
		setStackCount(slot, getStackCount(slot) + count);
	}
	else
	{
		tlog1 << "Failed adding to slot!\n";
	}
}
SteeringVehicle::SteeringVehicle(Creature* creature)
	: _maxForce(1.0f),
      _maxSpeed(1.0f),
      mSpeed(1.0f),
	  mCurrentForce(Vector3::ZERO), 
	  mCurrentVelocity(Vector3::ZERO),
	  mForwardVector(Vector3::NEGATIVE_UNIT_Z),
      mCreatureId(creature->getId()),
      mController(NULL),
      mDebugSteer(Vector3::ZERO),
      mDebugWander(Vector3::ZERO),
      mDebugAvoidObstacles(Vector3::ZERO)
{
    setCreature(creature);
	initialize();

    mController = CreatureControllerManager::getSingleton().getCreatureController(
        mCreature);
    mMessageType_GameObjectsLoaded_Handler = MessagePump::getSingleton().addMessageHandler<MessageType_GameObjectsLoaded>(
                boost::bind(&SteeringVehicle::refetchCreature, this));
}
 CharacterSelectionWindow::Element::~Element()
 {
     setCreature(NULL);
 }