Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/helpers/MultiKeyMap.js
Show First 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
let items = this._getItemsOrInit(primaryKey, secondaryKey); | let items = this._getItemsOrInit(primaryKey, secondaryKey); | ||||
for (let it of items) | for (let it of items) | ||||
if (it._ID == itemID) | if (it._ID == itemID) | ||||
{ | { | ||||
it._count++; | it._count++; | ||||
return stackable; | return stackable; | ||||
} | } | ||||
items.push(Object.assign({ "_ID": itemID, "_count": 1 }, item)); | items.push({ "_ID": itemID, "_count": 1, "value": item }); | ||||
return true; | return true; | ||||
}; | }; | ||||
/** | /** | ||||
* @returns true if the items list changed in such a way that cached values are possibly invalidated. | * @returns true if the items list changed in such a way that cached values are possibly invalidated. | ||||
*/ | */ | ||||
MultiKeyMap.prototype._RemoveItem = function(primaryKey, itemID, secondaryKey, stackable) | MultiKeyMap.prototype._RemoveItem = function(primaryKey, itemID, secondaryKey, stackable) | ||||
{ | { | ||||
Show All 31 Lines |
Wildfire Games · Phabricator