custom_msg rcv and snd

This commit is contained in:
Lorenzo Bianchi 2023-05-18 14:31:50 +02:00
parent ecddeb7bc9
commit b39fe5f699
1 changed files with 3 additions and 14 deletions

View File

@ -7,29 +7,18 @@ if (msgrcv(_MSGQID, msgp, size, mtype, 0) == -1) {
}
}
void rcvMsg(msg_t *msg) {
msgRcv(msg, sizeof(msg_t) - sizeof(long), 1);
}
void rcvMove(move_t *move) {
msgRcv(_MSGQID, , sizeof() - sizeof(long), , 0);
if (msgrcv(_MSGQID, move, sizeof(move_t) - sizeof(long), 2, 0) == -1) {
errExitMsg("msgrcv");
}
msgRcv(move, sizeof(move_t) - sizeof(long), 2);
}
void rcvPlayer(player_ds *player) {
msgRcv(_MSGQID, , sizeof() - sizeof(long), , 0);
if (msgrcv(_MSGQID, player, sizeof(player_ds) - sizeof(long), 3, 0) == -1) {
errExitMsg("msgrcv");
}
msgRcv(player, sizeof(player_ds) - sizeof(long), 3);
}
void rcvGame_end(game_end_t *game) {
msgRcv(_MSGQID, , sizeof() - sizeof(long), , 0);
if (msgrcv(_MSGQID, game, sizeof(game_end_t) - sizeof(long), 4, 0) == -1) {
errExitMsg("msgrcv");
}
msgRcv(game, sizeof(game_end_t) - sizeof(long), 4);
}