Config
Log for #openttd on 13th January 2024:
Times are UTC Toggle Colours
22:49:54  <xarick> https://cdn.discordapp.com/attachments/1008473233844097104/1195862315313139822/image.png?ex=65b58892&is=65a31392&hm=bad9afaa7a5b6eb596efc6844f90b9e37b12cefbaee419d8a75c94d3ba85d16b&
22:50:21  <peter1138[d]> It's a pointer to ship, but it doesn't point to anything.
22:50:46  <xarick> the ship is retrieved from the callback
22:51:16  <xarick> or at least, that's the intented result
22:51:47  <peter1138[d]> You can just initialize it.
22:52:29  <xarick> how?
22:52:37  <peter1138[d]> = nullptr
22:52:52  <xarick> that I tried too, doesn't work either
22:53:11  <xarick> because it's const
22:53:17  <xarick> the v stays nullptr
22:53:22  <peter1138[d]> Don't make it const then.
22:54:15  <peter1138[d]> Probably it stays nullptr because your callback is not getting called, or not changing v.
22:55:11  <xarick> using TGetTileInWaterRegionCallBack = std::function<bool(const TileIndex, Ship *)>;
22:55:19  <xarick> is it like that?
22:55:29  <xarick> nop, it isn't 😦
22:55:50  <xarick> `using TGetTileInWaterRegionCallBack = std::function<bool(const TileIndex, const Ship *)>;`
22:57:53  <xarick> and the function is:
22:57:53  <xarick> `        TGetTileInWaterRegionCallBack GetShipDepot = [&](const TileIndex tile, const Ship *v)
22:57:53  <xarick> {
22:57:53  <xarick> v = Yapf().GetVehicle();
22:57:53  <xarick> return IsShipDepotTile(tile) && GetShipDepotPart(tile) == DEPOT_PART_NORTH && IsTileOwner(tile, v->owner);
22:57:54  <xarick> };`
23:00:32  <xarick> why does it stay nullptr?
23:01:06  <_glx_> because `region.GetLabel(tile) != water_region_patch.label` is true
23:01:57  <peter1138[d]> And your callback does not set your caller's v. It only sets its own v.
23:03:31  <xarick> oh, I think I see the problem
23:03:37  <xarick> gonna adjust code a bit
23:03:45  *** keikoz has quit IRC
23:07:33  <xarick> nop
23:07:50  <xarick> my callback does not set my caller's v 😦 how do I make it do that?
23:11:14  <xarick> error C2100: illegal indirection
23:11:48  <Eddi|zuHause> you should possibly stick to legal indirections
23:27:08  <xarick> any hint?
23:36:02  <xarick> I'm stuck!
23:41:25  *** Wolf01 has quit IRC
23:44:29  <xarick> imma finding another solution

Powered by YARRSTE version: svn-trunk