Skip to content

Commit 7cb199f

Browse files
committed
avoid issues with zero-length routines
1 parent dd5352e commit 7cb199f

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

game/world/objects/npc.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,6 +3091,7 @@ gtime Npc::endTime(const Npc::Routine &r) const {
30913091
auto wtime = owner.time();
30923092
auto time = wtime.timeInDay();
30933093

3094+
//NOTE: should we consider time extension for invalid routine sequences?
30943095
if(r.end<r.start) {
30953096
if(time<r.end)
30963097
return gtime(wtime.day(),r.end.hour(),r.end.minute());
@@ -3101,6 +3102,10 @@ gtime Npc::endTime(const Npc::Routine &r) const {
31013102
return gtime(wtime.day()+1,r.end.hour(),r.end.minute()); else
31023103
return gtime(wtime.day(),r.end.hour(),r.end.minute());
31033104
}
3105+
if(r.start==r.end && r.end.toInt()==0) {
3106+
// for example Rtn_Start_1081 in NTR is filled with zeros
3107+
return gtime(wtime.day()+1,r.end.hour(),r.end.minute());
3108+
}
31043109
// error - routine is not active now
31053110
return wtime;
31063111
}

game/world/world.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ WayPath World::wayTo(const Npc &npc, const WayPoint &end) const {
10151015
return wmatrix->wayTo(wpoint.data(),wpoint.size(),p,end);
10161016
}
10171017

1018-
GameScript &World::script() const {
1018+
GameScript& World::script() const {
10191019
return *game.script();
10201020
}
10211021

0 commit comments

Comments
 (0)