-
-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathworkshop_item.cpp
42 lines (40 loc) · 1.29 KB
/
workshop_item.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "stdafx.h"
#include "workshop_item.h"
#include "item_factory.h"
#include "item.h"
#include "view_object.h"
#include "content_factory.h"
static TString getItemName(const ContentFactory* factory, Item* item, bool plural) {
auto name = item->getName(plural);
return name;
}
WorkshopItem WorkshopItemCfg::get(WorkshopType type, const ContentFactory* factory) const {
PROFILE;
// for some reason removing this line causes a linker error, probably a compiler bug
auto t = tech;
PItem elem = item.get(factory);
auto& workshopInfo = factory->workshopInfo.at(type);
if (auto& prefix = workshopInfo.prefix)
elem->applyPrefix(*prefix, factory);
vector<TString> description;
if (elem->getNameAndModifiers(factory) != elem->getName())
description.push_back(elem->getNameAndModifiers(factory));
description.append(elem->getDescription(factory));
return WorkshopItem {
item,
getItemName(factory, elem.get(), false),
getItemName(factory, elem.get(), true),
elem->getViewObject().getViewIdList(),
cost.value_or(elem->getCraftingCost()),
std::move(description),
work,
tech,
tutorialHighlight,
elem->getAppliedUpgradeType(),
elem->getMaxUpgrades(),
requireIngredient,
materialTab,
requiresUpgrades,
workshopInfo.hideFromTech
};
}