mirror of
https://github.com/xtreme8000/CavEX.git
synced 2025-01-22 09:11:55 -05:00
Use action icon: check that block type exists first
I saw that yyy257's fork
This commit is contained in:
parent
1b1a37b1df
commit
ca0591f90d
1 changed files with 3 additions and 1 deletions
|
@ -368,12 +368,13 @@ static void screen_ingame_render2D(struct screen* s, int width, int height) {
|
|||
int icon_offset = 32;
|
||||
icon_offset += gutil_control_icon(icon_offset, IB_INVENTORY, "Inventory");
|
||||
icon_offset += gutil_control_icon(icon_offset, IB_JUMP, "Jump");
|
||||
|
||||
if(gstate.camera_hit.hit) {
|
||||
struct item_data item;
|
||||
struct block_data bd
|
||||
= world_get_block(&gstate.world, gstate.camera_hit.x,
|
||||
gstate.camera_hit.y, gstate.camera_hit.z);
|
||||
if(blocks[bd.type]->onRightClick) {
|
||||
if(blocks[bd.type] && blocks[bd.type]->onRightClick) {
|
||||
icon_offset += gutil_control_icon(icon_offset, IB_ACTION2, "Use");
|
||||
} else if(inventory_get_hotbar_item(
|
||||
windowc_get_latest(gstate.windows[WINDOWC_INVENTORY]),
|
||||
|
@ -388,6 +389,7 @@ static void screen_ingame_render2D(struct screen* s, int width, int height) {
|
|||
} else {
|
||||
icon_offset += gutil_control_icon(icon_offset, IB_ACTION1, "Punch");
|
||||
}
|
||||
|
||||
icon_offset += gutil_control_icon(icon_offset, IB_HOME, "Save & quit");
|
||||
|
||||
// draw hotbar
|
||||
|
|
Loading…
Reference in a new issue