summaryrefslogtreecommitdiff
path: root/blocks.ha
blob: d9a304854ddeb198213ee89a48f6e4c9b815e485 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
type BlockId = u32;

let BLOCKS = IDREG_EMPTY;

fn destroy_blocks() void = {
	idreg_clear(&BLOCKS);
};

fn blocks_register(ident: str) BlockId = {
	const blk = idreg_register(&BLOCKS, ident);
	bstates_handle_blocks_onregister(blk);
	return blk;
};

fn blocks_count() u32 = idreg_count(&BLOCKS);

fn block_getident(blk: BlockId) str =
	idreg_getname(&BLOCKS, blk);