summaryrefslogtreecommitdiff
path: root/NET/worlds/network/SubscribeDistCmd.java
blob: 33066a74a069bcc55f0cc4dde43a7909cd8726e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package NET.worlds.network;

import java.io.IOException;

public class SubscribeDistCmd extends netPacket {
   public static final byte SUBSCRIBEDISTCMD = 24;
   protected short _distance;
   protected short _roomNumber;

   public SubscribeDistCmd(float dist, int room) {
      super(null, 24);
      this._distance = (short)(dist - 100.0F);
      this._roomNumber = (short)room;
   }

   @Override
   int packetSize() {
      return 4 + super.packetSize();
   }

   @Override
   void send(ServerOutputStream o) throws IOException {
      super.send(o);
      o.writeShort(this._roomNumber);
      o.writeShort(this._distance);
   }

   @Override
   public String toString(WorldServer serv) {
      return "SUB-DIST " + this._roomNumber + ":  " + this._distance + "cm";
   }
}