Skip to content

Commit

Permalink
Fixed compilation with tools enabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frodo45127 committed Aug 9, 2023
1 parent cba2a55 commit 2fd1b2d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions rpfm_ui/src/tools/faction_painter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ impl ToolFactionPainter {
let uniform_tertiary_colour_column = if GAME_SELECTED.read().unwrap().key() == KEY_WARHAMMER_3 { table.column_position_by_name(uniform_tertiary_colour_column_name).ok_or_else(|| ToolsError::MissingColumnInTable(table.table_name().to_string(), uniform_tertiary_colour_column_name.to_string()))? } else { 0 };

let definition = serde_json::to_string(table.definition())?;
for row in table.data(&None)?.iter() {
for row in table.data().iter() {
let mut data = HashMap::new();

match Tool::get_row_by_column_index(row, flag_path_column)? {
Expand Down Expand Up @@ -741,7 +741,7 @@ impl ToolFactionPainter {
if path.to_lowercase().ends_with(".loc") {
if let Ok(RFileDecoded::Loc(table)) = packed_file.decoded() {
let base_name = "factions_screen_name_".to_owned();
let table_data = table.data(&None)?;
let table_data = table.data();

processed_data.iter_mut().for_each(|(key, values)| {
let key = format!("{}{}", base_name, key);
Expand Down Expand Up @@ -786,7 +786,7 @@ impl ToolFactionPainter {
let secondary_colour_column = table.column_position_by_name(secondary_colour_column_name).ok_or_else(|| ToolsError::MissingColumnInTable(table.table_name().to_string(), secondary_colour_column_name.to_string()))?;
let tertiary_colour_column = table.column_position_by_name(tertiary_colour_column_name).ok_or_else(|| ToolsError::MissingColumnInTable(table.table_name().to_string(), tertiary_colour_column_name.to_string()))?;

for row in table.data(&None)?.iter() {
for row in table.data().iter() {
let key = match Tool::get_row_by_column_index(row, key_column)? {
DecodedData::StringU8(ref value) |
DecodedData::StringU16(ref value) |
Expand Down Expand Up @@ -870,7 +870,7 @@ impl ToolFactionPainter {
let secondary_colour_column = table.column_position_by_name(secondary_colour_column_name).ok_or_else(|| ToolsError::MissingColumnInTable(table.table_name().to_string(), secondary_colour_column_name.to_string()))?;
let tertiary_colour_column = table.column_position_by_name(tertiary_colour_column_name).ok_or_else(|| ToolsError::MissingColumnInTable(table.table_name().to_string(), tertiary_colour_column_name.to_string()))?;

for row in table.data(&None)?.iter() {
for row in table.data().iter() {
let key = match Tool::get_row_by_column_index(row, key_column)? {
DecodedData::StringU8(ref value) |
DecodedData::StringU16(ref value) |
Expand Down Expand Up @@ -947,7 +947,7 @@ impl ToolFactionPainter {

if let Some(first) = data.iter().next() {
if let Some(definition) = first.get(table_definition_name) {
let mut table = DB::new(&serde_json::from_str(definition)?, None, table_name, false);
let mut table = DB::new(&serde_json::from_str(definition)?, None, table_name);

let banner_primary_colour_column = table.column_position_by_name(banner_primary_colour_column_name).ok_or_else(|| ToolsError::MissingColumnInTable(table.table_name().to_string(), banner_primary_colour_column_name.to_string()))?;
let banner_secondary_colour_column = table.column_position_by_name(banner_secondary_colour_column_name).ok_or_else(|| ToolsError::MissingColumnInTable(table.table_name().to_string(), banner_secondary_colour_column_name.to_string()))?;
Expand Down Expand Up @@ -992,7 +992,7 @@ impl ToolFactionPainter {
}
}).collect::<Vec<Vec<DecodedData>>>();

table.set_data(None, &table_data)?;
table.set_data(&table_data)?;
let path = format!("db/{}/{}", table_name, self.get_file_name());
Ok(RFile::new_from_decoded(&RFileDecoded::DB(table), 0, &path))
} else { Err(ToolsError::Impossibru.into()) }
Expand All @@ -1014,7 +1014,7 @@ impl ToolFactionPainter {
if let Some(first) = data.iter().next() {
if let Some(definition) = first.get(table_definition_name) {
let definition = serde_json::from_str(definition)?;
let mut table = DB::new(&definition, None, table_name, false);
let mut table = DB::new(&definition, None, table_name);

let fields_processed = definition.fields_processed();
let key_column = table.column_position_by_name(key_column_name).ok_or_else(|| ToolsError::MissingColumnInTable(table.table_name().to_string(), key_column_name.to_string()))?;
Expand Down Expand Up @@ -1057,7 +1057,7 @@ impl ToolFactionPainter {
}
}).collect::<Vec<Vec<DecodedData>>>();

table.set_data(None, &table_data)?;
table.set_data(&table_data)?;
let path = format!("db/{}/{}", table_name, self.get_file_name());
Ok(RFile::new_from_decoded(&RFileDecoded::DB(table), 0, &path))
} else { Err(ToolsError::Impossibru.into()) }
Expand All @@ -1079,7 +1079,7 @@ impl ToolFactionPainter {
if let Some(first) = data.iter().next() {
if let Some(definition) = first.get(table_definition_name) {
let definition = serde_json::from_str(definition)?;
let mut table = DB::new(&definition, None, table_name, false);
let mut table = DB::new(&definition, None, table_name);

let fields_processed = definition.fields_processed();
let key_column = table.column_position_by_name(key_column_name).ok_or_else(|| ToolsError::MissingColumnInTable(table.table_name().to_string(), key_column_name.to_string()))?;
Expand Down Expand Up @@ -1123,7 +1123,7 @@ impl ToolFactionPainter {
}
}).collect::<Vec<Vec<DecodedData>>>();

table.set_data(None, &table_data)?;
table.set_data(&table_data)?;
let path = format!("db/{}/{}", table_name, self.get_file_name());
Ok(RFile::new_from_decoded(&RFileDecoded::DB(table), 0, &path))
} else { Err(ToolsError::Impossibru.into()) }
Expand Down
12 changes: 6 additions & 6 deletions rpfm_ui/src/tools/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ impl Tool {
}
} else { continue };

let rows = table.data(&None)?.par_iter().filter_map(|row| {
let rows = table.data().par_iter().filter_map(|row| {
match Tool::get_row_by_column_index(row, key_column) {
Ok(data) => match data {
DecodedData::StringU8(data) |
Expand Down Expand Up @@ -386,7 +386,7 @@ impl Tool {

// If it's not a linked table... just add each row to our data.
let append_key_indexes = append_keys.iter().filter_map(|key_name| table.column_position_by_name(key_name)).collect::<Vec<usize>>();
for row in table.data(&None)?.iter() {
for row in table.data().iter() {
let mut data = HashMap::new();
let key = Tool::get_row_by_column_index(row, key_column)?.data_to_string().to_string();

Expand Down Expand Up @@ -442,7 +442,7 @@ impl Tool {
// Get the table definition from its first entry, if there is one.
if let Some(first) = data.first() {
if let Some(definition) = first.get(&definition_key) {
let mut table = DB::new(&serde_json::from_str(definition)?, None, &table_name_end_tables, false);
let mut table = DB::new(&serde_json::from_str(definition)?, None, &table_name_end_tables);

// Generate the table's data from empty rows + our data.
let table_fields = table.definition().fields_processed();
Expand Down Expand Up @@ -515,7 +515,7 @@ impl Tool {
.flatten()
.collect::<Vec<Vec<DecodedData>>>();

table.set_data(None, &table_data)?;
table.set_data(&table_data)?;
let path = format!("db/{}/{}", table_name_end_tables, file_name);
Ok(RFile::new_from_decoded(&RFileDecoded::DB(table), 0, &path))
} else { Err(ToolsError::Impossibru.into()) }
Expand All @@ -532,7 +532,7 @@ impl Tool {
for (path, packed_file) in data.iter_mut() {
if path.to_lowercase().ends_with(".loc") {
if let Ok(RFileDecoded::Loc(table)) = packed_file.decoded() {
let table = table.data(&None)?.par_iter()
let table = table.data().par_iter()
.filter_map(|row| {
let key = if let DecodedData::StringU16(key) = &row[0] { key.to_owned() } else { None? };
let value = if let DecodedData::StringU16(value) = &row[1] { value.to_owned() } else { None? };
Expand Down Expand Up @@ -563,7 +563,7 @@ impl Tool {

/// This function takes care of saving all the loc-related data in a generic way into a PackedFile.
fn save_loc_data(&self, data: &[HashMap<String, String>], file_name: &str, loc_keys: &[(&str, &str)]) -> Result<RFile> {
let mut table = Loc::new(false);
let mut table = Loc::new();

// Generate the table's data from empty rows + our data.
let table_data = data.par_iter()
Expand Down

0 comments on commit 2fd1b2d

Please sign in to comment.