Closes #127 Previously, `./mcrogueface --headless --exec <script>` would hang indefinitely after the script completed because the game loop ran continuously. This required external timeouts and explicit mcrfpy.exit() calls in every automation script. This commit adds automatic exit detection for headless+exec mode: - Added `auto_exit_after_exec` flag to McRogueFaceConfig - Set flag automatically when both --headless and --exec are present - Game loop exits when no timers remain (timers.empty()) Benefits: - Documentation generation scripts work without explicit exit calls - Testing scripts don't need timeout wrappers - Clean process termination for automation - Backward compatible (scripts with mcrfpy.exit() continue working) Changes: - src/McRogueFaceConfig.h: Add auto_exit_after_exec flag - src/main.cpp: Set flag and recreate engine with modified config - src/GameEngine.cpp: Check timers.empty() in game loop - ROADMAP.md: Mark Phase 7 as complete (2025-10-30) - CLAUDE.md: Add instruction about closing issues with commit messages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
36 lines
No EOL
1 KiB
C++
36 lines
No EOL
1 KiB
C++
#ifndef MCROGUEFACE_CONFIG_H
|
|
#define MCROGUEFACE_CONFIG_H
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <filesystem>
|
|
|
|
struct McRogueFaceConfig {
|
|
// McRogueFace specific
|
|
bool headless = false;
|
|
bool audio_enabled = true;
|
|
|
|
// Python interpreter emulation
|
|
bool python_mode = false;
|
|
std::string python_command; // -c command
|
|
std::string python_module; // -m module
|
|
bool interactive_mode = false; // -i flag
|
|
bool show_version = false; // -V flag
|
|
bool show_help = false; // -h flag
|
|
|
|
// Script execution
|
|
std::filesystem::path script_path;
|
|
std::vector<std::string> script_args;
|
|
|
|
// Scripts to execute before main script (--exec flag)
|
|
std::vector<std::filesystem::path> exec_scripts;
|
|
|
|
// Screenshot functionality for headless mode
|
|
std::string screenshot_path;
|
|
bool take_screenshot = false;
|
|
|
|
// Auto-exit when no timers remain (for --headless --exec automation)
|
|
bool auto_exit_after_exec = false;
|
|
};
|
|
|
|
#endif // MCROGUEFACE_CONFIG_H
|