/**
 *  Config class for storing map lists.
 *      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 extends AcediaConfig
    perObjectConfig
    config(AcediaMaps);

var public config array<string> map;

protected function HashTable ToData() {
    local int i;
    local ArrayList commandArray;
    local HashTable result;

    result = _.collections.EmptyHashTable();
    commandArray = _.collections.EmptyArrayList();
    for (i = 0; i < map.length; i += 1) {
        commandArray.AddString(map[i]);
    }
    result.SetItem(P("maps"), commandArray);
    _.memory.Free(commandArray);
    return result;
}

protected function FromData(HashTable source) {
    local int i;
    local ArrayList commandArray;

    if (source == none) {
        return;
    }
    commandArray = source.GetArrayList(P("maps"));
    if (commandArray == none) {
        return;
    }
    map.length = 0;
    for (i = 0; i < commandArray.GetLength(); i += 1) {
        map[map.length] = commandArray.GetString(i);
    }
    _.memory.Free(commandArray);
}

protected function DefaultIt() {
    map.length = 0;
    map[0] = "KF-AbusementPark";
    map[1] = "KF-Aperture";
    map[2] = "KF-Bedlam";
    map[3] = "KF-Biohazard";
    map[4] = "KF-BioticsLab";
    map[5] = "KF-Clandestine";
    map[6] = "KF-Crash";
    map[7] = "KF-Departed";
    map[8] = "KF-EvilSantasLair";
    map[9] = "KF-Farm";
    map[10] = "KF-FilthsCross";
    map[11] = "KF-Forgotten";
    map[12] = "KF-Foundry";
    map[13] = "KF-FrightYard";
    map[14] = "KF-Hell";
    map[15] = "KF-Hellride";
    map[16] = "KF-HillbillyHorror";
    map[17] = "KF-Hospitalhorrors";
    map[18] = "KF-Icebreaker";
    map[19] = "KF-IceCave";
    map[20] = "KF-Manor";
    map[21] = "KF-MoonBase";
    map[22] = "KF-MountainPass";
    map[23] = "KF-Offices";
    map[24] = "KF-SirensBelch";
    map[25] = "KF-Steamland";
    map[26] = "KF-Stronghold";
    map[27] = "KF-Suburbia";
    map[28] = "KF-ThrillsChills";
    map[29] = "KF-Transit";
    map[30] = "KF-Waterworks";
    map[31] = "KF-WestLondon";
    map[32] = "KF-Wyre";
}

defaultproperties {
    configName = "AcediaMaps"
}