File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 1
1
#include < SFML/Graphics.hpp>
2
2
#include < vector>
3
3
#include < list>
4
+ #include < fstream>
4
5
#include " colony.hpp"
5
6
#include " config.hpp"
6
7
#include " display_manager.hpp"
7
8
8
9
10
+ uint32_t loadUserConf ()
11
+ {
12
+ uint32_t ants_count = 512 ;
13
+ std::ifstream conf_file (" conf.txt" );
14
+ if (conf_file) {
15
+ conf_file >> ants_count;
16
+ }
17
+ else {
18
+ std::cout << " Couldn't find 'conf.txt', loading default" << std::endl;
19
+ }
20
+
21
+ return ants_count;
22
+ }
23
+
24
+
9
25
int main ()
10
26
{
11
27
sf::ContextSettings settings;
@@ -14,9 +30,10 @@ int main()
14
30
window.setFramerateLimit (60 );
15
31
16
32
Conf::loadTextures ();
33
+ const uint32_t ants_count = loadUserConf ();
17
34
18
35
World world (Conf::WIN_WIDTH, Conf::WIN_HEIGHT);
19
- Colony colony (Conf::WIN_WIDTH/2 , Conf::WIN_HEIGHT/2 , 512 );
36
+ Colony colony (Conf::WIN_WIDTH/2 , Conf::WIN_HEIGHT/2 , ants_count );
20
37
world.addMarker (Marker (colony.position , Marker::ToHome, 10 .0f , true ));
21
38
22
39
DisplayManager display_manager (window, window, world, colony);
You can’t perform that action at this time.
0 commit comments