MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / lessByValue

Method lessByValue

src/Basescape/ResearchInfoState.cpp:335–346  ·  view source on GitHub ↗

* Removes the given number of scientists from the project if possible. * @param change Number of scientists to subtract. */

Source from the content-addressed store, hash-verified

333 * @param change Number of scientists to subtract.
334 */
335void ResearchInfoState::lessByValue(int change)
336{
337 if (0 >= change) return;
338 int assigned = _project->getAssigned();
339 if (assigned > 0)
340 {
341 change = std::min(assigned, change);
342 _project->setAssigned(assigned-change);
343 _base->setScientists(_base->getScientists()+change);
344 setAssignedScientist();
345 }
346}
347
348/**
349 * Runs state functionality every cycle (used to update the timer).

Callers

nothing calls this directly

Calls 4

getAssignedMethod · 0.80
setAssignedMethod · 0.80
getScientistsMethod · 0.80
setScientistsMethod · 0.45

Tested by

no test coverage detected