Okay so I tried to make a getter for the positions of a layer.
Is it any good? Should I improve something?
Code:
int TLN_GetLayerPosX(int nlayer)
{
Layer* layer;
if (nlayer >= engine->numlayers)
{
TLN_SetLastError(TLN_ERR_IDX_LAYER);
return 0;
}
layer = &engine->layers[nlayer];
if (layer->width == 0 || layer->height == 0)
{
TLN_SetLastError(TLN_ERR_REF_TILEMAP);
return 0;
}
TLN_SetLastError(TLN_ERR_OK);
if ((layer->tilemap && layer->tilemap->visible) || (layer->objects && layer->objects->visible))
layer->ok = true;
return layer->hstart;
}
int TLN_GetLayerPosY(int nlayer)
{
Layer* layer;
if (nlayer >= engine->numlayers)
{
TLN_SetLastError(TLN_ERR_IDX_LAYER);
return 0;
}
layer = &engine->layers[nlayer];
if (layer->width == 0 || layer->height == 0)
{
TLN_SetLastError(TLN_ERR_REF_TILEMAP);
return 0;
}
TLN_SetLastError(TLN_ERR_OK);
if ((layer->tilemap && layer->tilemap->visible) || (layer->objects && layer->objects->visible))
layer->ok = true;
return layer->vstart;
}
Is it any good? Should I improve something?