Пример #1
0
void ModuleCoordinator::update(void) {
  //! \todo Two calls per update ? fix it
  //qDebug() << "Modules\n";
  emit updateModules();
  //qDebug() << "ModuleCoordinator emit nextStep";
  emit nextStep();
}
Пример #2
0
bool ModuleCoordinator::addModule(QString rname, QString mname, Module* mod) {
  _modules.insert(QPair<QString,QString>(rname, mname), mod);

  connect(this, SIGNAL(updateModules()), mod, SLOT(update()));
  connect(mod, SIGNAL(send(QString)), this, SLOT(forwardModuleMessage(QString)));
  return true;
}
Пример #3
0
void Console::updateCaches() {
	::Engines::Console::updateCaches();

	updateCampaigns();
	updateModules();
	updateAreas();
	updateMusic();
}
Пример #4
0
void Console::cmdListModules(const CommandLine &UNUSED(cl)) {
	updateModules();

	for (std::vector<Common::UString>::const_iterator m = _modules.begin(); m != _modules.end(); ++m) {
		const Common::UString name = Module::getName(*m);

		if (!name.empty())
			printf("%s (\"%s\")", m->c_str(), name.c_str());
		else
			printf("%s", m->c_str());
	}
}
Пример #5
0
void Console::cmdLoadModule(const CommandLine &cl) {
	if (cl.args.empty()) {
		printCommandHelp(cl.cmd);
		return;
	}

	updateModules();
	for (std::vector<Common::UString>::const_iterator m = _modules.begin(); m != _modules.end(); ++m) {
		if (m->equalsIgnoreCase(cl.args)) {
			hide();
			_engine->getGame().getCampaign().loadModule(cl.args + ".mod");
			return;
		}
	}

	printf("No such module \"%s\"", cl.args.c_str());
}
Пример #6
0
void Console::cmdListModules(const CommandLine &cl) {
	updateModules();
	for (std::list<Common::UString>::iterator m = _modules.begin(); m != _modules.end(); ++m)
		print(*m);
}
Пример #7
0
void Console::cmdListModules(const CommandLine &UNUSED(cl)) {
	updateModules();

	for (std::vector<Common::UString>::iterator m = _modules.begin(); m != _modules.end(); ++m)
		printf("%s (\"%s\")", m->c_str(), Module::getName(*m).c_str());
}
Пример #8
0
bool Simulation::update(units::Duration dt)
{
    // Initialize simulation
    if (!isInitialized())
        initialize();

    // Increase step number
    m_iteration++;
    m_totalTime += dt;

    // Clear all stored forces
    for (auto& obj : m_objects)
        obj->setForce(Zero);

    // Update modules
    updateModules(dt);

    // Update objects
    updateObjects(dt);

    // Detect object that leaved the scene
    detectDeserters();

    // Delete unused objects
    deleteObjects();

    // Store data
    if (m_dataOutObjects)
    {
        for (const auto& object : m_objects)
        {
            const auto pos = object->getPosition();
            const auto vel = object->getVelocity();

            *m_dataOutObjects <<
                // iteration
                getIteration() << ";" <<
                // totalTime
                getTotalTime() << ";" <<
                // id
                object->getId() << ";" <<
                // typeName
                object->getTypeName() << ";" <<
                // posX
                pos.getX() << ";" <<
                // posY
                pos.getY() << ";" <<
                // velX
                vel.getX() << ";" <<
                // velY
                vel.getY() << "\n"
            ;
        }
    }

#ifdef CECE_ENABLE_BOX2D_PHYSICS
    {
        auto _ = measure_time("sim.physics", TimeMeasurementIterationOutput(this));

        m_world.Step(getPhysicsEngineTimeStep().value(), 10, 10);
    }
#endif

    return (hasUnlimitedIterations() || getIteration() <= getIterations());
}