File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ void Graphics::update()
113113 squares[square_counter]->setFillColor (Color::Black);
114114 }
115115 x++;
116- if (x > Maze[0 ].size ())
116+ if (x == Maze[0 ].size ())
117117 {
118118 y++;
119119 x = 0 ;
@@ -184,7 +184,7 @@ void Graphics::update()
184184 squares[square_counter]->setFillColor (Color::Black);
185185 }
186186 x++;
187- if (x > Maze[0 ].size ())
187+ if (x == Maze[0 ].size ())
188188 {
189189 y++;
190190 x = 0 ;
@@ -207,7 +207,7 @@ void Graphics::update()
207207 squares[square_counter]->setFillColor (Color::Black);
208208 }
209209 x++;
210- if (x > Maze[0 ].size ())
210+ if (x == Maze[0 ].size ())
211211 {
212212 y++;
213213 x = 0 ;
Original file line number Diff line number Diff line change @@ -40,10 +40,13 @@ int main()
4040 Coordinate * endCoord = new Coordinate ();
4141 int x;
4242 int y;
43+ std::string filename;
4344 std::cout << " How many squares in the x direction do you want?" << std::endl;
4445 std::cin >> x;
4546 std::cout << " How many squares in the y direction do you want?" << std::endl;
4647 std::cin >> y;
48+ std::cout << " Give your maze a name!" << std::endl;
49+ std::cin >> filename;
4750 std::cout << " Right click to set start point. Middle click to set end point." << std::endl;
4851 std::cout << " Single left click to create maze place" << std::endl;
4952 std::cout << " Close to save" << std::endl;
@@ -220,7 +223,7 @@ int main()
220223 }
221224 window.display ();
222225 }
223- std::ofstream file (" NEW_MAZE .maze" , std::ios::out | std::ios::binary);
226+ std::ofstream file (filename + " .maze" , std::ios::out | std::ios::binary);
224227 file.seekp (std::ios::beg);
225228 file.write ((char *)&(x), sizeof (x));
226229 file.seekp (0 , std::ios::end);
You can’t perform that action at this time.
0 commit comments