54 lines
1.6 KiB
Java
54 lines
1.6 KiB
Java
/*
|
|
* Copyright (C) 2026 welterde
|
|
*
|
|
* This program 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, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
package de.welterde.em.w;
|
|
|
|
import de.welterde.em.EntityBase;
|
|
import de.welterde.em.Location;
|
|
import de.welterde.em.Tile;
|
|
import de.welterde.em.TileMap;
|
|
import de.welterde.em.data.MapCoord;
|
|
import de.welterde.em.data.TerrainGen;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.concurrent.locks.ReadWriteLock;
|
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
|
import de.welterde.em.GameContext;
|
|
|
|
/**
|
|
*
|
|
* @author welterde
|
|
*/
|
|
public class Area extends EntityBase implements TileMap {
|
|
protected final ReadWriteLock structLock;
|
|
|
|
protected final AreaMap map;
|
|
protected final Map<Integer, Location> locations;
|
|
|
|
public Area(AreaSetup setup) {
|
|
this.structLock = new ReentrantReadWriteLock();
|
|
|
|
this.map = new AreaMap(gen);
|
|
this.locations = new HashMap<>();
|
|
}
|
|
|
|
@Override
|
|
public Tile getTile(MapCoord c) {
|
|
return map.getTile(c);
|
|
}
|
|
|
|
|
|
}
|