> + /// <summary>
> + /// Total minutes from the start of the game.
> + /// </summary>
> + public static TimeLength pastMinutesToday() {
> + Clock c = World.world.clock;
> + return fromMinutes( c.totalMinutes%Time.DAY );
> + }
うーん。Clockを無条件で参照するよりは、Time型に
/// <summary>
/// Returns the new time instant t such that
///
/// 1) t.hour=hour argument
/// 2) t.minutes=minutes argument
/// 3) t < this
/// 4) no other t' > t satisfies the above properties
/// </summary>
public Time getPreviousInstant( int hour, int minutes ) {
long t = (totalMinutse%DAY)+hour*24+minutes;
while( t >= totalMinutes )
t -= DAY;
return new Time(t);
}
/// <summary>
/// Returns the new time instant t such that
///
/// 1) t.hour=hour argument
/// 2) t.minutes=minutes argument
/// 3) t > this
/// 4) no other t' < t satisfies the above properties
/// </summary>
public Time getNextInstant( int hour, int minutes ) {
long t = (totalMinutse%DAY)+hour*24+minutes;
while( t < totalMinutes )
t += DAY;
return new Time(t);
}
のほうがいいかな。
川口耕介 / kk@kohsuke.org
_______________________________________________
FreeTrain-general mailing list
FreeTrain-general@lists.sourceforge.jp
http://lists.sourceforge.jp/mailman/listinfo/freetrain-general