OpenRCT2/src/util.c

42 lines
1.3 KiB
C

/*****************************************************************************
* Copyright (c) 2014 Ted John
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include "util.h"
int squaredmetres_to_squaredfeet(int squaredMetres)
{
// 1 metre squared = 10.7639104 feet squared
// RCT2 approximates as 11
return squaredMetres * 11;
}
int metres_to_feet(int metres)
{
// 1 metre = 3.2808399 feet
// RCT2 approximates as 3.28125
return (metres * 840) / 256;
}
int mph_to_kmph(int mph)
{
// 1 mph = 1.60934 kmph
// RCT2 approximates as 1.609375
return (mph * 1648) / 1024;
}