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() { protected function HashTable ToData() {
local int i; local int i;
local ArrayList mapArray; local ArrayList commandArray;
local HashTable result; local HashTable result;
result = _.collections.EmptyHashTable(); result = _.collections.EmptyHashTable();
mapArray = _.collections.EmptyArrayList(); commandArray = _.collections.EmptyArrayList();
for (i = 0; i < map.length; i += 1) { for (i = 0; i < map.length; i += 1) {
mapArray.AddString(map[i]); commandArray.AddString(map[i]);
} }
result.SetItem(P("maps"), mapArray); result.SetItem(P("maps"), commandArray);
_.memory.Free(mapArray); _.memory.Free(commandArray);
return result; return result;
} }
protected function FromData(HashTable source) { protected function FromData(HashTable source) {
local int i; local int i;
local ArrayList mapArray; local ArrayList commandArray;
if (source == none) { if (source == none) {
return; return;
} }
mapArray = source.GetArrayList(P("maps")); commandArray = source.GetArrayList(P("maps"));
if (mapArray == none) { if (commandArray == none) {
return; return;
} }
map.length = 0; map.length = 0;
for (i = 0; i < mapArray.GetLength(); i += 1) { for (i = 0; i < commandArray.GetLength(); i += 1) {
map[map.length] = mapArray.GetString(i); map[map.length] = commandArray.GetString(i);
} }
_.memory.Free(mapArray); _.memory.Free(commandArray);
} }
protected function DefaultIt() { protected function DefaultIt() {

Loading…
Cancel
Save