Re: Problems with Array Assignment?

2017-05-10 Thread Samwise via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 20:01:16 UTC, Adam D. Ruppe wrote: ... Thanks loads. Thanks to this my next commit is going to have quite a few improvements that clean up the engine code considerably. I appreciate the help.

Re: Problems with Array Assignment?

2017-05-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 17:26:09 UTC, Samwise wrote: I wondered about that when I did it, but I assumed (wrongly) that since the name of the array was the same, it would override it. Nope, this is a somewhat common mistake coming from Python users, but it can't work that way in D since

Re: Problems with Array Assignment?

2017-05-10 Thread Samwise via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 17:54:38 UTC, Adam D. Ruppe wrote: On Wednesday, 10 May 2017 at 17:47:57 UTC, Samwise wrote: The expected behavior for this is to just see "Different Text" and "Other Text", instead of having any time to see just "Text". However, it seems that the second update

Re: Problems with Array Assignment?

2017-05-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 17:47:57 UTC, Samwise wrote: The expected behavior for this is to just see "Different Text" and "Other Text", instead of having any time to see just "Text". However, it seems that the second update method is having the effect that the first call should, and then

Re: Problems with Array Assignment?

2017-05-10 Thread Samwise via Digitalmars-d-learn
I'm also having another problem with this program that is (sorta?) related. If you notice in my main (minus all the comments...), the code creates two tiles, then updates the renderer so that it renders those tiles. Then I create another tile in the same place as one of the first ones (not

Re: Problems with Array Assignment?

2017-05-10 Thread Samwise via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 13:43:54 UTC, Adam D. Ruppe wrote: In your code, I see one big mistake: --- class TileRenderer { private Tile[] tiles; /*...*/ } class CTileRenderer : TileRenderer { private CTile[] tiles; /*...*/ } --- Those are two separate arrays! Stuff examined through

Re: Problems with Array Assignment?

2017-05-10 Thread Adam D. Ruppe via Digitalmars-d-learn
In your code, I see one big mistake: --- class TileRenderer { private Tile[] tiles; /*...*/ } class CTileRenderer : TileRenderer { private CTile[] tiles; /*...*/ } --- Those are two separate arrays! Stuff examined through TileRenderer will be looking at a different array than looking

Re: Problems with Array Assignment?

2017-05-10 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 13:34:30 UTC, Samwise wrote: I'm really sure this is just a stupid mistake I made, but I can't for the life of me figure out what is going on. Basically I'm trying to assign a reference to an object to an array, and the objects exist (an explicit destructor is

Problems with Array Assignment?

2017-05-10 Thread Samwise via Digitalmars-d-learn
I'm really sure this is just a stupid mistake I made, but I can't for the life of me figure out what is going on. Basically I'm trying to assign a reference to an object to an array, and the objects exist (an explicit destructor is writing lines at the end of the program, when the objects are