Silence warnings

This commit is contained in:
mibi88 2025-07-02 19:48:25 +02:00
parent 5e39e9c8ab
commit 471b35d605
No known key found for this signature in database
2 changed files with 21 additions and 59 deletions

View file

@ -1,41 +0,0 @@
{
"maps": [
{
"fileName": "level0.tmx",
"height": 192,
"width": 384,
"x": 0,
"y": 0
},
{
"fileName": "level1.tmx",
"height": 192,
"width": 384,
"x": 384,
"y": 0
},
{
"fileName": "level2.tmx",
"height": 192,
"width": 384,
"x": 0,
"y": 192
},
{
"fileName": "level3.tmx",
"height": 192,
"width": 384,
"x": 384,
"y": 192
},
{
"fileName": "level4.tmx",
"height": 192,
"width": 384,
"x": 384,
"y": 384
}
],
"onlyShowAdjacentMaps": false,
"type": "world"
}

View file

@ -22,13 +22,13 @@ void inventory_init(Inventory *inventory) {
}
void inventory_draw(Inventory *inventory, Player *player) {
size_t i;
char i;
if(inventory->open) {
dimage(0, 0, &inventory_img);
for(i = 0; i < SLOT_NUM; i++) {
dsubimage(SLOT_X + (i % SLOT_COLUMNS) * SLOT_SPACING,
SLOT_Y + (i / SLOT_COLUMNS) * SLOT_SPACING, &items_img,
inventory->slots[i].i * SLOT_W, 0, SLOT_W, SLOT_H,
inventory->slots[(int)i].i * SLOT_W, 0, SLOT_W, SLOT_H,
DIMAGE_NONE);
if(i == inventory->selection) {
dimage(SLOT_X + (i % SLOT_COLUMNS) * SLOT_SPACING,
@ -43,8 +43,8 @@ void inventory_draw(Inventory *inventory, Player *player) {
}
for(i = 0; i < 3; i++) {
dsubimage(SLOT_X_EQUIPPED, SLOT_Y + i * SLOT_SPACING, &items_img,
inventory->equipped[i].i * SLOT_W, 0, SLOT_W, SLOT_H,
DIMAGE_NONE);
inventory->equipped[(int)i].i * SLOT_W, 0, SLOT_W,
SLOT_H, DIMAGE_NONE);
}
#if GINT_RENDER_RGB
/* Render the player between the two swords if we are on cg. */
@ -70,23 +70,26 @@ char inventory_add(Inventory *inventory, Item item) {
void inventory_move_from_selected(Inventory *inventory) {
if(inventory->selected < 0)
return;
Slot current = inventory->slots[inventory->selection];
Slot new = inventory->slots[inventory->selected];
inventory->slots[inventory->selection] = new;
inventory->slots[inventory->selected] = current;
Slot current = inventory->slots[(int)inventory->selection];
Slot new = inventory->slots[(int)inventory->selected];
inventory->slots[(int)inventory->selection] = new;
inventory->slots[(int)inventory->selected] = current;
}
void inventory_use(Inventory *inventory, Player *player) {
Item item = inventory->slots[inventory->selection].i;
Item item = inventory->slots[(int)inventory->selection].i;
(void)player;
switch(item_types[item]) {
case IT_TALISMAN:
inventory->equipped[0] = inventory->slots[inventory->selection];
inventory->equipped[0] = inventory->slots[(int)inventory->selection];
break;
case IT_ARMOR:
inventory->equipped[1] = inventory->slots[inventory->selection];
inventory->equipped[1] = inventory->slots[(int)inventory->selection];
break;
case IT_WEAPON:
inventory->equipped[2] = inventory->slots[inventory->selection];
inventory->equipped[2] = inventory->slots[(int)inventory->selection];
break;
case IT_FOOD:
/* TODO */
@ -94,26 +97,26 @@ void inventory_use(Inventory *inventory, Player *player) {
default:
break;
}
inventory->slots[inventory->selection].i = I_NONE;
inventory->slots[inventory->selection].durability = 255;
inventory->slots[(int)inventory->selection].i = I_NONE;
inventory->slots[(int)inventory->selection].durability = 255;
}
void inventory_unequip(Inventory *inventory, ItemType type) {
if(inventory->slots[inventory->selection].i)
if(inventory->slots[(int)inventory->selection].i)
return;
switch(type) {
case IT_TALISMAN:
inventory->slots[inventory->selection] = inventory->equipped[0];
inventory->slots[(int)inventory->selection] = inventory->equipped[0];
inventory->equipped[0].i = I_NONE;
inventory->equipped[0].durability = 255;
break;
case IT_ARMOR:
inventory->slots[inventory->selection] = inventory->equipped[1];
inventory->slots[(int)inventory->selection] = inventory->equipped[1];
inventory->equipped[1].i = I_NONE;
inventory->equipped[1].durability = 255;
break;
case IT_WEAPON:
inventory->slots[inventory->selection] = inventory->equipped[2];
inventory->slots[(int)inventory->selection] = inventory->equipped[2];
inventory->equipped[2].i = I_NONE;
inventory->equipped[2].durability = 255;
break;