Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1.  
  2. //Check if StickerSheet has maximum amount of stickers allotted
  3. if (count_ == maxStickers_) {
  4. return -1;
  5. }
  6.  
  7. //Iterate through array of stickers
  8. for (unsigned i = 0; i < maxStickers_; i++) {
  9. //Check for first existance of sticker, index of this denoted by "i"
  10. if (!stickerExists_[i]) {
  11. stickers_[i] = new Image(sticker); //Create a sticker copy from the reference parameter
  12. xCoord_[i] = x; //Copy x-coord
  13. yCoord_[i] = y; //Copy y-coord
  14. stickerExists_[i] = true; //Update sticker exists value
  15. //Check if current index is greater than or equal to the highest free slot
  16. return i;
  17. }
  18. }
  19. return -1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement