Browse Source

Fix config - data conversion for masp lists

develop
Anton Tarasenko 1 year ago
parent
commit
1dca6ccbd8
  1. 22
      sources/MapList/MapList.uc

22
sources/MapList/MapList.uc

@ -26,35 +26,35 @@ var public config array<string> map;
protected function HashTable ToData() {
local int i;
local ArrayList mapArray;
local ArrayList commandArray;
local HashTable result;
result = _.collections.EmptyHashTable();
mapArray = _.collections.EmptyArrayList();
commandArray = _.collections.EmptyArrayList();
for (i = 0; i < map.length; i += 1) {
mapArray.AddString(map[i]);
commandArray.AddString(map[i]);
}
result.SetItem(P("maps"), mapArray);
_.memory.Free(mapArray);
result.SetItem(P("maps"), commandArray);
_.memory.Free(commandArray);
return result;
}
protected function FromData(HashTable source) {
local int i;
local ArrayList mapArray;
local ArrayList commandArray;
if (source == none) {
return;
}
mapArray = source.GetArrayList(P("maps"));
if (mapArray == none) {
commandArray = source.GetArrayList(P("maps"));
if (commandArray == none) {
return;
}
map.length = 0;
for (i = 0; i < mapArray.GetLength(); i += 1) {
map[map.length] = mapArray.GetString(i);
for (i = 0; i < commandArray.GetLength(); i += 1) {
map[map.length] = commandArray.GetString(i);
}
_.memory.Free(mapArray);
_.memory.Free(commandArray);
}
protected function DefaultIt() {

Loading…
Cancel
Save