mirror of https://git.sr.ht/~kikoodx/momento
raise error when level to load doesn't exist
Better than System Error.
This commit is contained in:
parent
c16a687ccb
commit
1f86fd6ccb
|
@ -46,5 +46,6 @@ printf '%s\n}\n' "$LEVEL_ARRAY"
|
|||
# Create headers
|
||||
cd "$START_POS"
|
||||
mkdir -p generated/include
|
||||
printf '#define LEVEL_COUNT %s\n' "$LEVEL_COUNT" > generated/include/pack_count.h
|
||||
[ "$((LEVEL_COUNT % 4))" != 0 ] && LEVEL_COUNT="$((LEVEL_COUNT + 4 - LEVEL_COUNT % 4))"
|
||||
printf '#define PACK_COUNT %s\n' "$((LEVEL_COUNT / 4))" > generated/include/pack_count.h
|
||||
printf '#define PACK_COUNT %s\n' "$((LEVEL_COUNT / 4))" >> generated/include/pack_count.h
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "conf.h"
|
||||
#include "level.h"
|
||||
#include "pack_count.h"
|
||||
#include "tiles.h"
|
||||
#include <gint/bfile.h>
|
||||
#include <gint/std/stdlib.h>
|
||||
|
@ -89,9 +90,13 @@ void
|
|||
level_load_binary(void)
|
||||
{
|
||||
extern uint8_t *level_binaries[];
|
||||
uint8_t *level_binary = level_binaries[level_id];
|
||||
uint8_t *level_binary;
|
||||
int i;
|
||||
|
||||
assert(level_id < LEVEL_COUNT, "level doesn't exist");
|
||||
|
||||
level_binary = level_binaries[level_id];
|
||||
|
||||
i = LEVEL_SIZE;
|
||||
while (i-- > 0)
|
||||
level.data[i] = level_binary[KBLE_HEADER_LEN + i];
|
||||
|
|
Loading…
Reference in New Issue