9 #include <unordered_set>
25 std::string
id =
"#nullid#";
91 if(other ==
nullptr)
return;
120 std::shared_ptr<PlatformSettings> cherries,
121 std::unordered_set<std::string>
const &fields,
122 std::unordered_set<std::string>
const *templateFields=
nullptr
125 std::shared_ptr<PlatformSettings> settings = \
126 std::make_shared<PlatformSettings>(
this);
127 std::function<bool(std::string
const&)> hasCherry = [&](
128 std::string
const &fieldName
130 return fields.find(fieldName) != fields.end();
133 if(hasCherry(
"baseTemplate") && cherries->baseTemplate !=
nullptr){
134 std::shared_ptr<PlatformSettings> tmpTemplate = \
135 cherries->baseTemplate->baseTemplate;
136 cherries->baseTemplate->baseTemplate =
nullptr;
137 settings =
cherryPick(cherries->baseTemplate, *templateFields);
138 cherries->baseTemplate->baseTemplate = tmpTemplate;
139 settings->baseTemplate = cherries->baseTemplate;
141 if(hasCherry(
"x")) settings->x = cherries->x;
142 if(hasCherry(
"y")) settings->y = cherries->y;
143 if(hasCherry(
"z")) settings->z = cherries->z;
144 if(hasCherry(
"yawAtDepartureSpecified"))
145 settings->yawAtDepartureSpecified = \
146 cherries->yawAtDepartureSpecified;
147 if(hasCherry(
"yawAtDeparture"))
148 settings->yawAtDeparture = cherries->yawAtDeparture;
149 if(hasCherry(
"onGround")) settings->onGround = cherries->onGround;
150 if(hasCherry(
"stopAndTurn"))
151 settings->stopAndTurn = cherries->stopAndTurn;
152 if(hasCherry(
"smoothTurn"))
153 settings->smoothTurn = cherries->smoothTurn;
154 if(hasCherry(
"slowdownEnabled"))
155 settings->slowdownEnabled = cherries->slowdownEnabled;
156 if(hasCherry(
"movePerSec_m"))
157 settings->movePerSec_m = cherries->movePerSec_m;
169 return glm::dvec3(
x,
y,
z);
210 std::stringstream ss;
211 ss <<
"PlatformSettings \"" <<
id <<
"\":\n";
213 ss <<
"\ttemplate.id = \"" <<
baseTemplate->id <<
"\"\n"
217 <<
"\ttemplate.yawAtDepartureSpecified = "
219 <<
"\ttemplate.yawAtDeparture = "
221 <<
"\ttemplate.onGround = " <<
baseTemplate->onGround <<
"\n"
222 <<
"\ttemplate.stopAndTurn = " <<
baseTemplate->stopAndTurn
224 <<
"\ttemplate.smoothTurn = " <<
baseTemplate->smoothTurn
226 <<
"\ttemplate.slowdownEnabled = "
228 <<
"\ttemplate.movePerSec_m = " <<
baseTemplate->movePerSec_m
232 ss <<
"x = " <<
x <<
"\n"
233 <<
"y = " <<
y <<
"\n"
234 <<
"z = " <<
z <<
"\n"
237 <<
"onGround = " <<
onGround <<
"\n"
Base class for all assets.
Definition: Asset.h:10