1
0
Fork 0
fgdata/Aircraft/c172p/Nasal/registration_number.nas
Stuart Buchanan 60d7073794 Initial checking of c172p-detailed.
From https://github.com/Juanvvc/c172p-detailed.git

Commit df6b2c5f4f75d000c5f5ef9c6cc4446784348f20
2015-06-16 22:20:54 +01:00

22 lines
586 B
Text

var set_registration_number = func (namespace, immat) {
if (immat == nil)
return;
var glyph = nil;
var immat_size = size(immat);
if (immat_size != 0)
immat = string.uc(immat);
for (var i = 0; i < 6; i += 1) {
if (i >= immat_size)
glyph = -1;
elsif (string.isupper(immat[i]))
glyph = immat[i] - `A`;
elsif (string.isdigit(immat[i]))
glyph = immat[i] - `0` + 26;
else
glyph = 36;
namespace.getNode("sim/model/c172p/regnum"~(i+1), 1).setValue(glyph+1);
}
};