-
Notifications
You must be signed in to change notification settings - Fork 0
/
room.c
40 lines (35 loc) · 1.35 KB
/
room.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* room.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: alex <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/07 15:22:27 by alex #+# #+# */
/* Updated: 2020/05/14 20:14:17 by alex ### ########.fr */
/* */
/* ************************************************************************** */
#include "./includes/lem_in.h"
t_room *room_new(void)
{
t_room *room;
room = ft_malloc_or_exit(sizeof(t_room));
room->links = NULL;
room->distance = INFINITY;
room->parent = NULL;
room->pred = NULL;
room->succ = NULL;
return (room);
}
t_room *room_find(t_list const *rooms, char const *room_name)
{
t_room *room;
while (rooms != NULL)
{
room = rooms->data;
if (ft_strcmp(room->name, room_name) == 0)
return (room);
rooms = rooms->next;
}
return (NULL);
}