35 lines
969 B
C
35 lines
969 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
|
|
#include <l3tde/map.h>
|
|
#include <l3tde/map/warp.h>
|
|
|
|
L3TDEMapWarpPtr
|
|
l3tde_map_warp_create (L3TDEMapPtr parent,
|
|
size_t destination_map,
|
|
bool can_be_crossed,
|
|
size_t location_x, size_t location_y,
|
|
size_t destination_warp_number) {
|
|
L3TDEMapWarpPtr self = malloc (sizeof *self);
|
|
self->parent = parent;
|
|
self->destination_map = destination_map;
|
|
self->can_be_crossed = can_be_crossed;
|
|
self->location_x = location_x;
|
|
self->location_y = location_y;
|
|
if (!(parent->nodes_x_len > self->location_x)
|
|
|| !(parent->nodes_y_len > self->location_y) ) {
|
|
// TODO: Add more possible bug information.
|
|
// TODO: Log to a file?
|
|
fprintf (stderr, "The warp is out of the map.");
|
|
}
|
|
self->destination_warp_number = destination_warp_number;
|
|
|
|
return self;
|
|
}
|
|
|
|
void
|
|
l3tde_map_warp_destroy (L3TDEMapWarpPtr warp) {
|
|
free (warp);
|
|
}
|