Advertisement
AnthonyCagliano

Untitled

Nov 15th, 2022
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. bool ship_load_data(const uint8_t* data, size_t len){
  2.  
  3. // (uint8_t)*data is the maximum module count
  4. // (uint8_t*)data+1 is the ptr to the start of module data
  5. // len - 1 is the length of the module data
  6. // (len - 1) / sizeof(shipmodule_t) is the number of modules
  7.  
  8. uint8_t module_count = (len - 1) / sizeof(shipmodule_t);
  9. uint8_t *modules = alloca(len-1);
  10. if(!modules) return false;
  11. ...
  12. rest of the code
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement