IRC logs for #openttd on OFTC at 2016-09-22
⏴ go to previous day
00:06:07 <Samu> i don't know the operator needed
00:07:33 <Samu> SLOPE_SW (insert operator) SLOPE_STEEP_W = SLOPE_S
00:08:01 <Samu> that gives me that result
00:09:40 <Wolf01> I would suggest "minus", but it's not how it works, so try with XOR
00:12:28 <Samu> gonna get horribad result
00:13:10 <Wolf01> Oh, my bad, it's not a flag
00:13:24 <Samu> :( i got an assertion, :(
00:14:06 <Wolf01> Give a look ad the "RemoveHalfSlopes" function or what its name
00:21:04 <Samu> testing ComplementSlope(tileh_start) & ~(tileh_end_aqueduct & ~SLOPE_STEEP)
00:22:15 <Samu> nope, i got a SLOPE_FLAT as result :(
00:22:26 <Wolf01> You could make a separate patch with some utility functions
00:25:06 <Samu> SLOPE_STEEP_W & ~SLOPE_STEEP = SLOPE_NWS :(
00:25:30 <Samu> the result I was expecting was SLOPE_W
00:28:42 <Samu> the complement is SLOPE_SW
00:29:04 <Samu> SLOPE_SW & ~SLOPE_W = SLOPE_S
00:29:20 <Samu> SLOPE_S is the final result I want
00:29:33 <Samu> but i got to calculate SLOPE_W
00:30:22 <Wolf01> You should ask frosch for this
00:58:20 *** FLHerne_ has joined #openttd
01:26:37 <Samu> and this is why i failed to be a programmer
01:27:43 <Samu> code doesn't work, i'm horrible
01:37:41 <Samu> ah, i needed more breaks
01:54:26 *** supermop_ has joined #openttd
02:09:58 *** Alkel_U3 has joined #openttd
02:31:51 *** Alkel_U3 has joined #openttd
03:21:04 *** sim-al2 is now known as Guest1167
03:21:05 *** sim-al2 has joined #openttd
03:26:30 *** kais58 is now known as kais58|AFK
03:26:50 *** kais58|AFK is now known as kais58
04:23:34 *** smoke_fumus has joined #openttd
06:03:13 *** Supercheese has joined #openttd
06:08:38 *** Tharbakim has joined #openttd
07:02:47 *** smoke_fumus has joined #openttd
08:08:19 *** sla_ro|master has joined #openttd
09:30:39 *** andythenorth has joined #openttd
10:00:14 *** Extrems has joined #openttd
10:11:41 *** andythenorth has left #openttd
10:16:01 *** Biolunar has joined #openttd
10:52:56 *** ChanServ sets mode: +v tokai
12:17:48 *** NoShlomo has joined #openttd
12:49:32 *** FLHerne_ has joined #openttd
14:10:41 <Samu> i'd like to avoid a case by case check, and do some math operations on the slopes
14:30:30 *** sim-al2 has joined #openttd
15:04:40 <Samu> I got a SLOPE_STEEP_W, and I want to transform it into the highest corner as a slope
15:04:51 <Samu> SLOPE_STEEP_W into SLOPE_W
15:04:58 <Samu> what is the math involved to achieve this?
15:05:34 <Samu> SLOPE_STEEP_W has these bits: 0001 1011
15:05:44 <Samu> SLOPE_W has these bits: 0000 0001
15:07:11 <Samu> is there a Highest corner to slope conversion?
15:11:41 <ST2> enter our channel, please
15:11:58 <ST2> this is not the place to chat about it ^^
15:12:31 <tarpl> how do you no about my ban?
15:29:22 <Wolf01> Samu, what about making the tile flat and then raise the corners you need?
15:31:22 <Samu> i don't know what the corner is
15:31:43 <Wolf01> You know the direction of the dock
15:31:44 <Samu> Slope tileh_north_aqueduct = GetTileSlope(tile_start);
15:33:15 <Samu> Slope tileh_north_result = tileh_north_aqueduct (incredible bitmath operations) SLOPE_WITH_ONE_CORNER
15:34:13 <Wolf01> Doesn't matter, you have a direction
15:36:39 <Wolf01> Did you try with CmdLevelLand()?
15:37:34 <Samu> not sure what that one does
15:44:37 <Samu> hmm there is no area drag :(
15:50:00 <peter1138> hmm, new red dwarf tonight
15:56:53 *** sla_ro|master has joined #openttd
16:11:16 <Flygon_> It isn't out in Australia yet :(
16:11:19 *** Flygon_ is now known as Flygon
16:14:01 <Samu> SLOPE_STEEP_N ^(SLOPE_ELEVATED | SLOPE_STEEP) = SLOPE_S
16:14:16 <Samu> i want the opposite corner of SLOPE_S now
16:18:06 <Samu> the other side of the aqueduct got SLOPE_SW, the complement of this one is SLOPE_NE
16:27:36 <Samu> what's the operator that makes this: 10 (op) 11 = 01
16:37:43 *** JacobD88 has joined #openttd
16:39:14 <Samu> Slope tileh_north_result = IsSteepSlope(tileh_north_aqueduct) ? (tileh_north_aqueduct ^(SLOPE_ELEVATED | SLOPE_STEEP)) ^ tileh_end : ComplementSlope(tileh_end) & ~tileh_north_aqueduct;
16:39:50 <Samu> tileh_north_result is what the terraform command will do, and raise
16:42:51 <Samu> think i can safely remove the switch/case now
16:47:33 <Samu> and the same for the south
16:47:53 <Samu> Slope tileh_south_result = IsSteepSlope(tileh_south_aqueduct) ? (tileh_south_aqueduct ^ (SLOPE_ELEVATED | SLOPE_STEEP)) ^ tileh_start : ComplementSlope(tileh_start) & ~tileh_south_aqueduct;
16:50:46 <Samu> nop, im wrong, still crash, grrr i suck
16:53:59 <Samu> oh right, it's not SLOPE_W that I want, it's SLOPE_E :(
17:10:45 <Samu> how do i transform a corner into a slope?
17:18:19 *** Alberth has joined #openttd
17:18:19 *** ChanServ sets mode: +o Alberth
17:23:40 <Samu> SlopeWithOneCornerRaised(OppositeCorner(GetHighestSlopeCorner((tileh_north_aqueduct ^(SLOPE_ELEVATED | SLOPE_STEEP)) ^ tileh_end)))
17:25:14 <Samu> alright, i think i got it this time, :o
17:29:21 <Samu> Slope tileh_north_result = IsSteepSlope(tileh_north_aqueduct) ? SlopeWithOneCornerRaised(OppositeCorner(GetHighestSlopeCorner((tileh_north_aqueduct ^(SLOPE_ELEVATED | SLOPE_STEEP)) ^ tileh_end))) : ComplementSlope(tileh_end) & ~tileh_north_aqueduct;
17:29:37 <Samu> Slope tileh_south_result = IsSteepSlope(tileh_south_aqueduct) ? SlopeWithOneCornerRaised(OppositeCorner(GetHighestSlopeCorner((tileh_south_aqueduct ^ (SLOPE_ELEVATED | SLOPE_STEEP)) ^ tileh_start))) : ComplementSlope(tileh_start) & ~tileh_south_aqueduct;
17:29:52 <Samu> do yousee any means to simplify this?
17:35:01 <Samu> SlopeWithOneCornerRaised(OppositeCorner(GetHighestSlopeCorner((SLOPE_STEEP_N ^ (SLOPE_ELEVATED | SLOPE_STEEP)) ^ SLOPE_SW)))
17:37:10 <Samu> (SLOPE_STEEP_N ^ (SLOPE_ELEVATED | SLOPE_STEEP)) = SLOPE_S
17:37:31 <Samu> SLOPE_S ^ SLOPE_SW = SLOPE_W
17:38:36 <Samu> SlopeWithOneCornerRaised(OppositeCorner(GetHighestSlopeCorner(SLOPE_W))) = SLOPE_E
17:38:57 <Samu> that's the result I wanted
17:41:42 <Samu> can this expression/code be simplified? more readable?
17:43:46 <Alberth> don't use ? : , but an if statement
17:44:27 <Alberth> or you have 2 results, one north and one south?
17:44:40 <Alberth> looks like an awful lot of duplication in there
17:52:26 *** TheMask96 has joined #openttd
18:00:04 <Wolf01> Also if possible, make a generic function
18:02:05 <Wolf01> Do we have that on some trainset?
18:05:21 <Samu> i'm still getting crashes... sorry :(
18:14:20 <Samu> there is a swap in the middle of somewhere ruining the coordinates of the tile I'm about to terraform, arg!!! :(
18:15:14 <Samu> tile_end is sometimes tile_start and vice versa
18:16:06 <Samu> if (tile_end < tile_start) Swap(tile_start, tile_end);
18:22:54 <Eddi|zuHause> i would have assumed 2ccset already has every one-off prototype ever
18:23:04 <Eddi|zuHause> including future ones
18:25:34 <Eddi|zuHause> anyway, i'm sure LINT train sets were already part of some NewGRFs, and the propulsion method has no pracital impact on the game mechanics
18:29:07 <Wolf01> They could be even atomic ones, just use diesel-behavior :P
18:30:03 <supermop> Eddi|zuHause: small chance of train exploding?
18:30:29 <supermop> every train in game looks like it has a huge hydrogen tank on the roof when it crashes
18:30:50 <Wolf01> They should have run it with helium, zellepins teaches :P
18:32:42 <supermop> Wolf01: might be a bit harder to get that to burn in the fuel cell though
18:33:01 <Samu> it's not the tile swap, it's me
18:34:43 <supermop> i wonder, is building out the infrastructure for hydrogen fuel cell MUs really cheaper than using batteries or diesel hybrids?
18:35:21 <Eddi|zuHause> supermop: the article says the trains are probably more expensive than diesel
18:35:25 <Samu> i suck at bit operations
18:35:35 <supermop> seems battery technology would be at the point now where a train could easily lug around 1000kg or batteries and be set for even a long journey
18:35:42 <Eddi|zuHause> i can't imagine this being different for the infrastructure
18:36:06 <Eddi|zuHause> well, we had battery powered trains since like 100 years ago
18:36:19 <Samu> 1100 (operation) 1000 = 0100, what's the operation?
18:36:30 <Alberth> you need a lot of power for trains, much more than cars
18:36:34 <Eddi|zuHause> until they got phased out about 20 years ago
18:37:07 <supermop> yeah, seems like they would be even better today, with tesla and nissan and bmw selling significant numbers
18:37:40 <Alberth> Samu: that depends on what 100 (operation) 1000 should do
18:37:47 <supermop> Alberth: but a train on steel wheels is less penalized by carrying very heavy batteries around with it
18:38:26 <Samu> hmm 1100 ^ 0100 = 1000 ?
18:39:07 <Alberth> 0^0 -> 0 1^0 -> 1 0^1 -> 1 1^1 -> 0
18:40:03 <Samu> 1100 &~0100 = some ugly result that i do not want
18:40:35 <Samu> i got a negative number somehow
18:40:55 <Samu> there are no negative slopes
18:40:57 <Alberth> yep, the sign bit is also a bit :)
18:41:50 <Alberth> doing bit operations on signed values works, but the decoding to text makes a mess :)
18:42:09 <Alberth> it's more predictable to work with unsigned values
18:42:31 <Samu> operator~ returned -9 Slope
18:43:10 <Alberth> that's just how it gets printed
18:43:47 <Alberth> ie don't print it as a signed value
18:45:07 <Samu> ComplementSlope(tileh_start) ^ tileh_south_aqueduct
18:46:03 <Samu> i was having trouble with the non-steep slopes now, it's funny that i never get it right at the first try
18:46:30 <Samu> tileh_start SLOPE_NE (12) Slope
18:46:49 <Samu> tileh_south_aqueduct SLOPE_W (1) Slope
18:48:19 <Samu> ComplementSlope(SLOPE_NE) = SLOPE_SW
18:48:42 <Samu> SLOPE_SW ^ SLOPE_W = SLOPE_S, hopefully
18:49:21 <Samu> SLOPE_SW = 11, SLOPE_W = 1
18:50:37 <Samu> if 11 ^ 1 = 10, then I got this right
18:55:47 *** Progman has joined #openttd
19:01:34 *** frosch123 has joined #openttd
19:03:27 <Wolf01> Is there a function which does actions while dragging? I don't mean the VpStartPlaceSizing
19:03:58 <Eddi|zuHause> Wolf01: updating the measurement tooltips?
19:04:12 <Wolf01> Nah, terrain paintbrush
19:04:28 <Eddi|zuHause> i mean, the functions that update the selection and stuff
19:13:28 <Wolf01> Still bound to a rectangle in the map
19:23:44 *** mindlesstux has joined #openttd
19:23:56 <Samu> i found another crash, managed to find out why it was happening
19:24:22 <Samu> if (!IsInclinedSlope(tileh_north_aqueduct)) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
19:25:45 <Samu> if (!IsInclinedSlope(tileh_south_aqueduct)) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
19:26:00 <Samu> this fixes it, before it starts doing the terraform
19:26:31 <Samu> i need a new string STR_ERROR_UNABLE_TO_EXCAVATE_LAND
19:26:48 <Samu> this says unable to excavate land at the other side of tunnel
19:27:04 <Samu> i want a unable to raise land at the other side of aqueduct
19:27:32 <Samu> or re-use another message that suits this
19:55:13 <Samu> what's the opposite of excavate
19:56:25 <Samu> "Unable to 'abcde' at the other side of aqueduct"
19:57:17 <Samu> "Unable to 'abcde' land at the other side of aqueduct" typo
20:00:27 *** gelignite has joined #openttd
20:05:35 <Wolf01> frosch123, could I ask some questions?
20:08:40 <supermop> Samu: alter is probably easiest word
20:09:28 <Eddi|zuHause> Wolf01: have you ever read the topic?
20:10:37 <Wolf01> I'm asking directly to frosch, maybe he has other things to do, but if you want to help me instead...
20:11:37 <Wolf01> I'm trying to make a continuous level land tool with gui resizable brush like the raise/lower land
20:12:37 <Wolf01> And I have a little problem calculating the right mode (0 = lower; 1 = raise) to use
20:15:20 <Eddi|zuHause> yo mean, like, compare the current height to the desired height?
20:15:34 <Wolf01> Yes, but for eachh tile
20:16:32 <Eddi|zuHause> isn't there like a TILE_LOOP macro?
20:17:03 <Wolf01> Yes it is, I copied the CommonRaiseLowerBigLand
20:17:43 <Wolf01> But I removed the part which calculates "h" as I have no mode (raise or lower)
20:18:41 <Eddi|zuHause> can you give a link to the code? because i'm having difficulty understanding what your actual problem is
20:18:50 <Wolf01> And if I just put a TileHeight(tile2) > TileHeight(tile) ? 0 : 1 it doesn't work right in most situations
20:20:01 <Wolf01> I think I could just update that patch
20:20:13 <Wolf01> But for scenario editor only
20:24:00 <Wolf01> The nice part is that I started with the VpStart*(), but I ended up doing another function like the one for the raise/lower
20:35:32 <Wolf01> And I just noticed I'm trying to do the suggestions I posted on that topic... I think those things were printed with fire in my subconscious
20:37:46 <Samu> STR_ERROR_UNABLE_TO_SMOOTH_LAND_AQUEDUCT :{WHITE}Unable to smooth land for other end of aqueduct
20:43:07 *** andythenorth has joined #openttd
20:43:15 <Wolf01> Mmmh, roujin used WindowEvent, which counterpart has it now?
20:47:21 <Wolf01> Samu, I like the bridge over locks patch, but I think the min bridge height should be 2
20:49:19 <Samu> first time someone likes something i do
20:49:48 <Samu> i'm still getting trouble with the darn terraform command
20:51:08 <Wolf01> Would like to help, but I'm already confused with my stuff about terraform... and mine should be easy, it's only the interface process which need to change
20:52:06 <Alberth> what does WindowEvent do?
20:52:23 <Samu> there is a swap happening and i still didn't get the correct handling of this swap
20:52:24 <Alberth> we don't have that one :p
20:53:19 <Wolf01> In the patch seem to be used to get the coordinates of the tile under the mouse
20:56:04 <Wolf01> No, but looks like the HandlePlacePresize()
20:57:39 <Alberth> sounds better than OnMouseLoop :)
20:58:22 <Wolf01> Window shouldn't be a problem, the problem is WindowEvent
21:00:44 <Alberth> maybe it is some sort of mouse mode now
21:01:14 <Wolf01> Probably OnMouseDrag or such
21:01:21 <Alberth> ie WindowEvent sounds like a very low level DIY
21:02:36 <Wolf01> I'll try with your first suggestion, OnMouseLoop
21:03:10 <Alberth> tree_gui does dragging stuff, maybe steal that
21:03:46 <Alberth> OnPlaceObject / OnPlaceDrag / OnPlaceMouseUp
21:09:53 <Samu> if (!IsInclinedSlope(tileh_south_aqueduct) && !IsInclinedSlope(GetTileSlope(tile_start))) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
21:10:01 <Samu> if (!IsInclinedSlope(tileh_north_aqueduct) && !IsInclinedSlope(GetTileSlope(tile_end))) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
21:11:25 <Alberth> I don't even know what it means :)
21:11:27 <Samu> there's a tile_start and tile_end swap happening and it is ruining my code
21:11:36 <Samu> sec, let me bring up the line
21:12:19 <Wolf01> Uh, nice, I did it, 3 lines of code...
21:12:40 <Wolf01> Now I just need to make it work as intended
21:13:16 <Wolf01> OnMouseLoop is too fast
21:13:22 <Wolf01> It triggers 4253465436 times
21:13:29 <Wolf01> I'm trying with OnHundredthTick
21:14:26 <Samu> i'm adding the terraform code between lines 392, 393 and lines 401, 402
21:17:53 <Alberth> wow, that bridge code can update an existing bridge
21:20:27 <frosch123> it even works on town-owned bridges
21:20:39 <frosch123> when you increase the speed limit
21:21:28 <Alberth> line 301 sorts the bridge ends, so how does it ever get swapped?
21:31:16 <Samu> let me copy paste my code
21:33:36 <Samu> lines 165 to 195, then lines 203 to 233
21:37:56 <Samu> i think my code isn't 100% ready to deal with the swap happening or not happening
21:43:51 <Alberth> so what variable do you use from before the swap? I don't see it
21:45:02 <Alberth> they're swapped if needed at line 74 in your code
21:45:18 <Alberth> so they are always in the same order
21:46:15 <Alberth> if you start modifying after that, and not use variables from before, you can't have a wrong order, as there is only one
21:46:58 *** sim-al2 has joined #openttd
21:47:16 <Samu> sometimes tile_start is the tile that is on the cursor, sometimes it is the tile at the other side of the aqueduct
21:47:38 <Samu> and yet they're still called tile_start
21:50:41 <Samu> i need to create an error depending on the current slope configuration of the tile that is on the cursor
21:51:20 <Samu> if (!IsInclinedSlope(tileh_north_aqueduct) && !IsInclinedSlope(GetTileSlope(tile_end))) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
21:52:37 *** HerzogDeXtEr has joined #openttd
21:53:12 <Alberth> where you started building a bridge is lost after line 74
21:53:38 <Alberth> tile_start is the smallest tile, always after line 74
21:54:32 <Alberth> if you want to preserve that information, you need to introduce new variables for the sorted tiles
21:56:26 <Alberth> but losing where you started building seems like a good thing to me, it means it makes no difference how you lay down the bridge, you'll always get the same result
21:57:47 <Samu> there is a weird behaviour happening when clicking on non-inclined slope
21:59:09 <Samu> sometimes with an assert
22:01:21 <Samu> * @param p1 packed start tile coords (~ dx)
22:01:53 <Samu> * @param end_tile end tile
22:02:38 <Samu> which one is the cursor?
22:05:18 <Wolf01> (also it raises only, I want it to get the height of the tile under the mouse and apply that)
22:09:20 <Samu> there's a end_tile and a tile_end
22:09:25 <Wolf01> Eh, I have only "direction" -> up/down
22:10:07 <Wolf01> I should use the TerraformTileHeight directly, but I don't want to reinvent the wheel
22:10:45 <Alberth> there is no cursor any more
22:13:42 <Samu> end_tile is always the same, doesn't swap
22:14:02 <Samu> tile_end can swap with tile_start
22:14:11 <Samu> tile_start can swap with tile_end
22:15:14 <Samu> end_tile is the tile where the cursor clicked
22:15:37 <Samu> p1 is the other side of the aqueduct
22:15:51 <Samu> let's see if this is always true in every case
22:23:38 <Wolf01> Would it be possible to change the _multi_terraform_coords array to put in the center the tile under the mouse?
22:41:47 <Samu> DC_AUTO | DC_NO_WATER (10) - grrr, how do i remove the DC_NO_WATER
22:42:22 <Samu> ret = DoCommand(tile_start, tileh_north_aqueduct, 1, flags, CMD_TERRAFORM_LAND);
22:43:25 <Samu> bridges can't be built on water, that's fine, but for the terraform command, i might think it's a good idea that water can be altere
22:43:33 <Wolf01> How did you remove slopes before
22:43:58 <Wolf01> Or you can prepare the terrain before building the bridge
22:44:34 <Wolf01> (checking for ret.Error() to be false before building the bridge)
22:46:19 <Samu> m1 DC_EXEC | DC_AUTO | DC_QUERY_COST | DC_BANKRUPT | DC_NO_CARGO_CAP_CHECK | 8192 (8519) DoCommandFlag
22:48:06 <Samu> flags DC_QUERY_COST | DC_NO_WATER | DC_BANKRUPT | DC_AUTOREPLACE | DC_NO_MODIFY_TOWN_RATING | DC_FORCE_CLEAR_TILE | -858996736 (-858993460) DoCommandFlag
22:48:24 <Samu> flags DC_AUTO | DC_NO_WATER (10) DoCommandFlag
22:48:38 <Samu> darn it, i want to get rid of DC_NO_WATER
22:49:22 <Samu> flags DC_AUTO (2) DoCommandFlag
22:49:43 <Samu> ret = DoCommand(tile_start, tileh_north_aqueduct, 1, flags & ~DC_NO_WATER, CMD_TERRAFORM_LAND);
22:50:59 *** Keridos has joined #openttd
23:12:19 *** Biolunar has joined #openttd
23:28:36 <Samu> I think i'm done with aqueducts
23:28:43 <Samu> i'm not getting any errors now
23:29:28 <Samu> aqueduct pricing is still ridiculously high
23:29:39 <Samu> but that's another matter
23:29:56 <Wolf01> Nah, I think an aqueduct costs way more than a bridge also for real
23:32:12 <Samu> ridiculous price of aqueduct + price of leveling land on water
23:41:42 *** Supercheese has joined #openttd
continue to next day ⏵