aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2018-02-07 22:29:08 +0100
committerGitHub <noreply@github.com>2018-02-07 22:29:08 +0100
commit06cdb14f3d28780f011d842c17580c748d2020f2 (patch)
tree29828feabd1eeba06500066e6d62cf07ebcba0c4
parentc93a5bf39043651cf5b4ef486541d86644dc169f (diff)
downloadadvtrains-06cdb14f3d28780f011d842c17580c748d2020f2.tar.gz
advtrains-06cdb14f3d28780f011d842c17580c748d2020f2.tar.bz2
advtrains-06cdb14f3d28780f011d842c17580c748d2020f2.zip
Do not crash when player gets on a train while it`s turning
-rw-r--r--advtrains/wagons.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua
index ee668ac..fd01abd 100644
--- a/advtrains/wagons.lua
+++ b/advtrains/wagons.lua
@@ -526,7 +526,7 @@ function wagon:on_step(dtime)
self.player_yaw[name] = p:get_look_horizontal()-self.old_yaw
end
-- set player looking direction using calculated offset
- p:set_look_horizontal(self.player_yaw[name]+yaw)
+ p:set_look_horizontal((self.player_yaw[name] or 0)+yaw)
end
end
self.turning = true
an class="hl com">but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef HTTPFETCH_HEADER #define HTTPFETCH_HEADER #include <vector> #include "util/string.h" #include "config.h" // Can be used in place of "caller" in asynchronous transfers to discard result // (used as default value of "caller") #define HTTPFETCH_DISCARD 0 #define HTTPFETCH_SYNC 1 struct HTTPFetchRequest { std::string url; // Identifies the caller (for asynchronous requests) // Ignored by httpfetch_sync unsigned long caller; // Some number that identifies the request // (when the same caller issues multiple httpfetch_async calls) unsigned long request_id; // Timeout for the whole transfer, in milliseconds long timeout; // Timeout for the connection phase, in milliseconds long connect_timeout; // Indicates if this is multipart/form-data or // application/x-www-form-urlencoded. POST-only. bool multipart; // POST fields. Fields are escaped properly. // If this is empty a GET request is done instead. StringMap post_fields; // Raw POST data, overrides post_fields. std::string post_data; // If not empty, should contain entries such as "Accept: text/html" std::vector<std::string> extra_headers; //useragent to use std::string useragent; HTTPFetchRequest(); }; struct HTTPFetchResult { bool succeeded; bool timeout; long response_code; std::string data; // The caller and request_id from the corresponding HTTPFetchRequest. unsigned long caller; unsigned long request_id; HTTPFetchResult() { succeeded = false; timeout = false; response_code = 0;