B:BD[
4.1350] → [
4.1350:1912]
updaters.playerSave.allocatedPointNodeSet.enqueueUpdate((prev: HashSet<PointNodeRef>, prevGameState) => {
let history = prevGameState.playerSave.allocatedPointNodeHistory
let mostRecent = history[history.length - 1]
console.log({ history, actualHistory: [...history] });
// if we were already selected, try to allocate us
if (!prev.contains(mostRecent)) {
const next = prev.clone();
next.put(mostRecent);
console.log({ prev, next, prevSize: prev.size(), nextSize: next.size(), isEqual: prev === next })
return next;
updaters.playerSave.enqueueUpdate((prev, prevGameState) => {
let justAllocated = prevGameState.playerSave.justAllocated; // we are assuming that someone verified that this is good2go
if (!justAllocated) { return prev; }
let prevSet = prev.allocatedPointNodeSet;
if (!prevSet.contains(justAllocated)) { // if it's new, add it to history, set, and decrement sp
const nextSet = prev.allocatedPointNodeSet.clone();
nextSet.put(justAllocated);
const nextHistory = [...prev.allocatedPointNodeHistory];
nextHistory.push(justAllocated);
let availableSp = prev.availableSp - 1;
return {
...prev,
allocatedPointNodeHistory: nextHistory,
allocatedPointNodeSet: nextSet,
availableSp
};