forked from mirror/OpenTTD
Codechange: Un-bitstuff the remaining on-map commands.
This commit is contained in:
@@ -199,18 +199,15 @@ static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags);
|
||||
* Build an object object
|
||||
* @param flags type of operation
|
||||
* @param tile tile where the object will be located
|
||||
* @param p1 the object type to build
|
||||
* @param p2 the view for the object
|
||||
* @param text unused
|
||||
* @param type the object type to build
|
||||
* @param view the view for the object
|
||||
* @return the cost of this operation or an error
|
||||
*/
|
||||
CommandCost CmdBuildObject(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32 p2, const std::string &text)
|
||||
CommandCost CmdBuildObject(DoCommandFlag flags, TileIndex tile, ObjectType type, uint8 view)
|
||||
{
|
||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||
|
||||
ObjectType type = (ObjectType)GB(p1, 0, 16);
|
||||
if (type >= NUM_OBJECTS) return CMD_ERROR;
|
||||
uint8 view = GB(p2, 0, 2);
|
||||
const ObjectSpec *spec = ObjectSpec::Get(type);
|
||||
if (_game_mode == GM_NORMAL && !spec->IsAvailable() && !_generating_world) return CMD_ERROR;
|
||||
if ((_game_mode == GM_EDITOR || _generating_world) && !spec->WasEverAvailable()) return CMD_ERROR;
|
||||
@@ -777,7 +774,7 @@ void GenerateObjects()
|
||||
|
||||
default:
|
||||
uint8 view = RandomRange(spec->views);
|
||||
if (CmdBuildObject(DC_EXEC | DC_AUTO | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, RandomTile(), i, view, {}).Succeeded()) amount--;
|
||||
if (CmdBuildObject(DC_EXEC | DC_AUTO | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, RandomTile(), i, view).Succeeded()) amount--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user