openttd updated to 1.5.0-beta2

--HG--
branch : openttd
This commit is contained in:
Pavel Stupnikov
2015-03-01 00:30:53 +03:00
parent 0abb47ce90
commit d201932121
682 changed files with 26103 additions and 16553 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: engine.cpp 25640 2013-07-31 07:30:18Z alberth $ */
/* $Id: engine.cpp 26802 2014-09-07 16:12:58Z alberth $ */
/*
* This file is part of OpenTTD.
@@ -35,6 +35,8 @@
#include "table/strings.h"
#include "table/engines.h"
#include "safeguards.h"
EnginePool _engine_pool("Engine");
INSTANTIATE_POOL_METHODS(Engine)
@@ -653,6 +655,7 @@ void StartupOneEngine(Engine *e, Date aging_date)
e->age = 0;
e->flags = 0;
e->company_avail = 0;
e->company_hidden = 0;
/* Don't randomise the start-date in the first two years after gamestart to ensure availability
* of engines in early starting games.
@@ -851,6 +854,41 @@ void EnginesDailyLoop()
}
}
/**
* Clear the 'hidden' flag for all engines of a new company.
* @param cid Company being created.
*/
void ClearEnginesHiddenFlagOfCompany(CompanyID cid)
{
Engine *e;
FOR_ALL_ENGINES(e) {
SB(e->company_hidden, cid, 1, 0);
}
}
/**
* Set the visibility of an engine.
* @param tile Unused.
* @param flags Operation to perform.
* @param p1 Unused.
* @param p2 Bit 31: 0=visible, 1=hidden, other bits for the #EngineID.
* @param text Unused.
* @return The cost of this operation or an error.
*/
CommandCost CmdSetVehicleVisibility(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Engine *e = Engine::GetIfValid(GB(p2, 0, 31));
if (e == NULL || _current_company >= MAX_COMPANIES) return CMD_ERROR;
if ((e->flags & ENGINE_AVAILABLE) == 0 || !HasBit(e->company_avail, _current_company)) return CMD_ERROR;
if ((flags & DC_EXEC) != 0) {
SB(e->company_hidden, _current_company, 1, GB(p2, 31, 1));
AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type);
}
return CommandCost();
}
/**
* Accept an engine prototype. XXX - it is possible that the top-company
* changes while you are waiting to accept the offer? Then it becomes invalid
@@ -1025,7 +1063,7 @@ CommandCost CmdRenameEngine(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
if (reset) {
e->name = NULL;
} else {
e->name = strdup(text);
e->name = stredup(text);
}
MarkWholeScreenDirty();