added flag for autorun.

This commit is contained in:
Andreas Ortmann 2016-09-28 21:38:13 +02:00
parent a92d3d2120
commit eb3c0f5cd4
3 changed files with 45 additions and 40 deletions

View file

@ -6,7 +6,7 @@
#include <cmath> #include <cmath>
//#define QUICK_TEST #include "options.hpp"
Game::Game() Game::Game()
{ {
@ -19,14 +19,14 @@ Game::Game()
// XXX // XXX
// one dummy ship for testing // one dummy ship for testing
#ifdef QUICK_TEST if (ISSET_FLAG(TEST_AUTORUN)) {
m_state->addPlayer(); m_state->addPlayer();
#endif }
} }
bool Game::cycle(float dt) bool Game::cycle(float dt)
{ {
#ifdef QUICK_TEST if (ISSET_FLAG(TEST_AUTORUN)) {
// XXX the following is just testing code to do things // XXX the following is just testing code to do things
static float total = 0.0; static float total = 0.0;
@ -61,7 +61,7 @@ bool Game::cycle(float dt)
// m_state->players[0]->addCommand(new game::ClearTracesCommand()); // m_state->players[0]->addCommand(new game::ClearTracesCommand());
//} //}
} }
#endif }
// std::cout<<"adding dt: " << dt << std::endl; // std::cout<<"adding dt: " << dt << std::endl;
m_time_for_next_step += dt; m_time_for_next_step += dt;

View file

@ -32,6 +32,7 @@ int main(int argc, char *argv[]) {
// {"add", no_argument, 0, 'a'}, // {"add", no_argument, 0, 'a'},
// {"append", no_argument, 0, 'b'}, // {"append", no_argument, 0, 'b'},
// {"delete", required_argument, 0, 'd'}, // {"delete", required_argument, 0, 'd'},
{"autorun", required_argument, 0, 'a'},
{"port", required_argument, 0, 'p'}, {"port", required_argument, 0, 'p'},
{"fps", no_argument, 0, 'f'}, {"fps", no_argument, 0, 'f'},
{0, 0, 0, 0} {0, 0, 0, 0}
@ -40,7 +41,7 @@ int main(int argc, char *argv[]) {
int option_index = 0; int option_index = 0;
while(1){ while(1){
c = getopt_long (argc, argv, "p:f", c = getopt_long (argc, argv, "p:fa",
long_options, &option_index); long_options, &option_index);
if (c == -1) if (c == -1)
break; break;
@ -54,6 +55,9 @@ int main(int argc, char *argv[]) {
strcpy(port,optarg); strcpy(port,optarg);
break; break;
case 'a':
SET_FLAG(TEST_AUTORUN, true);
break;
case '?': case '?':
/* getopt_long already printed an error message. */ /* getopt_long already printed an error message. */

View file

@ -3,6 +3,7 @@
#define TEST_FLAG1 0 #define TEST_FLAG1 0
#define SHOW_FPS 1 #define SHOW_FPS 1
#define TEST_FLAG2 2 #define TEST_FLAG2 2
#define TEST_AUTORUN 3
//... //...