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

Method moreByValue

src/Basescape/ResearchInfoState.cpp:308–320  ·  view source on GitHub ↗

* Adds the given number of scientists to the project if possible. * @param change Number of scientists to add. */

Source from the content-addressed store, hash-verified

306 * @param change Number of scientists to add.
307 */
308void ResearchInfoState::moreByValue(int change)
309{
310 if (0 >= change) return;
311 int freeScientist = _base->getAvailableScientists();
312 int freeSpaceLab = _base->getFreeLaboratories();
313 if (freeScientist > 0 && freeSpaceLab > 0)
314 {
315 change = std::min(std::min(freeScientist, freeSpaceLab), change);
316 _project->setAssigned(_project->getAssigned()+change);
317 _base->setScientists(_base->getScientists()-change);
318 setAssignedScientist();
319 }
320}
321
322/**
323 * Removes one scientist from the project if possible.

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected