{"size": 1564, "ext": "js", "max_stars_repo_path": "static/editors/map/js/UpdateMap.js", "max_stars_repo_name": "TrashPony/Veliri", "max_stars_repo_stars_event_min_datetime": "2017-10-30T09:23:09.000Z", "max_stars_repo_stars_event_max_datetime": "2021-03-29T22:24:12.000Z", "max_issues_repo_path": "static/editors/map/js/UpdateMap.js", "max_issues_repo_name": "TrashPony/Veliri", "max_issues_repo_issues_event_min_datetime": "2018-12-17T11:05:10.000Z", "max_issues_repo_issues_event_max_datetime": "2019-11-24T09:29:09.000Z", "max_forks_repo_path": "static/editors/map/js/UpdateMap.js", "max_forks_repo_name": "TrashPony/Veliri", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 13, "max_issues_count": 19, "max_forks_count": null, "avg_line_length": 25.2258064516, "max_line_length": 56, "alphanum_fraction": 0.6457800512}
function UpdateMap(newMap, game) {

    removeSubMenus();

    let clear = function (group) {
        while (group && group.children.length > 0) {
            let sprite = group.children.shift();
            sprite.destroy();
        }
    };

    game.map = newMap;

    clear(game.floorLayer);
    clear(game.floorObjectSelectLineLayer);
    clear(game.floorSelectLineLayer);
    clear(game.floorObjectLayer);
    clear(game.floorOverObjectLayer);
    clear(game.redactorButton);
    clear(game.redactorMetaText);
    clear(game.unitLayer);
    clear(game.effectsLayer);
    clear(game.artilleryBulletLayer);
    clear(game.weaponEffectsLayer);
    clear(game.flyObjectsLayer);
    clear(game.cloudsLayer);
    clear(game.fogOfWar);
    clear(game.geoDataLayer);
    clear(game.icon);

    CreateMiniMap();
    CreateMap();
}

function clear(group) {
    while (group && group.children.length > 0) {
        let sprite = group.children.shift();
        sprite.destroy();
    }
}

function removeSubMenus() {
    if (document.getElementById("menuBlock")) {
        document.getElementById("menuBlock").remove();
    }

    if (document.getElementById("typeTip")) {
        document.getElementById("typeTip").remove()
    }

    if (document.getElementById("notification")) {
        document.getElementById("notification").remove()
    }

    if (document.getElementById("changeType")) {
        document.getElementById("changeType").remove()
    }

    if (document.getElementById("rotateBlock")) {
        document.getElementById("rotateBlock").remove()
    }
}