custom_msg rcv and snd
This commit is contained in:
parent
9f4df5f1aa
commit
2018d64eee
|
@ -1,7 +1,7 @@
|
|||
#ifndef CUSTOM_MSG_H
|
||||
#define CUSTOM_MSG_H
|
||||
|
||||
#include <server.h>
|
||||
#include <server.h> //FIXME: non penso vada incluso ma serve al momento
|
||||
|
||||
#define MAX_NAME 16
|
||||
|
||||
|
|
|
@ -8,4 +8,44 @@ void rcvMsg(msg_t *msg) {
|
|||
if (msgrcv(_MSGQID, msg, sizeof(msg_t) - sizeof(long), 1, 0) == -1) {
|
||||
errExitMsg("msgrcv");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue