Merge tag '1.11.0-beta1' into jgrpp
# Conflicts: # src/console_cmds.cpp # src/gfx_func.h # src/industry.h # src/lang/czech.txt # src/lang/estonian.txt # src/lang/german.txt # src/lang/indonesian.txt # src/lang/japanese.txt # src/lang/norwegian_bokmal.txt # src/lang/russian.txt # src/lang/slovak.txt # src/saveload/saveload.h # src/station_gui.cpp # src/town_gui.cpp # src/vehicle_gui.cpp # src/video/sdl2_v.cpp # src/waypoint_gui.cpp
This commit is contained in:
@@ -41,6 +41,8 @@
|
||||
#include "object_base.h"
|
||||
#include "game/game.hpp"
|
||||
#include "error.h"
|
||||
#include "cmd_helper.h"
|
||||
#include "string_func.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
#include "table/industry_land.h"
|
||||
@@ -2136,16 +2138,13 @@ CommandCost CmdBuildIndustry(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
* @param flags Type of operation.
|
||||
* @param p1 IndustryID
|
||||
* @param p2 various bitstuffed elements
|
||||
* - p2 = (bit 0 - 7) - action to perform:
|
||||
* 0 = set control flags
|
||||
* 1 = set exclusive supplier
|
||||
* 2 = set exclusive consumer
|
||||
* - p2 = (bit 0 - 7) - IndustryAction to perform
|
||||
* - p2 = (bit 8 - 15) - IndustryControlFlags
|
||||
* (only used with set control flags)
|
||||
* - p2 = (bit 16 - 23) - CompanyID to set or INVALID_OWNER (available to everyone) or
|
||||
* OWNER_NONE (neutral stations only) or OWNER_DEITY (no one)
|
||||
* (only used with set exclusive supplier / consumer)
|
||||
* @param text unused
|
||||
* @param text - Additional industry text (only used with set text action)
|
||||
* @return Empty cost or an error.
|
||||
*/
|
||||
CommandCost CmdIndustryCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
||||
@@ -2155,10 +2154,10 @@ CommandCost CmdIndustryCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||
Industry *ind = Industry::GetIfValid(p1);
|
||||
if (ind == nullptr) return CMD_ERROR;
|
||||
|
||||
uint8 action = GB(p2, 0, 8);
|
||||
auto action = static_cast<IndustryAction>(GB(p2, 0, 8));
|
||||
|
||||
switch (action) {
|
||||
case 0: {
|
||||
case IndustryAction::SetControlFlags: {
|
||||
IndustryControlFlags ctlflags = (IndustryControlFlags)GB(p2, 8, 8) & INDCTL_MASK;
|
||||
|
||||
if (flags & DC_EXEC) ind->ctlflags = ctlflags;
|
||||
@@ -2166,15 +2165,15 @@ CommandCost CmdIndustryCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||
break;
|
||||
}
|
||||
|
||||
case 1:
|
||||
case 2: {
|
||||
case IndustryAction::SetExclusiveSupplier:
|
||||
case IndustryAction::SetExclusiveConsumer: {
|
||||
Owner company_id = (Owner)GB(p2, 16, 8);
|
||||
|
||||
if (company_id != OWNER_NONE && company_id != INVALID_OWNER && company_id != OWNER_DEITY
|
||||
&& !Company::IsValidID(company_id)) return CMD_ERROR;
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
if (action == 1) {
|
||||
if (action == IndustryAction::SetExclusiveSupplier) {
|
||||
ind->exclusive_supplier = company_id;
|
||||
} else {
|
||||
ind->exclusive_consumer = company_id;
|
||||
@@ -2184,6 +2183,13 @@ CommandCost CmdIndustryCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||
break;
|
||||
}
|
||||
|
||||
case IndustryAction::SetText: {
|
||||
ind->text.clear();
|
||||
if (!StrEmpty(text)) ind->text = text;
|
||||
InvalidateWindowData(WC_INDUSTRY_VIEW, ind->index);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
NOT_REACHED();
|
||||
}
|
||||
@@ -2827,8 +2833,7 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
|
||||
|
||||
/* Prevent production to overflow or Oil Rig passengers to be over-"produced" */
|
||||
new_prod = Clamp(new_prod, 1, 255);
|
||||
|
||||
if (((indspec->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0) && j == 1 && !(indspec->behaviour & INDUSTRYBEH_WATER_NO_CLAMP_PROD)) {
|
||||
if (i->produced_cargo[j] == CT_PASSENGERS && !(indspec->behaviour & INDUSTRYBEH_NO_PAX_PROD_CLAMP)) {
|
||||
new_prod = Clamp(new_prod, 0, 16);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user