Re: Challenge: Make a data type for holding one of 8 directions allowing increment and overflow

2024-03-16 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
Bit fields are currently going through the DIP process, although because of ImportC having it, its just a matter of turning them on and adding the parser stuff. However there is a major drawback to it and is why you'll still need to use a struct and that is you can't take a pointer to it.

Re: Challenge: Make a data type for holding one of 8 directions allowing increment and overflow

2024-03-16 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Mar 16, 2024 at 09:16:51PM +, Liam McGillivray via Digitalmars-d-learn wrote: > On Friday, 15 March 2024 at 00:21:42 UTC, H. S. Teoh wrote: [...] > > When dealing with units of data smaller than a byte, you generally > > need to do it manually, because memory is not addressable by > >

Reworking the control flow for my tactical role-playing game

2024-03-16 Thread Liam McGillivray via Digitalmars-d-learn
As many of you know, I have been trying to write a tactical role-playing game (a mix of turn-based stategy & RPG) in D. This is the furthest I have ever gotten in making an interactive program from the main function up. Right now, it is not yet playable as a game, but you can interact with it

Re: varargs when they're not all the same type?

2024-03-16 Thread Andy Valencia via Digitalmars-d-learn
On Friday, 15 March 2024 at 00:11:11 UTC, Andy Valencia wrote: (varargs & friends) Which statement leads me to section 77.2 of "Programming in D", and now I am deep into the mechanisms behind what you have very kindly shared. Thank you once more. As some fruits of my labors here, below is

Re: Challenge: Make a data type for holding one of 8 directions allowing increment and overflow

2024-03-16 Thread Liam McGillivray via Digitalmars-d-learn
On Friday, 15 March 2024 at 17:25:09 UTC, Daniel N wrote: On Tuesday, 12 March 2024 at 05:38:03 UTC, Liam McGillivray wrote: I am in need of a data type for holding direction information; one of 8 directions on a single axis. They are named in terms of compass directions. If D had a 4-bit

Re: Challenge: Make a data type for holding one of 8 directions allowing increment and overflow

2024-03-16 Thread Liam McGillivray via Digitalmars-d-learn
On Friday, 15 March 2024 at 00:21:42 UTC, H. S. Teoh wrote: On Thu, Mar 14, 2024 at 11:39:33PM +, Liam McGillivray via Digitalmars-d-learn wrote: [...] I tried to rework the functions to use bitwise operations, but it was difficult to figure out the correct logic. I decided that it's not

Re: Deriving a struct from another one via template: Easy way to propagate UDAs?

2024-03-16 Thread Inkrementator via Digitalmars-d-learn
On Saturday, 16 March 2024 at 13:09:13 UTC, Adam D Ruppe wrote: On Thursday, 14 March 2024 at 23:19:37 UTC, Inkrementator wrote: @(__traits(getAttributes, thingYouWantToForward)) void yourNewThing() {} Thanks, that should solve my problem.

Re: Deriving a struct from another one via template: Easy way to propagate UDAs?

2024-03-16 Thread Inkrementator via Digitalmars-d-learn
On Friday, 15 March 2024 at 19:13:38 UTC, cc wrote: This is trivially easy if your types are visible at module level, and mixin is a fine tool for the job. It doesn't work quite so well with [Voldemort types](https://wiki.dlang.org/Voldemort_types). I used the following lines to make it work

Re: How to make a struct containing an associative array to deeply copy (for repeated usage in foreach) ?

2024-03-16 Thread monkyyy via Digitalmars-d-learn
On Friday, 15 March 2024 at 20:36:56 UTC, rkompass wrote: I start to see that D is heavily influenced by C++ (STL), not just C. This is not bad It is just bad; ranges are not pairs of 2 pointers, stepov was comprising with c++ or if he thinks c++ iterators are objectively good(not good

Re: Deriving a struct from another one via template: Easy way to propagate UDAs?

2024-03-16 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 14 March 2024 at 23:19:37 UTC, Inkrementator wrote: * Is UDA propagation possible without string mixins? @(__traits(getAttributes, thingYouWantToForward)) void yourNewThing() {} * Are template mixins vulnerable to name collisions?

Re: DUB error I can't make sense of

2024-03-16 Thread Per Nordlöw via Digitalmars-d-learn
On Saturday, 16 March 2024 at 07:27:17 UTC, Richard (Rikki) Andrew Cattermole wrote: Do you? ``module nxt.algorithm.comparsion;`` comparsion doesn't look much like comparison to me ;) I know. I'm crushed. Am I getting dislyctic? ;)

Re: DUB error I can't make sense of

2024-03-16 Thread Per Nordlöw via Digitalmars-d-learn
On Saturday, 16 March 2024 at 07:23:09 UTC, Per Nordlöw wrote: Do you? Fixed it. There was some invisible character that confused the compiler.

Re: DUB error I can't make sense of

2024-03-16 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 16/03/2024 8:23 PM, Per Nordlöw wrote: https://github.com/nordlow/phobos-next/releases/tag/v0.6.10 fails to build as ``` ../../.dub/cache/phobos-next/0.6.10/code/phobos-next-test-library-unittest-nyN4MEoglVgAJ1A9GyL6uA/dub_test_root.d(11,15): Error: module `nxt.algorithm.comparsion` from

DUB error I can't make sense of

2024-03-16 Thread Per Nordlöw via Digitalmars-d-learn
https://github.com/nordlow/phobos-next/releases/tag/v0.6.10 fails to build as ``` ../../.dub/cache/phobos-next/0.6.10/code/phobos-next-test-library-unittest-nyN4MEoglVgAJ1A9GyL6uA/dub_test_root.d(11,15): Error: module `nxt.algorithm.comparsion` from file src/nxt/algorithm/comparison.d must be