Exemplo n.º 1
0
void AgentController::setHasCompletedTransaction(bool hasCompletedTransaction)
{
  //config_->agentInfoConfig().setValue("hasCompletedTransaction", static_cast<unsigned int>(hasCompletedTransaction ? 1:0));
  config_->agentInfoConfig().HasCompletedTransaction_ = hasCompletedTransaction;
  config_->save();
  setSleeping(hasCompletedTransaction);
}
Exemplo n.º 2
0
void AgentController::resetFlags()
{
  //currentTime_ = QDateTime::currentDateTime();
  isFreshPriceData_ = false;
  isFreshSystemPrice_ = false;
  setHasMadeOrder(false);
  setHasCompletedTransaction(false);
  setSleeping(false);
  setCurrentDay(static_cast<unsigned int>(QDateTime::currentDateTime().date().day()));

  latestDailyPrices_.clear();
  log_->append("AgentController flags reset.", true);
}
Exemplo n.º 3
0
/**
 *  input_ is available only on server or on the local client, not for
 *  remote tanks.
 */
void Tank::frameMove(float dt)
{
    PROFILE(Tank::frameMove);

    setSleeping(false);
    Controllable::frameMove(dt);

    // Weapon firing code is handled on client for local player only
    // to have immediate feedback. Remote players receive weapon
    // feedback by received state.
    bool firing = false;
    if (getLocation() == CL_SERVER_SIDE ||
        (getLocation() == CL_CLIENT_SIDE && isLocallyControlled()))
    {
        firing |= weapon_system_[0]->handleInput(input_.fire1_);
        firing |= weapon_system_[1]->handleInput(input_.fire2_);
        firing |= weapon_system_[2]->handleInput(input_.fire3_);
        firing |= weapon_system_[3]->handleInput(input_.fire4_);
    }

    if (getLocation() != CL_REPLAY_SIM)
    {
        for(unsigned w=0; w < NUM_WEAPON_SLOTS; w++)
        {
            weapon_system_[w]->frameMove(dt);
        }
    }
    
    

    if (is_locally_controlled_ && getLocation() == CL_CLIENT_SIDE)
    {
        frameMoveTurret(dt, true);
    }
    frameMoveTurret(dt, false);

    
    if (is_locally_controlled_ || getLocation() == CL_SERVER_SIDE)
    {
        // remote tanks don't have accurate wheel info, and no extra
        // dampening needed anyway
        handleExtraDampening();
        
        // Don't calc tire physics for uncontrolled objects on client.
        frameMoveTires(dt);
    }

    
    if (location_ == CL_SERVER_SIDE)
    {
        /// heal logic
        if (!firing &&
            params_.get<bool>("tank.heal_skill") &&
            getGlobalLinearVel().length() < s_params.get<float>("server.logic.tank_heal_velocity_threshold") &&
            getOwner() != UNASSIGNED_SYSTEM_ADDRESS)
        {
            startHealing();
        } else
        {
            stopHealing();
        }

        // object is positioned by visual on client side. Avoid redundant
        // positioning
        positionCarriedObject();
        
        if (firing)
        {
            setInvincible(false);
        }
    }
}
Exemplo n.º 4
0
//------------------------------------------------------------------------------
void TankMine::init()
{
    setSleeping(false);
}