# Configuration des Modules

## Configuration Système Modulaire

### Configuration Dependencies System

**Smart configuration avec recalculation automatique** :

```cpp
std::map<ConfigKey, std::vector<ComponentID>> dependencies = {
    {"materials.steel_plating.weight", {tank_mk1, tank_mk2, heavy_tank}},
    {"materials.steel_plating.cost", {economy_steel, factory_line_2}},
    {"weapons.cannon_75mm.damage", {tank_mk1, artillery_piece}}
};

void onConfigChange(ConfigKey key, json newValue) {
    auto affected = dependencies[key];
    for(auto component : affected) {
        DesignerModule::scheduleRecalc(component);
    }
}
```

### Module Config Example

**Configuration adaptable par module** :

```cpp
bool useNewSystem = config.getBool("use_new_tank_system");

json process(json input) {
    if(useNewSystem) {
        return newTankModule->process(input);
    } else {
        return legacyTankSystem->process(input);
    }
}
```

### Avantages Configuration Modulaire

**Développement :**
- **Config changes** : Restart required → Instant
- **A/B testing** : Impossible → Trivial
- **Debugging** : Needle in haystack → Surgical precision

**Maintenance :**
- **Module independence** : Tightly coupled → Zero dependencies
- **Testing** : Integration hell → Unit paradise
- **Deployment** : Monolith → Microservices-like
- **Scaling** : Rewrite → Configuration change

## Points Couverts

Cette configuration correspond aux patterns de configuration modulaire mentionnés dans les Points 251-290.

**Source :** `docs/toCheck/architecture-modulaire.md`
**Type :** Configuration système et dépendances