23 package com.realtime.crossfire.jxclient.map;
30 import java.util.Collection;
31 import java.util.Collections;
32 import java.util.HashSet;
33 import java.util.Iterator;
35 import org.jetbrains.annotations.NotNull;
92 private final Set<Location>
locations =
new HashSet<>();
98 private final Collection<Integer>
tags =
new HashSet<>();
121 final int effectiveSpeed = Math.max(1,
speed);
122 if (this.speed == effectiveSpeed) {
126 final int tmpDelay = Math.min(
index%this.speed, effectiveSpeed-1);
127 this.speed = effectiveSpeed;
128 index = tmpIndex*effectiveSpeed+tmpDelay;
146 if (tickNo < this.tickNo) {
147 System.err.println(
"Ignoring inconsistent tick value: current tick number is "+
tickNo+
", previous tick number was "+this.tickNo+
".");
168 for (
int tag :
tags) {
169 itemSet.
updateItem(
UpdItem.
UPD_FACE, tag, 0, 0, 0, face2,
"",
"", 0, 0, 0);
179 throw new IllegalArgumentException(
"duplicate location "+location);
191 if (!
tags.add(tag)) {
192 throw new IllegalArgumentException(
"duplicate item tag "+tag);
195 itemSet.
updateItem(
UpdItem.
UPD_FACE, tag, 0, 0, 0,
facesManager.
getFace(
lastFace),
"",
"", 0, 0, 0);
205 throw new IllegalArgumentException(
"undefined location "+location);
220 public void free(
final int tag) {
221 if (!
tags.remove(tag)) {
222 throw new IllegalArgumentException(
"undefined item tag "+tag);
229 return Collections.unmodifiableSet(
locations).iterator();
239 public void scroll(
final int dx,
final int dy,
final int width,
final int height) {
240 final Collection<Location> tmp =
new HashSet<>();
242 if (0 <= location.getX() && location.getX() < width && 0 <= location.getY() && location.getY() < height) {
243 final int newX = location.getX()-dx;
244 final int newY = location.getY()-dy;
245 if (0 <= newX && newX < width && 0 <= newY && newY < height) {
247 tmp.add(newLocation);