diff --git a/inc/custom_msg.h b/inc/custom_msg.h index e3a8c3c..08e5629 100644 --- a/inc/custom_msg.h +++ b/inc/custom_msg.h @@ -1,7 +1,7 @@ #ifndef CUSTOM_MSG_H #define CUSTOM_MSG_H -#include +#include //FIXME: non penso vada incluso ma serve al momento #define MAX_NAME 16 diff --git a/src/custom_msg.c b/src/custom_msg.c index df532d0..0da9bc6 100644 --- a/src/custom_msg.c +++ b/src/custom_msg.c @@ -8,4 +8,44 @@ void rcvMsg(msg_t *msg) { if (msgrcv(_MSGQID, msg, sizeof(msg_t) - sizeof(long), 1, 0) == -1) { errExitMsg("msgrcv"); } -} \ No newline at end of file +} + +void rcvMove(move_t *move) { + if (msgrcv(_MSGQID, move, sizeof(move_t) - sizeof(long), 2, 0) == -1) { + errExitMsg("msgrcv"); + } +} +void rcvPlayer(player_ds *player) { + if (msgrcv(_MSGQID, player, sizeof(player_ds) - sizeof(long), 3, 0) == -1) { + errExitMsg("msgrcv"); + } +} +void rcvGame_end(game_end_t *game) { + if (msgrcv(_MSGQID, game, sizeof(game_end_t) - sizeof(long), 4, 0) == -1) { + errExitMsg("msgrcv"); + } +} + + +void sndMsg(msg_t *msg) { + if (msgsnd(_MSGQID, msg, sizeof(msg_t) - sizeof(long), 0) == -1) { + errExitMsg("msgsnd"); + } +} + +void sndMove(move_t *move) { + if (msgsnd(_MSGQID, move, sizeof(move_t) - sizeof(long), 0) == -1) { + errExitMsg("msgsnd"); + } +} +void sndPlayer(player_ds *player) { + if (msgsnd(_MSGQID, player, sizeof(player_ds) - sizeof(long), 0) == -1) { + errExitMsg("msgsnd"); + } +} +void sndGame_end(game_end_t *game) { + if (msgsnd(_MSGQID, game, sizeof(game_end_t) - sizeof(long), 0) == -1) { + errExitMsg("msgsnd"); + } +} +