diff --git a/src/crossgen.hpp b/src/crossgen.hpp index d85d58f..b0e67b2 100644 --- a/src/crossgen.hpp +++ b/src/crossgen.hpp @@ -60,20 +60,21 @@ void generateWordInfo(GridType &grid, std::vector &winfos){ bool exist = false; for (size_t j = 0; j < grid.at(0).size(); ++j){ for (size_t i = 0; i < grid.size(); ++i){ - if (grid.at(i).at(j) == CELL_CLEAR){ - if (((j == 0) || (grid.at(i).at(j - 1) != CELL_CLEAR)) && - (j != grid.at(0).size() - 1)) - if (grid.at(i).at(j+1) == CELL_CLEAR){ + if ( grid.at(i).at(j) == CELL_CLEAR ){ + if ( ((j == 0) || (grid.at(i).at(j - 1) != CELL_CLEAR)) && + (j != grid.at(0).size() - 1) ) + if ( grid.at(i).at(j+1) == CELL_CLEAR ){ size_t cur_len = 1; bool cont = true; - while ((j + cur_len < grid.at(0).size()) && cont){ + while ( (j + cur_len < grid.at(0).size()) && cont ){ ++cur_len; - if (grid.at(i).at(j+cur_len-1) != CELL_CLEAR){ + if ( grid.at(i).at(j+cur_len-1) != CELL_CLEAR ){ cont = false; --cur_len; } } - exist = true; + exist = true; + WordInfo t; t.x = i; t.y = j; @@ -83,19 +84,19 @@ void generateWordInfo(GridType &grid, std::vector &winfos){ winfos.push_back(t); } - if (((i ==0) || (grid.at(i - 1).at(j) != CELL_CLEAR)) && - (i != grid.size() - 1)) - if (grid.at(i + 1).at(j) == CELL_CLEAR){ + if ( ((i ==0) || (grid.at(i - 1).at(j) != CELL_CLEAR)) && + (i != grid.size() - 1) ) + if ( grid.at(i + 1).at(j) == CELL_CLEAR ){ size_t cur_len = 1; bool cont = true; while ((i + cur_len < grid.size()) && cont){ ++cur_len; if (grid.at(i+cur_len-1).at(j) != CELL_CLEAR){ cont = false; - cur_len--; + --cur_len; } } - exist = true; + exist = true; WordInfo t; t.x = i; t.y = j; @@ -104,7 +105,7 @@ void generateWordInfo(GridType &grid, std::vector &winfos){ t.direct = true; winfos.push_back(t); } - if (exist){ + if ( exist ){ exist = false; ++cur_ind; } diff --git a/wxCrossGen/main.cpp b/wxCrossGen/main.cpp index 75a38cc..7951040 100644 --- a/wxCrossGen/main.cpp +++ b/wxCrossGen/main.cpp @@ -68,12 +68,12 @@ void MainFrame::OnbtnPathClick(wxCommandEvent &event) { wxFileDialog dlgOpen(this, wxT("Открыть файл кроссворда"), wxEmptyString, wxEmptyString, wxT("Файлы кроссворда (*.cross)|*.cross"), wxFD_OPEN|wxFD_FILE_MUST_EXIST); - if (dlgOpen.ShowModal() == wxID_CANCEL) + if ( dlgOpen.ShowModal() == wxID_CANCEL ) return; // proceed loading the file chosen by the user; // this can be done with e.g. wxWidgets input streams: wxFileInputStream input_stream(dlgOpen.GetPath()); - if (!input_stream.IsOk()) { + if ( !input_stream.IsOk() ) { wxLogError(wxT("Cannot open file ")+dlgOpen.GetPath()); return; }