Dumik 7 Posted July 21, 2014 Share Posted July 21, 2014 Hello everybody, i have a problem with new funtion in error log i have this: char_item.cpp: In member function 'bool CHARACTER::helpCountBeltSpecifyItem(DWORD, int) const': char_item.cpp:6422: error: invalid conversion from 'const CHARACTER* const' to 'CHARACTER*' char_item.cpp:6422: error: initializing argument 1 of 'static bool CBeltInventoryHelper::IsItemInSlotBeltInventory(CHARACTER*, DWORD, int)' this is the function from char_item.cpp int CHARACTER::CountBeltSpecifyItem(DWORD vnum) const { int count = 0; LPITEM item; LPITEM beltItem = GetWear(WEAR_BELT); if (beltItem != NULL) // if belt is equip { for (int i = BELT_INVENTORY_SLOT_START; i < BELT_INVENTORY_SLOT_END; ++i) { if (!helpCountBeltSpecifyItem(vnum, i)) { continue; } else { count += item->GetCount(); } } } return count; } bool CHARACTER::helpCountBeltSpecifyItem(DWORD vnum, int i) const { line 6422 ->if (CBeltInventoryHelper::IsItemInSlotBeltInventory(this, vnum, i)) return true; else return false; } belt_inventory_helper.cpp static bool IsItemInSlotBeltInventory(LPCHARACTER pc, DWORD vnum, int target_cell) { if(pc == NULL) return false; if(vnum == NULL) { pc->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ERROR! [belt_inventory_helper] No vnum specified!")); return false; } if(target_cell == NULL) { pc->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ERROR! [belt_inventory_helper] No target cell specified!")); return false; } LPITEM beltInventoryItem = pc->GetInventoryItem(target_cell); //pc->GetInventoryItem(i) if(beltInventoryItem->GetVnum()) return true; return false; } Thanks for any help Link to comment Share on other sites More sharing options...
Think 117 Posted July 24, 2014 Share Posted July 24, 2014 Because you are in a const function, you are not allowed to modify this, yet you are passing it to a function that treats it as a plain CHARACTER pointer, not constant. That is what you can't do. Remove the const at the end of the declaration helpCountBeltSpecifyItem. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now