summaryrefslogtreecommitdiff
path: root/nodejs/lib/contracts.ts
diff options
context:
space:
mode:
authorJulien Dessaux2024-04-06 21:36:42 +0200
committerJulien Dessaux2024-04-07 23:01:52 +0200
commit3e80bc8a4d3127d17dbc3f52301d33a79e53a980 (patch)
tree41caed2075ed39f8eec5f3465aded203ae377c58 /nodejs/lib/contracts.ts
parent[node] waypoints usage refactoring (diff)
downloadspacetraders-3e80bc8a4d3127d17dbc3f52301d33a79e53a980.tar.gz
spacetraders-3e80bc8a4d3127d17dbc3f52301d33a79e53a980.tar.bz2
spacetraders-3e80bc8a4d3127d17dbc3f52301d33a79e53a980.zip
[node] multiple contracting fixes and some more refactoring
Diffstat (limited to 'nodejs/lib/contracts.ts')
-rw-r--r--nodejs/lib/contracts.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/nodejs/lib/contracts.ts b/nodejs/lib/contracts.ts
index 833d434..0582cc7 100644
--- a/nodejs/lib/contracts.ts
+++ b/nodejs/lib/contracts.ts
@@ -61,6 +61,10 @@ export async function deliver(contract: Contract, ship: Ship): Promise<Contract>
}});
if (response.error) {
switch(response.error.code) {
+ case 4503: // contract has expired
+ // TODO sell cargo? the next trading loop should take care of it by itself
+ contract.fulfilled = true;
+ return contract;
case 4509: // contract delivery terms have been met
return await fulfill(contract);
default: // yet unhandled error