Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- Players *ptr = list;
- while(ptr != NULL) //runs until the list reaches NULL
- {
- if (strcmp(ptr->name, p) == 0) //if the name and player are the same, keep going
- {
- Items *ptr2 = (Items *)malloc(sizeof(Items));
- Items *ptr3 = ptr->things;
- while(ptr3 !=NULL) //keeps running until ptr = NULL
- {
- if (strcmp(ptr3->name, item)==0) //Got this part from a friend, no clue what this does until line 65
- {
- ptr3->count += num;
- return;
- }
- else
- {
- ptr3 = ptr3->next; //if they don't match keep going through the list
- }
- }
- ptr2->name = item;
- ptr2->count = num;
- ptr2->next = ptr->things;
- ptr->things = ptr2;
- return;
- }
- ptr= ptr->next;
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement