Beispiel #1
0
void ilios::kittens::Game::build(string id)
{
  //get price
  ResourceMap price = this->bld->getPrice(id);
  //check resources
  ResourceMap deficit = this->res->getDeficitResources(price);
  if (deficit.empty())
  {
    cout << "built " << id << " cost:" << endl;
    /*
    
    for (auto e : price)
    {
      cout << e.first << ": " << e.second << endl;
    }
    */
    //remove and build
    this->res->removeResources(price);
    this->bld->build(id);
    //action taken update effect
    this->updateResources();
  }
  else
  {
    //warn
    /*
    cout << "missing resources" << endl;
    for (auto e : deficit)
    {
      cout << e.first << ": " << e.second << endl;
    }
    */
  }
}