clang-tidy: readability-braces-around-statements
This commit is contained in:
parent
aa6267c242
commit
505e4ac4d1
|
@ -167,8 +167,9 @@ void MainPanel::DoChooseDir(wxCommandEvent &WXUNUSED(event)) {
|
|||
wxStandardPaths::Get().GetUserDir(wxStandardPaths::Dir_Desktop);
|
||||
wxDirDialog dialog(this, "Select a directory", dirHome,
|
||||
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
|
||||
if (dialog.ShowModal() == wxID_OK)
|
||||
if (dialog.ShowModal() == wxID_OK) {
|
||||
m_modDestination->SetValue(dialog.GetPath());
|
||||
}
|
||||
}
|
||||
#endif // wxUSE_DIRDLG
|
||||
|
||||
|
|
|
@ -53,12 +53,14 @@ StagesPanel::StagesPanel(wxWindow *window, int x, int y, int w, int h,
|
|||
magic_enum::enum_values<Starpounds::Types::Chests>();
|
||||
constexpr auto enumsLeg =
|
||||
magic_enum::enum_values<Starpounds::Types::Legs>();
|
||||
for (auto enumChest : enumsChest)
|
||||
for (auto enumChest : enumsChest) {
|
||||
choicesChest.Add(
|
||||
static_cast<std::string>(magic_enum::enum_name(enumChest)));
|
||||
for (auto enumLeg : enumsLeg)
|
||||
}
|
||||
for (auto enumLeg : enumsLeg) {
|
||||
choicesLeg.Add(
|
||||
static_cast<std::string>(magic_enum::enum_name(enumLeg)));
|
||||
}
|
||||
|
||||
m_add = new wxButton(this, STAGES_ADD, "Add");
|
||||
m_remove = new wxButton(this, STAGES_REMOVE, "Remove");
|
||||
|
@ -154,12 +156,14 @@ void StagesPanel::DoAddWeightStage(Starpounds::WeightStage stage) {
|
|||
}
|
||||
|
||||
void StagesPanel::DoRemoveWeightStage() {
|
||||
if (m_stagesList->GetCount() == 0)
|
||||
if (m_stagesList->GetCount() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int selection = m_stagesList->GetSelection();
|
||||
if (selection == wxNOT_FOUND)
|
||||
if (selection == wxNOT_FOUND) {
|
||||
selection = 0;
|
||||
}
|
||||
m_stagesList->Delete(selection);
|
||||
m_subStagesList->Clear();
|
||||
m_subAdd->Disable();
|
||||
|
@ -172,8 +176,9 @@ void StagesPanel::DoRemoveWeightStage() {
|
|||
|
||||
void StagesPanel::DoAddWeightStageSub(Starpounds::WeightStageSub sub) {
|
||||
int selection = m_stagesList->GetSelection();
|
||||
if (selection == wxNOT_FOUND)
|
||||
if (selection == wxNOT_FOUND) {
|
||||
selection = 0;
|
||||
}
|
||||
|
||||
Starpounds::WeightStage &stage = m_stages.at(selection);
|
||||
std::vector<Starpounds::WeightStageSub> subs = stage.GetSubs();
|
||||
|
@ -187,15 +192,18 @@ void StagesPanel::DoAddWeightStageSub(Starpounds::WeightStageSub sub) {
|
|||
}
|
||||
|
||||
void StagesPanel::DoRemoveWeightStageSub() {
|
||||
if (m_subStagesList->GetCount() == 0)
|
||||
if (m_subStagesList->GetCount() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int selection = m_subStagesList->GetSelection();
|
||||
int stageSelection = m_stagesList->GetSelection();
|
||||
if (selection == wxNOT_FOUND)
|
||||
if (selection == wxNOT_FOUND) {
|
||||
selection = 0;
|
||||
if (stageSelection == wxNOT_FOUND)
|
||||
}
|
||||
if (stageSelection == wxNOT_FOUND) {
|
||||
stageSelection = 0;
|
||||
}
|
||||
|
||||
Starpounds::WeightStage &stage = m_stages.at(stageSelection);
|
||||
std::vector<Starpounds::WeightStageSub> subs = stage.GetSubs();
|
||||
|
@ -474,8 +482,9 @@ StagesPanel::GetInternalNameReplacement(const Starpounds::WeightStage &stage) {
|
|||
size_t i = 0;
|
||||
const std::string name = stage.GetName();
|
||||
std::string newName = name;
|
||||
while (HasDuplicateInternalName(newName, false))
|
||||
while (HasDuplicateInternalName(newName, false)) {
|
||||
newName = wxString::Format("%s%d", name, ++i);
|
||||
}
|
||||
return newName;
|
||||
}
|
||||
|
||||
|
@ -484,8 +493,9 @@ StagesPanel::GetInternalNameReplacement(const Starpounds::WeightStageSub &sub) {
|
|||
size_t i = 0;
|
||||
const std::string name = sub.GetName();
|
||||
std::string newName = name;
|
||||
while (HasDuplicateInternalName(newName, true))
|
||||
while (HasDuplicateInternalName(newName, true)) {
|
||||
newName = wxString::Format("%s%d", name, ++i);
|
||||
}
|
||||
return newName;
|
||||
}
|
||||
|
||||
|
@ -493,19 +503,22 @@ bool StagesPanel::HasDuplicateInternalName(const std::string &name,
|
|||
const bool subs) {
|
||||
if (subs) {
|
||||
int selection = m_stagesList->GetSelection();
|
||||
if (selection == wxNOT_FOUND)
|
||||
if (selection == wxNOT_FOUND) {
|
||||
selection = 0;
|
||||
}
|
||||
|
||||
const Starpounds::WeightStage &stage = m_stages.at(selection);
|
||||
|
||||
for (const Starpounds::WeightStageSub &sub : stage.GetSubs()) {
|
||||
if (sub.GetName() == name)
|
||||
if (sub.GetName() == name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (const Starpounds::WeightStage &stage : m_stages) {
|
||||
if (stage.GetName() == name)
|
||||
if (stage.GetName() == name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -515,10 +528,11 @@ bool StagesPanel::HasDuplicateNoID() {
|
|||
bool hasNoID = false;
|
||||
for (const Starpounds::WeightStage &stage : m_stages) {
|
||||
if (!stage.HasID()) {
|
||||
if (hasNoID)
|
||||
if (hasNoID) {
|
||||
return true;
|
||||
else
|
||||
} else {
|
||||
hasNoID = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -530,8 +544,9 @@ void StagesPanel::OnClickWeightStage(wxCommandEvent &event) {
|
|||
const int selection = event.GetSelection();
|
||||
const Starpounds::WeightStage &stage = m_stages.at(selection);
|
||||
wxArrayString names;
|
||||
for (const Starpounds::WeightStageSub &sub : stage.GetSubs())
|
||||
for (const Starpounds::WeightStageSub &sub : stage.GetSubs()) {
|
||||
names.Add(sub.GetName());
|
||||
}
|
||||
m_subStagesList->Clear();
|
||||
m_subStagesList->InsertItems(names, 0);
|
||||
m_subAdd->Enable();
|
||||
|
@ -550,8 +565,9 @@ void StagesPanel::OnClickWeightStageSub(wxCommandEvent &event) {
|
|||
ClearForm();
|
||||
const int selection = event.GetSelection();
|
||||
int stageSelection = m_stagesList->GetSelection();
|
||||
if (stageSelection == wxNOT_FOUND)
|
||||
if (stageSelection == wxNOT_FOUND) {
|
||||
stageSelection = 0;
|
||||
}
|
||||
const Starpounds::WeightStage &stage = m_stages.at(stageSelection);
|
||||
const Starpounds::WeightStageSub sub = stage.GetSubs().at(selection);
|
||||
PopulateForm(sub);
|
||||
|
@ -570,8 +586,9 @@ void StagesPanel::OnClickCheckboxFrames(wxCommandEvent &event) {
|
|||
void StagesPanel::OnSelectComboBoxChest(wxCommandEvent &event) {
|
||||
const int selection = event.GetSelection();
|
||||
int stageSelection = m_stagesList->GetSelection();
|
||||
if (stageSelection == wxNOT_FOUND)
|
||||
if (stageSelection == wxNOT_FOUND) {
|
||||
stageSelection = 0;
|
||||
}
|
||||
Starpounds::WeightStage &stage = m_stages.at(stageSelection);
|
||||
stage.SetChestType(
|
||||
magic_enum::enum_value<Starpounds::Types::Chests>(selection));
|
||||
|
@ -580,8 +597,9 @@ void StagesPanel::OnSelectComboBoxChest(wxCommandEvent &event) {
|
|||
void StagesPanel::OnSelectComboBoxLeg(wxCommandEvent &event) {
|
||||
const int selection = event.GetSelection();
|
||||
int parentSelection = m_stagesList->GetSelection();
|
||||
if (parentSelection == wxNOT_FOUND)
|
||||
if (parentSelection == wxNOT_FOUND) {
|
||||
parentSelection = 0;
|
||||
}
|
||||
Starpounds::WeightStage &stage = m_stages.at(parentSelection);
|
||||
stage.SetLegType(
|
||||
magic_enum::enum_value<Starpounds::Types::Legs>(selection));
|
||||
|
@ -590,8 +608,9 @@ void StagesPanel::OnSelectComboBoxLeg(wxCommandEvent &event) {
|
|||
void StagesPanel::OnInternalNameEdit(wxCommandEvent &WXUNUSED(event)) {
|
||||
int selection = m_stagesList->GetSelection();
|
||||
int subSelection = m_subStagesList->GetSelection();
|
||||
if (selection == wxNOT_FOUND)
|
||||
if (selection == wxNOT_FOUND) {
|
||||
selection = 0;
|
||||
}
|
||||
|
||||
Starpounds::WeightStage &stage = m_stages.at(selection);
|
||||
|
||||
|
@ -610,8 +629,9 @@ void StagesPanel::OnInternalNameEdit(wxCommandEvent &WXUNUSED(event)) {
|
|||
void StagesPanel::OnFriendlyNameEdit(wxCommandEvent &WXUNUSED(event)) {
|
||||
int selection = m_stagesList->GetSelection();
|
||||
int subSelection = m_subStagesList->GetSelection();
|
||||
if (selection == wxNOT_FOUND)
|
||||
if (selection == wxNOT_FOUND) {
|
||||
selection = 0;
|
||||
}
|
||||
|
||||
Starpounds::WeightStage &stage = m_stages.at(selection);
|
||||
|
||||
|
@ -628,8 +648,9 @@ void StagesPanel::OnFriendlyNameEdit(wxCommandEvent &WXUNUSED(event)) {
|
|||
|
||||
void StagesPanel::OnDescriptionChestEdit(wxCommandEvent &WXUNUSED(event)) {
|
||||
int selection = m_stagesList->GetSelection();
|
||||
if (selection == wxNOT_FOUND)
|
||||
if (selection == wxNOT_FOUND) {
|
||||
selection = 0;
|
||||
}
|
||||
|
||||
Starpounds::WeightStage &stage = m_stages.at(selection);
|
||||
|
||||
|
@ -638,8 +659,9 @@ void StagesPanel::OnDescriptionChestEdit(wxCommandEvent &WXUNUSED(event)) {
|
|||
|
||||
void StagesPanel::OnDescriptionLegEdit(wxCommandEvent &WXUNUSED(event)) {
|
||||
int selection = m_stagesList->GetSelection();
|
||||
if (selection == wxNOT_FOUND)
|
||||
if (selection == wxNOT_FOUND) {
|
||||
selection = 0;
|
||||
}
|
||||
|
||||
Starpounds::WeightStage &stage = m_stages.at(selection);
|
||||
|
||||
|
|
|
@ -33,8 +33,9 @@ namespace SpeciesGen {
|
|||
//----------------------------------------------------------------------
|
||||
|
||||
bool App::OnInit() {
|
||||
if (!wxApp::OnInit())
|
||||
if (!wxApp::OnInit()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Frame *frame = new Frame("Species Support Generator", 680, 480);
|
||||
wxMenu *file_menu = new wxMenu;
|
||||
|
@ -279,10 +280,13 @@ void Frame::OnFileOpen(const std::string &message, const std::string &wildcard,
|
|||
wxStandardPaths::Get()
|
||||
.GetUserDir(wxStandardPaths::Dir_Desktop)
|
||||
.ToStdString();
|
||||
|
||||
wxFileDialog dialog(this, message, path_home.string(), wxEmptyString,
|
||||
wildcard, style);
|
||||
if (dialog.ShowModal() == wxID_OK)
|
||||
|
||||
if (dialog.ShowModal() == wxID_OK) {
|
||||
path = dialog.GetPath().ToStdString();
|
||||
}
|
||||
}
|
||||
#endif // wxUSE_FILEDLG
|
||||
|
||||
|
@ -309,10 +313,12 @@ void Frame::OnCheckErrors(wxCommandEvent &WXUNUSED(event)) { DoCheckErrors(); }
|
|||
|
||||
void Frame::DoGenerateMod(wxCommandEvent &WXUNUSED(event)) {
|
||||
wxBeginBusyCursor();
|
||||
if (DoCheckErrors())
|
||||
if (DoCheckErrors()) {
|
||||
return;
|
||||
for (size_t i = 0; i < m_notebook->GetPageCount(); i++)
|
||||
}
|
||||
for (size_t i = 0; i < m_notebook->GetPageCount(); i++) {
|
||||
m_notebook->GetPage(i)->Disable();
|
||||
}
|
||||
|
||||
const std::vector<Starpounds::WeightStage> stages =
|
||||
m_panel_stages->GetWeightStages();
|
||||
|
@ -404,8 +410,9 @@ void Frame::DoGenerateMod(wxCommandEvent &WXUNUSED(event)) {
|
|||
|
||||
const std::filesystem::path path_stage = path_species / stageName;
|
||||
|
||||
if (!std::filesystem::exists(path_stage))
|
||||
if (!std::filesystem::exists(path_stage)) {
|
||||
std::filesystem::create_directory(path_stage);
|
||||
}
|
||||
|
||||
if (stage.HasFrames()) {
|
||||
const Starbound::Frames::Frames frame(
|
||||
|
@ -441,8 +448,9 @@ void Frame::DoGenerateMod(wxCommandEvent &WXUNUSED(event)) {
|
|||
_baseImages.push_back(path_pantsm);
|
||||
|
||||
for (const std::filesystem::path &image : _baseImages) {
|
||||
if (!std::ifstream(path_stage / image).good())
|
||||
if (!std::ifstream(path_stage / image).good()) {
|
||||
std::ofstream(path_stage / image);
|
||||
}
|
||||
}
|
||||
|
||||
const std::filesystem::path path_chest =
|
||||
|
@ -494,12 +502,14 @@ void Frame::DoGenerateMod(wxCommandEvent &WXUNUSED(event)) {
|
|||
const std::filesystem::path path_subStage =
|
||||
path_stage / subStageName;
|
||||
|
||||
if (!std::filesystem::exists(path_subStage))
|
||||
if (!std::filesystem::exists(path_subStage)) {
|
||||
std::filesystem::create_directory(path_subStage);
|
||||
}
|
||||
|
||||
for (const std::filesystem::path &image : baseImages) {
|
||||
if (!std::ifstream(path_subStage / image).good())
|
||||
if (!std::ifstream(path_subStage / image).good()) {
|
||||
std::ofstream(path_subStage / image);
|
||||
}
|
||||
}
|
||||
|
||||
const std::filesystem::path path_chest =
|
||||
|
@ -530,8 +540,9 @@ void Frame::DoGenerateMod(wxCommandEvent &WXUNUSED(event)) {
|
|||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_notebook->GetPageCount(); i++)
|
||||
for (size_t i = 0; i < m_notebook->GetPageCount(); i++) {
|
||||
m_notebook->GetPage(i)->Enable(true);
|
||||
}
|
||||
|
||||
SetStatusText("[INFO]: Done, your mod has been successfully created!");
|
||||
wxEndBusyCursor();
|
||||
|
|
Loading…
Reference in New Issue