summaryrefslogtreecommitdiff
path: root/NET/worlds/network/shortLocCmd.java
blob: 80463a8fa98bc45603492270c35f330dbce994d7 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
package NET.worlds.network;

import NET.worlds.scape.Drone;
import java.io.IOException;

public class shortLocCmd extends receivedNetPacket {
   public static final byte SHORTLOCCMD = 4;
   protected byte _dx;
   protected byte _dy;
   protected byte _ddirection;

   public shortLocCmd() {
      this._commandType = 4;
   }

   @Override
   void parseNetData(ServerInputStream data) throws IOException {
      this._dx = data.readByte();
      this._dy = data.readByte();
      this._ddirection = data.readByte();
   }

   @Override
   void process(WorldServer _serv) throws Exception {
      NetworkObject o = _serv.getObject(this._objID);
      if (o == null) {
         System.out.println("Unknown short id: " + this.toString(_serv));
         new Exception().printStackTrace(System.out);
      } else {
         if (o instanceof Drone) {
            ((Drone)o).shortLoc(this._dx, this._dy, this._ddirection);
         }
      }
   }

   @Override
   public String toString(WorldServer serv) {
      return "SHORTLOC " + this._objID.toString(serv) + " delta=" + this._dx + "," + this._dy + "," + this._ddirection;
   }

   @Override
   public String toString() {
      return "SHORTLOC " + this._objID + " delta=" + this._dx + "," + this._dy + "," + this._ddirection;
   }
}