equal
deleted
inserted
replaced
1 |
1 |
2 #include "Engine.hh" |
2 #include "Engine.hh" |
3 #include "NetworkServer.hh" |
3 #include "NetworkServer.hh" |
4 #include "NetworkClient.hh" |
4 #include "NetworkClient.hh" |
|
5 #include "SinglePlayer.hh" |
5 |
6 |
6 #include <iostream> |
7 #include <iostream> |
7 |
8 |
8 Engine::Engine (void) : is_running(true) { |
9 Engine::Engine (void) : is_running(true) { |
9 |
10 |
25 |
26 |
26 // create the client |
27 // create the client |
27 net_client = new NetworkClient(game_state, connect_addr); |
28 net_client = new NetworkClient(game_state, connect_addr); |
28 } |
29 } |
29 |
30 |
|
31 void Engine::setupSinglePlayer (void) { |
|
32 // create player directly |
|
33 LocalPlayer* lp = new SinglePlayer(game_state); |
|
34 |
|
35 // add to gamestate |
|
36 game_state.newLocalPlayer(lp); |
|
37 } |
|
38 |
30 void Engine::stop (void) { |
39 void Engine::stop (void) { |
31 is_running = false; |
40 is_running = false; |
32 } |
41 } |
33 |
42 |
34 void Engine::run (void) { |
43 void Engine::run (void) { |
37 CL_System::keep_alive(); |
46 CL_System::keep_alive(); |
38 |
47 |
39 // if I can't find some better way to do this in ClanLib by next thursday, then it f*%!ing sucks |
48 // if I can't find some better way to do this in ClanLib by next thursday, then it f*%!ing sucks |
40 // ideally, we should be able to have a main loop that does timed waits on I/O, fufilling some set of timers |
49 // ideally, we should be able to have a main loop that does timed waits on I/O, fufilling some set of timers |
41 // but as far as I can tell, ClanLib doesn't have anything like that |
50 // but as far as I can tell, ClanLib doesn't have anything like that |
42 CL_System::sleep(20); |
51 CL_System::sleep(10); |
43 } |
52 } |
44 } |
53 } |
45 |
54 |
46 Logger Engine::log (enum LogLevel level, const char *type) { |
55 Logger Engine::log (enum LogLevel level, const char *type) { |
47 return Logger(level <= WARN ? std::cerr : std::cout, level, type); |
56 return Logger(level <= WARN ? std::cerr : std::cout, level, type); |