Re: Error when using `import`.
There's something that I'm trying to do that D may or may not be capable of. In the Map class, there is a 2-dimensional array called `grid`, where the Tile objects are stored. The Mission class inherits the Map class. In the Mission class, I want the `grid` array to instead be composed of a derivative of the Tile class. I tried making a derived class called `GridTile` which contains the additional property specific to the Raylib front-end. I tried doing this, but it won't let me override `grid`, even if I change it from `private` to `protected` in the Map class. Is there a way I can do this, without this additional functionality being put in the base Tile class?
Re: Error when using `import`.
I have made some progress on this. For the raylib front-end, I tried making a class called `Mission` which inherits `Map`. This class handles the graphics, input, and other game events. The program now compiles without errors, and there are some graphics. I have pushed these updates to the GitHub repository. https://github.com/LiamM32/Open_Emblem Currently, it just displays a map of grass tiles with one unit. Clicking on the unit causes a segmentation fault. There is something that's supposed to happen when clicked, but I don't know why it segfaults. The line where it segfaults appears to be roughly `oe-raylib/source/mission.d:125`. I am continuing to work on this, but have been getting more strange runtime errors since the latest push.
Re: Question on shared memory concurrency
On Monday, 4 March 2024 at 18:08:52 UTC, Andy Valencia wrote: For any other newbie dlang voyagers, here's a version which works as expected using the system memory allocator. On my little i7 I get 1.48 secs wallclock with 5.26 CPU seconds. ... Using a technique I found in a unit test in std/concurrency.d, I managed to share process memory without GC. It counted up to 1,000,000,000 on my low end i7 in: real0m15.666s user0m59.913s sys 0m0.004s import core.atomic : atomicFetchAdd; import std.concurrency : spawn, send, receiveOnly, ownerTid; import core.thread : Thread; const uint NSWEPT = 1_000_000_000; const uint NCPU = 4; void doadd() { auto val = receiveOnly!(shared(int)[]); for (uint count = 0; count < NSWEPT/NCPU; ++count) { atomicFetchAdd(val[0], 1); } ownerTid.send(true); } void main() { static shared int[] val = new shared(int)[1]; // Parallel workers for (int x = 0; x < NCPU; ++x) { auto tid = spawn(); tid.send(val); } // Pick up all completed workers for (int x = 0; x < NCPU; ++x) { receiveOnly!(bool); } assert(val[0] == NSWEPT); }