1
0
Fork 0
A320-family/Nasal/Systems/Comm/CPDLC.nas
legoboyvdlp R 6801002120 Nothing
2020-08-03 17:50:08 +01:00

48 lines
No EOL
966 B
Text

# A3XX CPDLC
# Jonathan Redpath
# Copyright (c) 2020 Josh Davidson (Octal450)
var DictionaryItem = {
new: func(item, string) {
var DI = {parents: [DictionaryItem]};
DI.item = item;
DI.string = string;
return DI;
},
};
var Dictionary = {
database: std.Vector.new(),
addToDatabase: func(dictItem) {
me.database.append(dictItem);
},
fetchString: func(string) {
foreach (var item; me.database.vector) {
if (me.item.string == string) {
return item;
}
}
},
fetchItem: func(itemObj) {
foreach (var item; me.database.vector) {
if (item.item == itemObj) {
return item;
}
}
},
};
makeNewDictionaryItem = func(item, string) {
var dictItem = DictionaryItem.new(item, string);
Dictionary.addToDatabase(dictItem);
};
var CPDLCmessage = {
new: func(text) {
var cpdlcMessage = {parents: [CPDLCmessage] };
cpdlcMessage.text = text;
return cpdlcMessage;
},
};
makeNewDictionaryItem(CPDLCmessage.new("CONNECT"), "CONNECT");