mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-02 08:42:45 +03:00
feat(component): add ComponentValidateBase
This commit is contained in:
parent
e8487187d8
commit
33d817f394
@ -127,3 +127,27 @@ int32_t BuildComponentArray(uint32_t varArrayLength, st_race** varArrayPtr) {
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t ComponentValidateBase(st_race* varArray, int32_t raceId, int32_t sexId, COMPONENT_VARIATIONS sectionIndex, int32_t variationIndex, int32_t colorIndex) {
|
||||||
|
if (sectionIndex >= NUM_COMPONENT_VARIATIONS || variationIndex < 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& section = varArray[(raceId * UNITSEX_NUM_SEXES + sexId)].sections[sectionIndex];
|
||||||
|
|
||||||
|
if (variationIndex >= section.variationCount || section.variationCount == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (colorIndex < 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& variation = section.variationArray[variationIndex];
|
||||||
|
|
||||||
|
if (colorIndex >= variation.colorCount || variation.colorCount == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|||||||
@ -28,4 +28,6 @@ struct st_variation {
|
|||||||
|
|
||||||
int32_t BuildComponentArray(uint32_t varArrayLength, st_race** varArrayPtr);
|
int32_t BuildComponentArray(uint32_t varArrayLength, st_race** varArrayPtr);
|
||||||
|
|
||||||
|
int32_t ComponentValidateBase(st_race* varArray, int32_t raceId, int32_t sexId, COMPONENT_VARIATIONS sectionIndex, int32_t variationIndex, int32_t colorIndex);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user