[General] question about save/load codes

Status
Not open for further replies.
Level 12
Joined
Mar 21, 2008
Messages
377
so im using triggerhappy's codegen system (here)

basically i want to save a bunch of boolean values as to indicate that the player has unlocked certain things, but it turns out saving a shitton of 0/1s makes the save code very long

on top of that, i'm saving the usual rpg stuff as well (level/stats/items/etc.) which makes the code even longer

is there any way to shorten the code in this situation or am i dumb

also i should probably just switch to his codeless save/load system, but might as well ask anyway
 
Instead of saving the sequence of 0s and 1s like 00110101111000101111010001 you can convert this sequence to a binary number (or multiple numbers) and then save that number. This is a very simple form of compression There are now some bitwise functions (BlzBitAnd, for example) which may be helpful here.
 
you can convert this sequence to a binary number
did you mean to say decimal number, because if otherwise i don't get it lol

what im getting from what you've said:
1. i initally have a string containing a bunch of 0's and 1's
2. i convert that string into decimal then save that number (using the methods listed here? unless there's a better way)
2a. alternately i can split up the string and save multiple numbers if needed
3. when loading the code, convert decimal back to binary (again using the methods on the linked page)

if i misunderstood your post entirely then i need to be spoonfeed :ugly:
or at the very least, just give me some pointers to what sort of shit i should be googling

also i'm not really sure where BlzBitAnd fits here, i read some random programming tutorials that use bitwise AND, i kinda get what it's doing but i don't know how to do bit shifts in wc3 hmmm
 
Status
Not open for further replies.
Back
Top