External Publication
Visit Post

OpenTTD AIs and Game Scripts • Re: nasal demons in action

Transport Tycoon Forums - Index page [Unofficial] March 2, 2026
Source

The postcondition you're quoting says that the list you copy from does not change as a result of the copy. Yes, the items are copied, not moved, so the source list remains identical. It does not say that the two list objects become "linked" or anything.

Oh I totally misinterpreted the meaning, now I've done some new tests and yeah, AddList copies by value not by reference, indeed! IDK how I missed that initially when testing, but replacing array.extend with AIList::AddList works and it's better for what I need it, thank you, you're the best.

If you had object references as the data items on the list, the destination list would reference the same objects as the source list, but the list itself is still independent, so you could reorder, add, remove items from one list without affecting the other one.

OK, I'm it looks still learning squirrel even though it feels like this is the only unknown to me, are you saying non-scalar items (e.g. array, instance, class) are by reference but the list or container itself is by value?

meaning modifying the container's items is by reference while removing them from container is by value? I'll have to test this as well to be sure, there is not a single info online about how this works.

Thank you clearing up!

Statistics: Posted by GoldMine — 02 Mar 2026 09:58


Discussion in the ATmosphere

Loading comments...