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

View file

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

View file

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