Browse Source

Change `MapList` to regular `AcediaConfig`

pull/2/head
Anton Tarasenko 2 years ago
parent
commit
0ae9e0571d
  1. 17
      sources/MapList/MapList.uc
  2. 25
      sources/MapList/MapList_Feature.uc

17
sources/MapList/MapList.uc

@ -18,7 +18,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with Acedia. If not, see <https://www.gnu.org/licenses/>. * along with Acedia. If not, see <https://www.gnu.org/licenses/>.
*/ */
class MapList extends FeatureConfig class MapList extends AcediaConfig
perObjectConfig perObjectConfig
config(AcediaMaps); config(AcediaMaps);
@ -31,14 +31,11 @@ protected function HashTable ToData() {
result = _.collections.EmptyHashTable(); result = _.collections.EmptyHashTable();
mapArray = _.collections.EmptyArrayList(); mapArray = _.collections.EmptyArrayList();
for (i = 0; i < map.length; i += 1) { for (i = 0; i < map.length; i += 1) {
mapArray.AddString(map[i]); mapArray.AddString(map[i]);
} }
result.SetItem(P("maps"), mapArray); result.SetItem(P("maps"), mapArray);
_.memory.Free(mapArray); _.memory.Free(mapArray);
return result; return result;
} }
@ -49,12 +46,10 @@ protected function FromData(HashTable source) {
if (source == none) { if (source == none) {
return; return;
} }
mapArray = source.GetArrayList(P("maps")); mapArray = source.GetArrayList(P("maps"));
if (mapArray == none) { if (mapArray == none) {
return; return;
} }
map.length = 0; map.length = 0;
for (i = 0; i < mapArray.GetLength(); i += 1) { for (i = 0; i < mapArray.GetLength(); i += 1) {
map[map.length] = mapArray.GetString(i); map[map.length] = mapArray.GetString(i);
@ -63,11 +58,11 @@ protected function FromData(HashTable source) {
} }
protected function DefaultIt() { protected function DefaultIt() {
map[0] = "KF-BioticsLab"; map[0] = "KF-BioticsLab";
map[1] = "KF-Farm"; map[1] = "KF-Farm";
map[2] = "KF-Manor"; map[2] = "KF-Manor";
map[3] = "KF-Offices"; map[3] = "KF-Offices";
map[4] = "KF-WestLondon"; map[4] = "KF-WestLondon";
} }
defaultproperties { defaultproperties {

25
sources/MapList/MapList_Feature.uc

@ -1,25 +0,0 @@
/**
* This feature is a dumb proxy for loading map list configs.
* Copyright 2023 Anton Tarasenko
* 2023 Shtoyan
*------------------------------------------------------------------------------
* This file is part of Acedia.
*
* Acedia is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License, or
* (at your option) any later version.
*
* Acedia is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Acedia. If not, see <https://www.gnu.org/licenses/>.
*/
class MapList_Feature extends Feature;
defaultproperties {
configClass = class'MapList'
}
Loading…
Cancel
Save