Fix for enum values that could be out of range for their datatype

This commit is contained in:
a2x
2024-04-07 15:35:48 +10:00
parent 7c9d594ca6
commit 9f37324266
69 changed files with 177 additions and 176 deletions

View File

@@ -296,7 +296,7 @@ impl CodeGen for SchemaMap {
self.write_content(results, indent_size, |fmt| {
writeln!(
fmt,
"#![allow(non_upper_case_globals, non_camel_case_types, unused)]\n"
"#![allow(non_upper_case_globals, non_camel_case_types, non_snake_case, unused)]\n"
)?;
fmt.block("pub mod cs2_dumper", false, |fmt| {
@@ -341,7 +341,15 @@ impl CodeGen for SchemaMap {
.members
.iter()
.map(|member| {
format!("{} = {:#X}", member.name, member.value)
format!(
"{} = {}",
member.name,
if member.value == -1 {
format!("{}::MAX", type_name)
} else {
format!("{:#X}", member.value)
}
)
})
.collect::<Vec<_>>()
.join(",\n");