Ejemplo n.º 1
0
 public void RemoveEntranceExit(AmusementPath p) {
     pathRWLock.EnterWriteLock();
     amusRWLock.EnterWriteLock();
     try {
         pathMap[p.coord.x][p.coord.y] = null;
         amusementMap[p.coord.x][p.coord.y] = null;
         if (pathMap[p.coord.x - 1][p.coord.y] != null) pathMap[p.coord.x - 1][p.coord.y].signpostAmus[p.amusement.Id] = Direction.no;
         if (pathMap[p.coord.x + 1][p.coord.y] != null) pathMap[p.coord.x + 1][p.coord.y].signpostAmus[p.amusement.Id] = Direction.no;
         if (pathMap[p.coord.x][p.coord.y - 1] != null) pathMap[p.coord.x][p.coord.y - 1].signpostAmus[p.amusement.Id] = Direction.no;
         if (pathMap[p.coord.x][p.coord.y + 1] != null) pathMap[p.coord.x][p.coord.y + 1].signpostAmus[p.amusement.Id] = Direction.no;
     }
     finally {
         pathRWLock.ExitWriteLock();
         amusRWLock.ExitWriteLock();
     }
     pathChanged = true; //important that it is set after changing pathMap
 }
Ejemplo n.º 2
0
 public void AddEntranceExit(AmusementPath p) {
     pathRWLock.EnterWriteLock();
     amusRWLock.EnterWriteLock();
     try {
         pathMap[p.coord.x][p.coord.y] = p;
         amusementMap[p.coord.x][p.coord.y] = p.amusement;
     }
     finally {
         pathRWLock.ExitWriteLock();
         amusRWLock.ExitWriteLock();
     }
     pathChanged = true; //important that it is set after changing pathMap
 }