Wheat farms stuff trouble.

Issue #1161 resolved
dalerank repo owner created an issue

Even though they are fully staffed, the popup says that they are not fully staffed.

Comments (5)

  1. Gustavo Alves

    Farms productivity depends on the number of meadows it covers.

    math::Percent Farm::productivity() const
    {
      return Factory::productivity() * _d->meadowsCoverage;
    }
    

    Staff description is being generated upon this value.

    std::string WorkingBuildingHelper::productivity2desc( WorkingBuildingPtr w, const std::string& prefix )
    {
      std::string factoryType = w->info().typeName();
      unsigned int workKoeff = w->productivity() * productivityDescriptionCount / 100;
    
      workKoeff = math::clamp( workKoeff, 0u, productivityDescriptionCount-1 );
    
      if( prefix.empty() )
      {
        return fmt::format( "##{0}_{1}##",
                            factoryType, productivityDescription[ workKoeff ] );
      }
      else
      {
        return fmt::format( "##{0}_{1}_{2}##",
                            factoryType, prefix, productivityDescription[ workKoeff ] );
      }
    }
    

    I can fix this getting the number of workers directly onto the method above. But I don't know if this is the right approach.

    unsigned int workKoeff = math::percentage(w->numberWorkers(), w->maximumWorkers()) * productivityDescriptionCount / 100;
    

    Perhaps, info box should display additional information about this meadow related productivity.

  2. Log in to comment