diff options
-rw-r--r-- | advtrains/helpers.lua | 3 | ||||
-rw-r--r-- | advtrains/lzb.lua | 2 | ||||
-rw-r--r-- | advtrains/nodedb.lua | 8 | ||||
-rw-r--r-- | advtrains/path.lua | 4 | ||||
-rw-r--r-- | advtrains/trainlogic.lua | 2 |
5 files changed, 18 insertions, 1 deletions
diff --git a/advtrains/helpers.lua b/advtrains/helpers.lua index cf890ca..cc95da2 100644 --- a/advtrains/helpers.lua +++ b/advtrains/helpers.lua @@ -308,6 +308,7 @@ function advtrains.get_adjacent_rail(this_posnr, this_conns_p, conn_idx, drives_ return nil end + tracy.ZoneBeginN("advtrains.get_adjacent_rail") local conn = this_conns[conn_idx] local conn_y = conn.y or 0 local adj_pos = advtrains.dirCoordSet(this_pos, conn.c); @@ -323,10 +324,12 @@ function advtrains.get_adjacent_rail(this_posnr, this_conns_p, conn_idx, drives_ conn_y = conn_y + 1 nextnode_ok, nextconns, nextrail_y=advtrains.get_rail_info_at(adj_pos, drives_on) if not nextnode_ok then + tracy.ZoneEnd() return nil end end local adj_connid = advtrains.conn_matches_to({c=conn.c, y=conn_y}, nextconns) + tracy.ZoneEnd() if adj_connid then return adj_pos, adj_connid, conn_idx, nextrail_y, nextconns end diff --git a/advtrains/lzb.lua b/advtrains/lzb.lua index 5883a55..918d78d 100644 --- a/advtrains/lzb.lua +++ b/advtrains/lzb.lua @@ -241,6 +241,7 @@ end -- If you DON'T modify lzbdata, you MUST pass nil as lzbdata. Always modify the lzbdata table in place, never overwrite it! -- udata: user-defined data, do not use externally function advtrains.lzb_add_checkpoint(train, index, speed, callback, lzbdata, udata) + tracy.ZoneBeginN("advtrains.lzb_add_checkpoint") local lzb = train.lzb local pos = advtrains.path_get(train, index) local lzbdata_c = nil @@ -260,6 +261,7 @@ function advtrains.lzb_add_checkpoint(train, index, speed, callback, lzbdata, ud table.insert(lzb.checkpoints, ckp) apply_checkpoint_to_path(train, ckp) + tracy.ZoneEnd() end diff --git a/advtrains/nodedb.lua b/advtrains/nodedb.lua index 41ac089..51f0e24 100644 --- a/advtrains/nodedb.lua +++ b/advtrains/nodedb.lua @@ -269,17 +269,23 @@ end --nil if the node is neither loaded nor in trackdb --the distraction between false and nil will be needed only in special cases.(train initpos) function advtrains.get_rail_info_at(pos, drives_on) + tracy.ZoneBegin("advtrains.get_rail_info_at") local rdp=advtrains.round_vector_floor_y(pos) local node=ndb.get_node_or_nil(rdp) - if not node then return end + if not node then + tracy.ZoneEnd() + return + end local nodename=node.name if(not advtrains.is_track_and_drives_on(nodename, drives_on)) then + tracy.ZoneEnd() return false end local conns, railheight, tracktype=advtrains.get_track_connections(node.name, node.param2) + tracy.ZoneEnd() return true, conns, railheight end diff --git a/advtrains/path.lua b/advtrains/path.lua index 65b7002..9fcfe5d 100644 --- a/advtrains/path.lua +++ b/advtrains/path.lua @@ -206,6 +206,7 @@ function advtrains.path_get(train, index) local pef = train.path_ext_f -- generate forward (front of train, positive) while index > pef do + tracy.ZoneBeginN("advtrains.path_get:forward") local pos = train.path[pef] local connid = train.path_cn[pef] local node_ok, this_conns, adj_pos, adj_connid, conn_idx, nextrail_y, next_conns @@ -238,6 +239,7 @@ function advtrains.path_get(train, index) end train.path[pef] = adj_pos train.path_dist[pef] = train.path_dist[pef-1] + vector.distance(pos, adj_pos) + tracy.ZoneEnd() end train.path_ext_f = pef @@ -245,6 +247,7 @@ function advtrains.path_get(train, index) local peb = train.path_ext_b -- generate backward (back of train, negative) while index < peb do + tracy.ZoneBeginN("advtrains.path_get:backward") local pos = train.path[peb] local connid = train.path_cp[peb] local node_ok, this_conns, adj_pos, adj_connid, conn_idx, nextrail_y, next_conns @@ -277,6 +280,7 @@ function advtrains.path_get(train, index) end train.path[peb] = adj_pos train.path_dist[peb] = train.path_dist[peb+1] - vector.distance(pos, adj_pos) + tracy.ZoneEnd() end train.path_ext_b = peb diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua index 5c40ce0..5b9e9ef 100644 --- a/advtrains/trainlogic.lua +++ b/advtrains/trainlogic.lua @@ -858,9 +858,11 @@ local function mknodecallback(name) end end return callt, function(pos, id, train, index, paramx1, paramx2, paramx3) + tracy.ZoneBegin("advtrains.run_callbacks_" .. name .. "node") for _,f in ipairs(callt) do f(pos, id, train, index, paramx1, paramx2, paramx3) end + tracy.ZoneEnd() end end |