Looking for Feedback (3D engine)
drug007
drug2004 at bk.ru
Sat May 17 07:20:06 UTC 2025
On 17.05.2025 01:26, Danny Arends wrote:
>
> Never seen it being a problem, but changing line 94 of lsystem.d from
>
> ```
> test.rules[Symbols.Origin] ~= Rule("W.O", 5);
> ```
>
> To
>
> ```
> test.rules[Symbols.Origin] = Rule("W.O", 5);
> ```
>
> Would fix it, I guess appending might not be allowed when the key
> doesn't exist yet.
>
>
This patch fixed the issue:
```bash
root at 1be5cfa937c3:/DImGui# git diff
diff --git a/src/math/lsystem.d b/src/math/lsystem.d
index 394e902..02c085d 100644
--- a/src/math/lsystem.d
+++ b/src/math/lsystem.d
@@ -91,7 +91,7 @@ struct LSystem {
LSystem createLSystem() {
auto test = LSystem([Symbols.Origin]);
- test.rules[Symbols.Origin] ~= Rule("W.O", 5);
+ test.rules[Symbols.Origin] = Rules([Rule("W.O", 5)]);
test.rules[Symbols.Origin] ~= Rule("S.O", 5);
test.rules[Symbols.Origin] ~= Rule("A.O", 5);
test.rules[Symbols.Origin] ~= Rule("D.O", 5);
```
The demo compiles and works!
More information about the Digitalmars-d-learn
mailing list