Skip to content

Instantly share code, notes, and snippets.

@VirtuosiMedia
Created April 6, 2016 22:52
Show Gist options
  • Save VirtuosiMedia/b6f99d693d609ea8a3ea70bc144a01d3 to your computer and use it in GitHub Desktop.
Save VirtuosiMedia/b6f99d693d609ea8a3ea70bc144a01d3 to your computer and use it in GitHub Desktop.
/**
* Cancels an order for a good from a holding.
* @param {int} holdingId The holding id.
* @param {string} good The good id.
*/
cancelTradeOrder: function(holdingId, good){
var holding = jg.data.holdings[holdingId];
var order = holding.data.economic.trade.orders[good];
if (order.orderType === 'order'){
holding.resources.supply.credits += order.total;
}
delete holding.data.economic.trade.orders[good];
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment