aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_sprite.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_get_sprite.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/ft_get_sprite.c b/src/ft_get_sprite.c
index 84feeff..10c6bdd 100644
--- a/src/ft_get_sprite.c
+++ b/src/ft_get_sprite.c
@@ -19,21 +19,21 @@ void
{
size_t x;
size_t y;
- uint8_t i;
+ uint8_t i;
x = 1;
y = 1;
- i = 0;
- while (clist->mlist->map[y])
+ i = 0;
+ while (clist->mlist.map[y])
{
- while (clist->mlist->map[y][x])
+ while (clist->mlist.map[y][x])
{
- if (ft_ischarset("2", clist->mlist->map[y][x]))
+ if (ft_ischarset("2", clist->mlist.map[y][x]))
{
- clist->mlist->sprite_nbr++;
+ clist->mlist.sprite_nbr++;
clist->sprites[i].s_pos_x = x;
clist->sprites[i].s_pos_y = y;
- i++;
+ i++;
}
x++;
}
@@ -47,25 +47,23 @@ int8_t
{
if (!(*words) || !words[1] || words[2])
{
- ft_strlcpy(clist->errmsg, FT_ERR_ARGS, ft_strlen(FT_ERR_ARGS) + 1);
+ ft_sprintf(clist->errmsg, "%s", FT_ERR_ARGS);
return (-1);
}
if (ft_check_ext(*(words + 1), ".xpm") < 0)
{
- ft_strlcpy(clist->errmsg, FT_ERR_NOT_A_XPM,
- ft_strlen(FT_ERR_NOT_A_XPM) + 1);
+ ft_sprintf(clist->errmsg, "%s", FT_ERR_NOT_A_XPM);
return (-1);
}
- ft_memdel((void**)&clist->mlist->sprite_path);
- if (!(clist->mlist->sprite_path = ft_strdup(*(words + 1))))
+ ft_memdel((void**)&clist->mlist.sprite_path);
+ if (!(clist->mlist.sprite_path = ft_strdup(*(words + 1))))
{
- ft_strlcpy(clist->errmsg, FT_ERR_ALLOCATE,
- ft_strlen(FT_ERR_ALLOCATE) + 1);
+ ft_sprintf(clist->errmsg, "%s", FT_ERR_ALLOCATE);
return (-1);
}
- if (ft_check_not_found(clist->mlist->sprite_path) < 0)
+ if (ft_check_not_found(clist->mlist.sprite_path) < 0)
{
- ft_strlcpy(clist->errmsg, FT_ERR_RD_SP, ft_strlen(FT_ERR_RD_SP) + 1);
+ ft_sprintf(clist->errmsg, "%s", FT_ERR_RD_SP);
return (-1);
}
return (0);