News:

The Forum Rules and Guidelines
Our forum has Rules and Guidelines. Please, be kind and read them ;).

Metric units?

Started by Spike, February 29, 2012, 11:10:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Spike

I came across this:

  const int left_shift = ticks_per_world_month_shift - YARDS_PER_TILE_SHIFT;

Can we agree to use metric units, if we need to use real world units in the code? Metric units have the benefit that they can be converted into each other by powers of 10, and not with a 3 or 12 base, or even a fractional base.

Dwachs

These yards are an artificial small unit, they do not correspond to a real unit. They were introduced to give names to hard-coded bit-shifts in the vehicle movement code.
Parsley, sage, rosemary, and maggikraut.

Spike

Ok. You see you already confused one person by re-using a word with a new semantic :D

For artificial time units I often see "ticks" being used. I don't really know something like that for distances. "step" is already used in Simutrans - If I would know that the "YARDS_PER_TILE_SHIFT" is actually doing, I might be able to find a good name.



Dwachs

simunits.h:

* 5 -- "yards" -- tiny distance units used internally
        -- 2^12 per vehicle steps, by definition
-- 2^16 per vehicle steps in older code
-- chosen to maximize precision of certain interfaces


Why call it yard? Probably there are no other 4-letter words (step is already taken) ?
Parsley, sage, rosemary, and maggikraut.