From: Mircea Kitsune Date: Thu, 24 May 2012 12:50:56 +0000 (+0300) Subject: Don't tokenize self.platmovetype on each path_corner, and instead store the train... X-Git-Tag: xonotic-v0.8.0~295^2~25 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a07b6f62d3ca89cac710288ca0dd55213442baa5;p=xonotic%2Fxonotic-data.pk3dir.git Don't tokenize self.platmovetype on each path_corner, and instead store the train's defaults in values to restore them --- diff --git a/qcsrc/server/t_plats.qc b/qcsrc/server/t_plats.qc index fcad92f69..68a4fc57f 100644 --- a/qcsrc/server/t_plats.qc +++ b/qcsrc/server/t_plats.qc @@ -182,6 +182,7 @@ void plat_reset() } } +.float platmovetype_start_default, platmovetype_end_default; float set_platmovetype(entity e, string s) { // sets platmovetype_start and platmovetype_end based on a string consisting of two values @@ -347,11 +348,18 @@ void train_next() if (!self.wait) self.wait = 0.1; - // override train movement type if necessary if(targ.platmovetype_start || targ.platmovetype_end) - set_platmovetype(self, targ.platmovetype); + { + // this path_corner contains a movetype overrider, apply it + self.platmovetype_start = targ.platmovetype_start; + self.platmovetype_end = targ.platmovetype_end; + } else - set_platmovetype(self, self.platmovetype); + { + // this path_corner doesn't contain a movetype overrider, use the train's defaults + self.platmovetype_start = self.platmovetype_start_default; + self.platmovetype_end = self.platmovetype_end_default; + } if (targ.speed) { @@ -418,6 +426,8 @@ void spawnfunc_func_train() self.dmgtime2 = time; set_platmovetype(self, self.platmovetype); + self.platmovetype_start_default = self.platmovetype_start; + self.platmovetype_end_default = self.platmovetype_end; // TODO make a reset function for this one }