Community Forum

Fillable.registerFillType() code fix suggestion (regarding the 'max 64 fill-types')

Forum Overview >> Farming Simulator 15

CategoryFarming Simulator 15
Created12.06.2015 19:17


D. Ecker (Decker_MMIV) 12.06.2015 19:24
I've been thinking, now since some of the FS15 LUA scripts have been made public, if it wasn't about time to fix the Fillable.registerFillType() method?

Basically it is the check for the maximum number of fill-types allowed, so both the writeStream/readStream will still work, and as a bonus give the modding community the ability to increase the maximum of fill-types (though NOT the fruit-types).

My suggestion to the code fix, would be to change the if-statement to the following:


if Fillable.NUM_FILLTYPES >= (2^Fillable.sendNumBits - 1) then
print("Error: Fillable.registerFillType too many fill types. Only "..(2^Fillable.sendNumBits).." fill types are supported");
return
end;


This code fix (or patch) will also ensure, that only the maximum value possible to send through with streamWriteUIntN(), is correctly checked for.

/Decker_MMIV

Emil Drefers (giants.edrefers) 15.06.2015 08:58
Hi,

removing the hardcoded value of 64 makes definitely sense.

Probably we can incorporate that change in one of the next versions.


Cheers,
Emil


Note: Log in to post. Create a new account here.