check for non-item asset

isolation_bkp/dynres
Dominik Madarász 2021-11-03 16:07:07 +01:00
parent f6bc4d3d44
commit 428e59c69e
3 changed files with 6 additions and 4 deletions

View File

@ -1,11 +1,14 @@
#include "assets.h"
#define ASSET_TEX(asset)\
#define ASSET_ENTRY(asset, asset_kind)\
{\
.id = asset,\
.kind = AKIND_TEXTURE,\
.kind = asset_kind,\
}
#define ASSET_SND(asset) ASSET_ENTRY(asset, AKIND_SOUND)
#define ASSET_TEX(asset) ASSET_ENTRY(asset, AKIND_TEXTURE)
static asset assets[] = {
ASSET_TEX(ASSET_EMPTY),
ASSET_TEX(ASSET_DEMO_ICEMAKER),

View File

@ -85,7 +85,7 @@ ActEraseWorldChanges(void) {
if (l.is_outer && l.block_id > 0) {
asset_id item_asset = blocks_get_asset(l.block_id);
if (item_asset == ASSET_INVALID) continue;
if (item_find(item_asset) == ASSET_INVALID) continue;
uint64_t e = item_spawn(item_asset, 1);
Position *dest = ecs_get_mut(world_ecs(), e, Position, NULL);

View File

@ -42,7 +42,6 @@ uint16_t item_find(asset_id kind) {
if (items[i].kind == kind)
return item_resolve_proxy(i);
}
return ASSET_INVALID;
}