mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-19 02:59:17 +01:00
#61980 (694c2999b0) has uncovered a few issues with our dna datum code. Mainly the lack of support for ui/uf blocks of different sizes.
So, in order to fix this issues, I had to create four global lists, two for UI and UF blocks which sizes differ from DNA_BLOCK_SIZE and two more that store the points in the ui and uf strings where different dna blocks start (this way we avoid having to calculate them every getter and setter proc call).
This will add support for heterogeneous ui/uf block sizes and make 24-bit color features and identities possible.
To the maintainers of downstream codebases: Remember to add your modular code ui and uf color blocks to the identity_block_lengths and features_block_lengths global lists respectively ... Unless you have rewritten dna code on your end. If that's so, good luck.
Tested and working (unless CI says otherwise).
19 lines
1014 B
Plaintext
19 lines
1014 B
Plaintext
//////////////////////////////////////////////////////////
|
|
//A bunch of helpers to make genetics less of a headache//
|
|
//////////////////////////////////////////////////////////
|
|
|
|
#define GET_INITIALIZED_MUTATION(A) GLOB.all_mutations[A]
|
|
#define GET_GENE_STRING(A, B) (B.mutation_index[A])
|
|
#define GET_SEQUENCE(A) (GLOB.full_sequences[A])
|
|
#define GET_MUTATION_TYPE_FROM_ALIAS(A) (GLOB.alias_mutations[A])
|
|
|
|
#define GET_MUTATION_STABILIZER(A) ((A.stabilizer_coeff < 0) ? 1 : A.stabilizer_coeff)
|
|
#define GET_MUTATION_SYNCHRONIZER(A) ((A.synchronizer_coeff < 0) ? 1 : A.synchronizer_coeff)
|
|
#define GET_MUTATION_POWER(A) ((A.power_coeff < 0) ? 1 : A.power_coeff)
|
|
#define GET_MUTATION_ENERGY(A) ((A.energy_coeff < 0) ? 1 : A.energy_coeff)
|
|
|
|
///Getter macro used to get the length of a identity block
|
|
#define GET_UI_BLOCK_LEN(blocknum) (GLOB.identity_block_lengths["[blocknum]"] || DNA_BLOCK_SIZE)
|
|
///Ditto, but for a feature.
|
|
#define GET_UF_BLOCK_LEN(blocknum) (GLOB.features_block_lengths["[blocknum]"] || DNA_BLOCK_SIZE)
|