leonard-IMBERT / StarlightMap

This is an interactive map for the role play forum isle of starlight
http://hexagrid.xyz
MIT License
0 stars 2 forks source link

Wrong number of items listed for Loose Items and Structures #18

Closed KingMarth closed 5 years ago

KingMarth commented 5 years ago

Something happened to the parser's ability to interpret large numbers of items.

You can see with Loose Items and Structures that this should be converting e.g. "16,11: 2 Food, 2 Leather" into a survivor with "Food, Food, Leather, Leather" but it's actually producing a survivor with "Food, Leather". This throws off the total item counts under stats.

The code in question should be here: https://github.com/leonard-IMBERT/StarlightMap/blob/d74198dff61732fede41d6586141d3925e53fe25/src/back/Crawler.js#L132-L147

I'm not too sure why this is having trouble now, my first guess is that 'new Array(number)' somehow switched from receiving a number (thus making an array of length 2, which is filled out with item names) to receiving a string (thus making the array ['2'], which is filled out with the item name but keeping only one item). If so, sorry about that.

leonard-IMBERT commented 5 years ago

From what I see, node make a difference between new Array('2') where 2 is a string which produce ['2'] and new Array(2) where 2 is a number which produce [ <2 empty items> ].

leonard-IMBERT commented 5 years ago

A simple cast to number by doing new Array(Number(number)) should work