mirror of https://github.com/OpenTTD/OpenTTD
(svn r166) -Codechange: change 74 for constant DAY_TICKS
parent
bf0652d3fc
commit
aa02125158
2
ai.h
2
ai.h
|
@ -134,7 +134,7 @@
|
||||||
#define AI_CHECK_MAX_VEHICLE_PER_STATION 10
|
#define AI_CHECK_MAX_VEHICLE_PER_STATION 10
|
||||||
|
|
||||||
// How many thick between building 2 vehicles
|
// How many thick between building 2 vehicles
|
||||||
#define AI_BUILD_VEHICLE_TIME_BETWEEN 74
|
#define AI_BUILD_VEHICLE_TIME_BETWEEN DAY_TICKS
|
||||||
|
|
||||||
// How many days must there between vehicle checks
|
// How many days must there between vehicle checks
|
||||||
// The more often, the less non-money-making lines there will be
|
// The more often, the less non-money-making lines there will be
|
||||||
|
|
7
ai_new.c
7
ai_new.c
|
@ -65,8 +65,7 @@ static void AiNew_State_FirstTime(Player *p) {
|
||||||
static void AiNew_State_Nothing(Player *p) {
|
static void AiNew_State_Nothing(Player *p) {
|
||||||
assert(p->ainew.state == AI_STATE_NOTHING);
|
assert(p->ainew.state == AI_STATE_NOTHING);
|
||||||
// If we are done idling, start over again
|
// If we are done idling, start over again
|
||||||
// There go 74 ticks in a day
|
if (p->ainew.idle == 0) p->ainew.idle = RandomRange(DAY_TICKS * 2) + DAY_TICKS;
|
||||||
if (p->ainew.idle == 0) p->ainew.idle = RandomRange(74 * 2) + 74;
|
|
||||||
if (--p->ainew.idle == 0) {
|
if (--p->ainew.idle == 0) {
|
||||||
// We are done idling.. what you say? Let's do something!
|
// We are done idling.. what you say? Let's do something!
|
||||||
// I mean.. the next tick ;)
|
// I mean.. the next tick ;)
|
||||||
|
@ -831,7 +830,7 @@ static int AiNew_HowManyVehicles(Player *p) {
|
||||||
length = p->ainew.path_info.route_length;
|
length = p->ainew.path_info.route_length;
|
||||||
// Calculating tiles a day a vehicle moves is not easy.. this is how it must be done!
|
// Calculating tiles a day a vehicle moves is not easy.. this is how it must be done!
|
||||||
// ROAD_ENGINES_INDEX is because the first roadveh engine is ROAD_ENGINES_INDEX, and _roadveh_speed starts from 0
|
// ROAD_ENGINES_INDEX is because the first roadveh engine is ROAD_ENGINES_INDEX, and _roadveh_speed starts from 0
|
||||||
tiles_a_day = _roadveh_speed[i-ROAD_ENGINES_INDEX] * 74 / 256 / 16;
|
tiles_a_day = _roadveh_speed[i-ROAD_ENGINES_INDEX] * DAY_TICKS / 256 / 16;
|
||||||
// We want a vehicle in a station once a month at least, so, calculate it!
|
// We want a vehicle in a station once a month at least, so, calculate it!
|
||||||
// (the * 2 is because we have 2 stations ;))
|
// (the * 2 is because we have 2 stations ;))
|
||||||
amount = ((int)(((float)length / (float)tiles_a_day / 30 * 2))) * 2;
|
amount = ((int)(((float)length / (float)tiles_a_day / 30 * 2))) * 2;
|
||||||
|
@ -847,7 +846,7 @@ static int AiNew_HowManyVehicles(Player *p) {
|
||||||
length = p->ainew.path_info.route_length;
|
length = p->ainew.path_info.route_length;
|
||||||
// Calculating tiles a day a vehicle moves is not easy.. this is how it must be done!
|
// Calculating tiles a day a vehicle moves is not easy.. this is how it must be done!
|
||||||
// ROAD_ENGINES_INDEX is because the first roadveh engine is ROAD_ENGINES_INDEX, and _roadveh_speed starts from 0
|
// ROAD_ENGINES_INDEX is because the first roadveh engine is ROAD_ENGINES_INDEX, and _roadveh_speed starts from 0
|
||||||
tiles_a_day = _roadveh_speed[i-ROAD_ENGINES_INDEX] * 74 / 256 / 16;
|
tiles_a_day = _roadveh_speed[i-ROAD_ENGINES_INDEX] * DAY_TICKS / 256 / 16;
|
||||||
if (p->ainew.from_deliver)
|
if (p->ainew.from_deliver)
|
||||||
max_cargo = DEREF_INDUSTRY(p->ainew.from_ic)->total_production[0];
|
max_cargo = DEREF_INDUSTRY(p->ainew.from_ic)->total_production[0];
|
||||||
else
|
else
|
||||||
|
|
|
@ -667,7 +667,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
|
||||||
if (p2->is_active)
|
if (p2->is_active)
|
||||||
UpdateCompanyRatingAndValue(p2, false);
|
UpdateCompanyRatingAndValue(p2, false);
|
||||||
|
|
||||||
w->custom[0] = 74;
|
w->custom[0] = DAY_TICKS;
|
||||||
w->custom[1] = 5;
|
w->custom[1] = 5;
|
||||||
|
|
||||||
w->click_state = 1 << 13;
|
w->click_state = 1 << 13;
|
||||||
|
@ -679,7 +679,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
// Update the player score every 5 days
|
// Update the player score every 5 days
|
||||||
if (--w->custom[0] == 0) {
|
if (--w->custom[0] == 0) {
|
||||||
w->custom[0] = 74;
|
w->custom[0] = DAY_TICKS;
|
||||||
if (--w->custom[1] == 0) {
|
if (--w->custom[1] == 0) {
|
||||||
Player *p2;
|
Player *p2;
|
||||||
w->custom[1] = 5;
|
w->custom[1] = 5;
|
||||||
|
|
|
@ -494,7 +494,7 @@ Player *DoStartupNewPlayer(bool is_ai)
|
||||||
void StartupPlayers()
|
void StartupPlayers()
|
||||||
{
|
{
|
||||||
// The AI starts like in the setting with +2 month max
|
// The AI starts like in the setting with +2 month max
|
||||||
_next_competitor_start = _opt.diff.competitor_start_time * 90 * 74 + RandomRange(60 * 74) + 1;
|
_next_competitor_start = _opt.diff.competitor_start_time * 90 * DAY_TICKS + RandomRange(60 * DAY_TICKS) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MaybeStartNewPlayer()
|
static void MaybeStartNewPlayer()
|
||||||
|
@ -513,7 +513,7 @@ static void MaybeStartNewPlayer()
|
||||||
DoStartupNewPlayer(true);
|
DoStartupNewPlayer(true);
|
||||||
|
|
||||||
// The next AI starts like the difficulty setting said, with +2 month max
|
// The next AI starts like the difficulty setting said, with +2 month max
|
||||||
_next_competitor_start = _opt.diff.competitor_start_time * 90 * 74 + RandomRange(60 * 74) + 1;
|
_next_competitor_start = _opt.diff.competitor_start_time * 90 * DAY_TICKS + RandomRange(60 * DAY_TICKS) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializePlayers()
|
void InitializePlayers()
|
||||||
|
|
Loading…
Reference in New Issue