aboutsummaryrefslogtreecommitdiff
path: root/src/net/cargo.rs
diff options
context:
space:
mode:
authorArne Dußin2021-01-27 14:01:50 +0100
committerArne Dußin2021-02-02 22:16:15 +0100
commitf92e9f6f07b1e3834c2ca58ce3510734819d08e4 (patch)
tree20e3d3afce342a56ae98f6c20491482ccd2b5c6b /src/net/cargo.rs
parentc60a6d07efb120724b308e29e8e70f27c87c952d (diff)
downloadgraf_karto-f92e9f6f07b1e3834c2ca58ce3510734819d08e4.tar.gz
graf_karto-f92e9f6f07b1e3834c2ca58ce3510734819d08e4.zip
Rework graf karto to fit the client/server structure
Diffstat (limited to 'src/net/cargo.rs')
-rw-r--r--src/net/cargo.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/net/cargo.rs b/src/net/cargo.rs
new file mode 100644
index 0000000..b05944c
--- /dev/null
+++ b/src/net/cargo.rs
@@ -0,0 +1,33 @@
+//! The cargo is information actually concerning the inner workings of graf karto,
+//! as opposed to the inner workings of the network library.
+
+use crate::world::{Icon, Room, Wall, World};
+use nalgebra::Matrix3;
+use serde::{Deserialize, Serialize};
+
+/// Packets sent oven the network will carry this cargo to inform on what the client needs or the
+/// server wants.
+#[derive(Debug, Deserialize, Serialize)]
+pub enum Cargo {
+ /// Client -> Server: Request to add an icon to the map
+ AddIcon(Icon),
+ /// Client -> Server: Request to add a room to the map
+ AddRoom(Room),
+ /// Client -> Server: Request to add a wall to the map
+ AddWall(Wall),
+ /// Client <-> Server: Update the info of the icon with the given id.
+ UpdateIcon((usize, Icon)),
+ /// Client <-> Server: Update the info of the room with the given id.
+ UpdateRoom((usize, Room)),
+ /// Client <-> Server: Update the info of the wall with the given id.
+ UpdateWall((usize, Wall)),
+ /// Client -> Server: Request to apply the given matrix to the item with the provided id.
+ /// If the matrix cannot be applied to an item with the given id, it will do nothing.
+ ApplyMatrix((usize, Matrix3<f64>)),
+ /// Client <-> Remove the item with the given id.
+ Remove(usize),
+ /// Server -> Client: Add all of the data additively to the map
+ AddMapData(World),
+ /// Server -> Client: Clear the current map data of the client and replace it with this.
+ UpdateMapData(World),
+}