Advertisement
atm959

It's not working...

Jan 26th, 2019
480
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. void sortInventory(Inventory* inventory){
  2.     Inventory temp;
  3.     //Copy the inventory to "temp"
  4.     for(int i = 0; i < 10; i++){
  5.         temp.items[i] = inventory->items[i];
  6.         temp.quantity[i] = inventory->quantity[i];
  7.     }
  8.     //Finally, sort based on item IDs
  9.     for(int i = 0; i < 10; i++){
  10.         for(int j = 0; j < 256; j++){
  11.             if(temp.items[i] == j){
  12.                 inventory->items[i] = temp.items[i];
  13.                 inventory->quantity[i] = temp.quantity[i];
  14.             }
  15.         }
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement