From 9f6ae55e37141e8e446e6229132495e69b0e31ad Mon Sep 17 00:00:00 2001 From: orwell96 Date: Mon, 29 Oct 2018 16:04:36 +0100 Subject: Small fixes which do not have any effect --- advtrains/trainlogic.lua | 1 + advtrains/wagons.lua | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'advtrains') diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua index 15d8871..3d0b3d4 100644 --- a/advtrains/trainlogic.lua +++ b/advtrains/trainlogic.lua @@ -258,6 +258,7 @@ function advtrains.train_ensure_init(id, train) atwarn("Train",id,": Can't initialize: Waiting for the (yet unloaded) node at",train.last_pos," to be loaded.") end train.wait_for_path = true + return end -- by now, we should have a working initial path train.wait_for_path = false diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua index c532d30..1621da8 100644 --- a/advtrains/wagons.lua +++ b/advtrains/wagons.lua @@ -864,7 +864,7 @@ function wagon:handle_bordcom_fields(pname, formname, fields) local data = advtrains.wagons[self.id] local seatno=self:get_seatno(pname) - if not seatno or not self.seat_groups[self.seats[seatno].group].driving_ctrl_access or not advtrains.check_driving_couple_protection(pname, self.owner, self.whitelist) then + if not seatno or not self.seat_groups[self.seats[seatno].group].driving_ctrl_access or not advtrains.check_driving_couple_protection(pname, data.owner, data.whitelist) then return end local train = self:train() @@ -1053,7 +1053,8 @@ function wagon:seating_from_key_helper(pname, fields, no) end end function wagon:check_seat_group_access(pname, sgr) - if self.seat_groups[sgr].driving_ctrl_access and not (advtrains.check_driving_couple_protection(pname, self.owner, self.whitelist)) then + local data = advtrains.wagons[self.id] + if self.seat_groups[sgr].driving_ctrl_access and not (advtrains.check_driving_couple_protection(pname, data.owner, data.whitelist)) then return false, "Not allowed to access a driver stand!" end if self.seat_groups[sgr].driving_ctrl_access then -- cgit v1.2.3