1
0
Fork 0
This commit is contained in:
legoboyvdlp R 2020-08-03 17:50:08 +01:00
parent 3a43829772
commit 6801002120

View file

@ -0,0 +1,48 @@
# 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");