More conversion changes to reduce warnings [skip ci]

This commit is contained in:
Akkadius 2020-07-12 17:33:17 -05:00
parent 6a7a78af29
commit 30e0bbb912
3 changed files with 28 additions and 32 deletions

View File

@ -161,14 +161,14 @@ public:
entry.level = atoi(row[0]); entry.level = atoi(row[0]);
entry.class = atoi(row[1]); entry.class = atoi(row[1]);
entry.hp = atof(row[2]); entry.hp = static_cast<float>(atof(row[2]));
entry.mana = atof(row[3]); entry.mana = static_cast<float>(atof(row[3]));
entry.end = atof(row[4]); entry.end = static_cast<float>(atof(row[4]));
entry.unk1 = atof(row[5]); entry.unk1 = static_cast<float>(atof(row[5]));
entry.unk2 = atof(row[6]); entry.unk2 = static_cast<float>(atof(row[6]));
entry.hp_fac = atof(row[7]); entry.hp_fac = static_cast<float>(atof(row[7]));
entry.mana_fac = atof(row[8]); entry.mana_fac = static_cast<float>(atof(row[8]));
entry.end_fac = atof(row[9]); entry.end_fac = static_cast<float>(atof(row[9]));
return entry; return entry;
} }
@ -313,14 +313,14 @@ public:
entry.level = atoi(row[0]); entry.level = atoi(row[0]);
entry.class = atoi(row[1]); entry.class = atoi(row[1]);
entry.hp = atof(row[2]); entry.hp = static_cast<float>(atof(row[2]));
entry.mana = atof(row[3]); entry.mana = static_cast<float>(atof(row[3]));
entry.end = atof(row[4]); entry.end = static_cast<float>(atof(row[4]));
entry.unk1 = atof(row[5]); entry.unk1 = static_cast<float>(atof(row[5]));
entry.unk2 = atof(row[6]); entry.unk2 = static_cast<float>(atof(row[6]));
entry.hp_fac = atof(row[7]); entry.hp_fac = static_cast<float>(atof(row[7]));
entry.mana_fac = atof(row[8]); entry.mana_fac = static_cast<float>(atof(row[8]));
entry.end_fac = atof(row[9]); entry.end_fac = static_cast<float>(atof(row[9]));
all_entries.push_back(entry); all_entries.push_back(entry);
} }
@ -347,14 +347,14 @@ public:
entry.level = atoi(row[0]); entry.level = atoi(row[0]);
entry.class = atoi(row[1]); entry.class = atoi(row[1]);
entry.hp = atof(row[2]); entry.hp = static_cast<float>(atof(row[2]));
entry.mana = atof(row[3]); entry.mana = static_cast<float>(atof(row[3]));
entry.end = atof(row[4]); entry.end = static_cast<float>(atof(row[4]));
entry.unk1 = atof(row[5]); entry.unk1 = static_cast<float>(atof(row[5]));
entry.unk2 = atof(row[6]); entry.unk2 = static_cast<float>(atof(row[6]));
entry.hp_fac = atof(row[7]); entry.hp_fac = static_cast<float>(atof(row[7]));
entry.mana_fac = atof(row[8]); entry.mana_fac = static_cast<float>(atof(row[8]));
entry.end_fac = atof(row[9]); entry.end_fac = static_cast<float>(atof(row[9]));
all_entries.push_back(entry); all_entries.push_back(entry);
} }

View File

@ -414,7 +414,7 @@ public:
entry.fog_green = atoi(row[24]); entry.fog_green = atoi(row[24]);
entry.sky = atoi(row[25]); entry.sky = atoi(row[25]);
entry.ztype = atoi(row[26]); entry.ztype = atoi(row[26]);
entry.zone_exp_multiplier = atof(row[27]); entry.zone_exp_multiplier = static_cast<float>(atof(row[27]));
entry.walkspeed = static_cast<float>(atof(row[28])); entry.walkspeed = static_cast<float>(atof(row[28]));
entry.time_type = atoi(row[29]); entry.time_type = atoi(row[29]);
entry.fog_red1 = atoi(row[30]); entry.fog_red1 = atoi(row[30]);
@ -867,7 +867,7 @@ public:
entry.fog_green = atoi(row[24]); entry.fog_green = atoi(row[24]);
entry.sky = atoi(row[25]); entry.sky = atoi(row[25]);
entry.ztype = atoi(row[26]); entry.ztype = atoi(row[26]);
entry.zone_exp_multiplier = atof(row[27]); entry.zone_exp_multiplier = static_cast<float>(atof(row[27]));
entry.walkspeed = static_cast<float>(atof(row[28])); entry.walkspeed = static_cast<float>(atof(row[28]));
entry.time_type = atoi(row[29]); entry.time_type = atoi(row[29]);
entry.fog_red1 = atoi(row[30]); entry.fog_red1 = atoi(row[30]);
@ -977,7 +977,7 @@ public:
entry.fog_green = atoi(row[24]); entry.fog_green = atoi(row[24]);
entry.sky = atoi(row[25]); entry.sky = atoi(row[25]);
entry.ztype = atoi(row[26]); entry.ztype = atoi(row[26]);
entry.zone_exp_multiplier = atof(row[27]); entry.zone_exp_multiplier = static_cast<float>(atof(row[27]));
entry.walkspeed = static_cast<float>(atof(row[28])); entry.walkspeed = static_cast<float>(atof(row[28]));
entry.time_type = atoi(row[29]); entry.time_type = atoi(row[29]);
entry.fog_red1 = atoi(row[30]); entry.fog_red1 = atoi(row[30]);

View File

@ -282,14 +282,10 @@ foreach my $table_to_generate (@tables) {
$all_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = atoi(row[%s]);\n", $column_name, $index); $all_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = atoi(row[%s]);\n", $column_name, $index);
$find_one_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = atoi(row[%s]);\n", $column_name, $index); $find_one_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = atoi(row[%s]);\n", $column_name, $index);
} }
elsif ($data_type =~ /float/) { elsif ($data_type =~ /float|double|decimal/) {
$all_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = static_cast<float>(atof(row[%s]));\n", $column_name, $index); $all_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = static_cast<float>(atof(row[%s]));\n", $column_name, $index);
$find_one_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = static_cast<float>(atof(row[%s]));\n", $column_name, $index); $find_one_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = static_cast<float>(atof(row[%s]));\n", $column_name, $index);
} }
elsif ($data_type =~ /double|decimal/) {
$all_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = atof(row[%s]);\n", $column_name, $index);
$find_one_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = atof(row[%s]);\n", $column_name, $index);
}
else { else {
$all_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = row[%s] ? row[%s] : \"\";\n", $column_name, $index, $index); $all_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = row[%s] ? row[%s] : \"\";\n", $column_name, $index, $index);
$find_one_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = row[%s] ? row[%s] : \"\";\n", $column_name, $index, $index); $find_one_entries .= sprintf("\t\t\tentry.%-${longest_column_length}s = row[%s] ? row[%s] : \"\";\n", $column_name, $index, $index);