|
|
@ -2,29 +2,29 @@ |
|
|
|
|
|
|
|
StorageEditor::StorageEditor() { } |
|
|
|
|
|
|
|
StorageEditor::StorageEditor(const std::shared_ptr<WarenStorage> storage) { |
|
|
|
this->storage = storage; |
|
|
|
StorageEditor::StorageEditor(std::shared_ptr<WarenStorage> storage) { |
|
|
|
this->storage = std::make_shared<WarenStorage>(new WarenStorage()); |
|
|
|
} |
|
|
|
|
|
|
|
WarenStorage StorageEditor::getWarenStorage() const { |
|
|
|
std::shared_ptr<WarenStorage> StorageEditor::getWarenStorage() const { |
|
|
|
return storage; |
|
|
|
} |
|
|
|
|
|
|
|
void StorageEditor::setWarenStorage(const WarenStorage storage) { |
|
|
|
this->storage = storage; |
|
|
|
this->storage = std::make_shared<WarenStorage>(storage); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void StorageEditor::addWaren(const Ware ware, int amount) { |
|
|
|
for(auto i = 0; i < amount; i++) { |
|
|
|
storage.addWareAndGenerateId(ware); |
|
|
|
storage->addWareAndGenerateId(ware); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void StorageEditor::removeWaren(const std::string& name, const int amount) { |
|
|
|
for(auto i = 0; i < amount; i++) { |
|
|
|
storage.removeWare(name); |
|
|
|
storage->removeWare(name); |
|
|
|
} |
|
|
|
} |
|
|
|
|