FormList Pseudocode
Jump to navigation
Jump to search
Pseudocode for the FormList's Papyrus functions by Glitchfinder, uploaded at their request.
class FormList
OrderedList scriptForms;
OrderedList pluginForms;
FormList(OrderedList plugin) {
scriptForms = new OrderedList();
pluginForms = plugin;
}
void AddForm(Form newForm) {
if (scriptForms.Contains(newForm))
return;
scriptForms.Append(newForm);
}
int Find(Form findForm) {
if (scriptForms.Contains(findForm))
return scriptForms.IndexOf(findForm);
if (pluginForms.Contains(findForm))
return scriptForms.Length + pluginForms.IndexOf(findForm);
return -1;
}
Form GetAt(int formIndex) {
if (scriptForms.Length > formIndex)
return scriptForms[formIndex];
formIndex -= scriptForms.Length;
if (pluginForms.Length > formIndex)
return pluginForms[formIndex];
return None;
}
int GetSize() {
// Untested, therefore, an assumption
return scriptForms.Length + pluginForms.Length;
}
bool HasForm(Form testForm) {
if (scriptForms.Contains(testForm))
return true;
return pluginForms.Contains(testForm);
}
void RemoveAddedForm(Form removeForm) {
scriptForms.Remove(removeForm);
}
void Revert() {
scriptForms.Clear()
}
}