There are multiple situations when server may decide to send this message. This message either enforces unit position, or requests to shorten previously declared unit path. Enforcement normally happens when player attempts to perform forbidden action (e.g., transitioning to non-passable unit). Shortening of the path is a very common operation which means unit wants to change its initial path.
struct s2c_unit_stop_t {
char type; // MSG_S2C_UNIT_STOP
int owner_id; // ID of the player owning the unit
int unit_id; // ID of the unit which is unique across all units
int stop_reason; // The reason for the stop
int row; // (row, column) - stop poit for the unit
int column;
};
The following stop reasons are supported:
const int STOP_REASON_INVALID_PATH = 0;
const int STOP_REASON_TILE_NOT_AVAILABLE = 1;
const int STOP_REASON_ARRIVED = 2;
const int STOP_REASON_CANCELLED = 3;
STOP_REASON_INVALID_PATH
Server validated path that client sent in C2S::UNIT_COMMAND and rejected it as invalid. (row, column)
β valid position of the unit.
STOP_REASON_TILE_NOT_AVAILABLE
Unit attempts to perform transition to a tile which is not available (it is occupied by another unit or not passable at all). (row, column)
β the last valid point on a path. However, it is at transition point, not at the center of the tile. State of the unit changes from MOVING to MOVEMENT_BLOCKED.
STOP_REASON_ARRIVED
Unit arrived at the destination point. (row, column)
β refers to a point where unit stopped and transitioned from MOVING state to STOPPED.
STOP_REASON_CANCELLED
Unit keeps moving, however player owning the unit sent stop request to shorten previously declared movement trajectory. Client receiving this message must shorten the path of the unit up until (row, column)
point (including it). The point must be a part of the previously declared path, otherwise it is server error.