- Remove old 10-engine system (engines/ directory deleted) - Implement C++ triple interface architecture: * IEngine: Execution coordination (Debug → Production) * IModuleSystem: Strategy pattern (Sequential → Threaded → Cluster) * IModule: Pure game logic interface (200-300 lines per module) * IIO: Communication transport (Intra → Local → Network) - Add autonomous module structure: * modules/factory/: Production logic with autonomous build * modules/economy/: Market simulation with autonomous build * modules/logistic/: Supply chain with autonomous build * Each module: CLAUDE.md + CMakeLists.txt + shared/ + build/ - Benefits for Claude Code development: * Ultra-focused contexts (200 lines vs 50K+ lines) * Autonomous builds (cmake . from module directory) * Hot-swappable infrastructure without logic changes * Parallel development across multiple Claude instances 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
58 lines
1.7 KiB
C++
58 lines
1.7 KiB
C++
#include "../shared/ModuleBase.h"
|
|
#include "FactoryModule.cpp"
|
|
#include <iostream>
|
|
|
|
using json = nlohmann::json;
|
|
|
|
/**
|
|
* @brief Standalone test for FactoryModule
|
|
*
|
|
* Claude Code can run this to test the module locally
|
|
*/
|
|
int main() {
|
|
std::cout << "🏭 Testing Factory Module Standalone..." << std::endl;
|
|
|
|
try {
|
|
auto factory = std::make_unique<warfactory::FactoryModule>();
|
|
|
|
// Initialize with basic config
|
|
json config = {
|
|
{"module_name", "Factory"},
|
|
{"debug", true}
|
|
};
|
|
factory->initialize(config);
|
|
|
|
// Test production
|
|
json produce_cmd = {
|
|
{"type", "produce"},
|
|
{"recipe", "steel_plate"},
|
|
{"quantity", 5}
|
|
};
|
|
|
|
std::cout << "\n📤 Input: " << produce_cmd.dump(2) << std::endl;
|
|
|
|
// First attempt should fail (no materials)
|
|
json result = factory->process(produce_cmd);
|
|
std::cout << "📥 Result: " << result.dump(2) << std::endl;
|
|
|
|
// Add some materials and try again
|
|
json add_materials = {
|
|
{"type", "add_inventory"},
|
|
{"materials", {{"iron_ore", 20}, {"coal", 10}}}
|
|
};
|
|
|
|
// Test status
|
|
json status_cmd = {{"type", "status"}};
|
|
json status = factory->process(status_cmd);
|
|
std::cout << "\n📊 Status: " << status.dump(2) << std::endl;
|
|
|
|
factory->shutdown();
|
|
std::cout << "\n✅ Factory Module test completed successfully!" << std::endl;
|
|
|
|
return 0;
|
|
}
|
|
catch (const std::exception& e) {
|
|
std::cerr << "❌ Factory Module test failed: " << e.what() << std::endl;
|
|
return 1;
|
|
}
|
|
} |