31 lines
690 B
C
31 lines
690 B
C
//
|
|
// Created by rov on 12/26/25.
|
|
//
|
|
|
|
#include "map.h"
|
|
|
|
#include <stdlib.h>
|
|
#include <SDL3/SDL.h>
|
|
|
|
bool Map_Init(Map_t *map) {
|
|
// TODO: fix this magical numbers
|
|
map->mapData = malloc(29070);
|
|
map->mapAuxData = malloc(855);
|
|
|
|
if (map->mapData == NULL || map->mapAuxData == NULL) {
|
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "Map_Init: couldn't allocate memory.", NULL);
|
|
return false;
|
|
}
|
|
|
|
SDL_LogInfo(SDL_LOG_CATEGORY_CUSTOM, "Map_Init: memory allocated.");
|
|
|
|
return true;
|
|
}
|
|
|
|
void Map_Destroy(const Map_t *map) {
|
|
free(map->mapData);
|
|
free(map->mapAuxData);
|
|
|
|
SDL_LogInfo(SDL_LOG_CATEGORY_CUSTOM, "Map_Destroy: memory freed.");
|
|
}
|