Skip to content
Snippets Groups Projects
Commit ce23c0c8 authored by pregmodfan's avatar pregmodfan
Browse files

fix for counting of reserved for incubator children

parent 83ec5fcd
No related branches found
No related tags found
2 merge requests!2047RA rework,!1725Incubator reservation count and sanity check
...@@ -139,4 +139,13 @@ window.setPregType = function(actor) { ...@@ -139,4 +139,13 @@ window.setPregType = function(actor) {
} }
} }
return ovum; return ovum;
}
window.getIncubatorReserved = function(slaves) {
var count = 0;
slaves.forEach(function(s){
if (s.reservedChildren > 0)
count += s.reservedChildren;
});
return count;
} }
\ No newline at end of file
...@@ -755,7 +755,7 @@ All in all, ...@@ -755,7 +755,7 @@ All in all,
<<if _origReserve > 0 && _curBabies > 0>> /*Do we need incubator checks?*/ <<if _origReserve > 0 && _curBabies > 0>> /*Do we need incubator checks?*/
<<if _curBabies >= _origReserve>> <<if _curBabies >= _origReserve>>
/*adding normal*/ /*adding normal*/
<<set _cToIncub = _origReserve>> <<set _cToIncub = _origReserve, $slaves[$i].reservedChildren = 0>>
<<elseif _curBabies < _origReserve && $slaves[$i].womb.length > 0>> <<elseif _curBabies < _origReserve && $slaves[$i].womb.length > 0>>
/*broodmother or partial birth, we will wait for next time to get remaining children*/ /*broodmother or partial birth, we will wait for next time to get remaining children*/
<<set $slaves[$i].reservedChildren -= _curBabies, _cToIncub = _curBabies>> <<set $slaves[$i].reservedChildren -= _curBabies, _cToIncub = _curBabies>>
...@@ -763,7 +763,6 @@ All in all, ...@@ -763,7 +763,6 @@ All in all,
/*Stillbirth or something other go wrong. Correcting children count.*/ /*Stillbirth or something other go wrong. Correcting children count.*/
<<set $slaves[$i].reservedChildren = 0, _cToIncub = _curBabies>> <<set $slaves[$i].reservedChildren = 0, _cToIncub = _curBabies>>
<</if>> <</if>>
<<set $mom = $slaves[$i]>> <<set $mom = $slaves[$i]>>
<br><br> <br><br>
Of $possessive _curBabies child<<if $slaves[$i].pregType > 1>>ren<</if>>; _cToIncub <<if $slaves[$i].reservedChildren > 1>>were<<else>>was<</if>> taken to $incubatorName. Of $possessive _curBabies child<<if $slaves[$i].pregType > 1>>ren<</if>>; _cToIncub <<if $slaves[$i].reservedChildren > 1>>were<<else>>was<</if>> taken to $incubatorName.
...@@ -772,7 +771,6 @@ All in all, ...@@ -772,7 +771,6 @@ All in all,
<<include "Incubator Workaround">> <<include "Incubator Workaround">>
<<set $slaves[$i].curBabies.shift()>> /*for now child generation metod for incubator not changed. But here children for incubator removed from array of birthed babies. If we decide later - we can use them for incubator as real objects here. For now they just discarded silently */ <<set $slaves[$i].curBabies.shift()>> /*for now child generation metod for incubator not changed. But here children for incubator removed from array of birthed babies. If we decide later - we can use them for incubator as real objects here. For now they just discarded silently */
<</for>> <</for>>
<<set $reservedChildren -= _cToIncub>>
<<set _curBabies = $slaves[$i].curBabies.length>> <<set _curBabies = $slaves[$i].curBabies.length>>
<br><br> <br><br>
<<if _curBabies > 0>> <<if _curBabies > 0>>
......
...@@ -51,5 +51,7 @@ I need to break single passage to several widgets, as it's been overcomplicated ...@@ -51,5 +51,7 @@ I need to break single passage to several widgets, as it's been overcomplicated
<</if>> <</if>>
<</for>> <</for>>
<<set $reservedChildren = getIncubatorReserved($slaves)>>
<<set $birthee = 0>> <<set $birthee = 0>>
<<set $birthed = 0>> <<set $birthed = 0>>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment