Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool ship_load_data(const uint8_t* data, size_t len){
- // (uint8_t)*data is the maximum module count
- // (uint8_t*)data+1 is the ptr to the start of module data
- // len - 1 is the length of the module data
- // (len - 1) / sizeof(shipmodule_t) is the number of modules
- uint8_t module_count = (len - 1) / sizeof(shipmodule_t);
- uint8_t *modules = alloca(len-1);
- if(!modules) return false;
- ...
- rest of the code
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement