| 1956 | } |
| 1957 | |
| 1958 | int8_t Units::getCasteProfessionColor(int race, int casteid, df::profession pid) { |
| 1959 | if (!is_valid_enum_item(pid) || pid == profession::NONE) |
| 1960 | return 3; |
| 1961 | // If it's not a Peasant, it's hardcoded |
| 1962 | if (pid != profession::STANDARD) |
| 1963 | return ENUM_ATTR(profession, color, pid); |
| 1964 | |
| 1965 | if (auto creature = df::creature_raw::find(race)) { |
| 1966 | if (auto caste = vector_get(creature->caste, casteid)) { |
| 1967 | if (caste->flags.is_set(caste_raw_flags::HAS_COLOR)) |
| 1968 | return caste->caste_color[0] + caste->caste_color[2] * 8; |
| 1969 | } |
| 1970 | return creature->color[0] + creature->color[2] * 8; |
| 1971 | } |
| 1972 | // Default to dwarven peasant color |
| 1973 | return 3; |
| 1974 | } |
| 1975 | |
| 1976 | df::goal_type Units::getGoalType(df::unit *unit, size_t goalIndex) { |
| 1977 | CHECK_NULL_POINTER(unit); |
nothing calls this directly
no test coverage detected