Changeset - r24586:b65203f44ad9
[Not reviewed]
master
0 2 0
Patric Stout - 4 years ago 2021-01-06 21:37:57
truebrain@openttd.org
Fix #8168: allow relocating of HQ partial over existing HQ (#8510)

Just in case you want to move it SLIGHTLY to the right.
2 files changed with 9 insertions and 2 deletions:
0 comments (0 inline, 0 general)
regression/regression/main.nut
Show inline comments
 
@@ -426,7 +426,7 @@ function Regression::Company()
 
	print("  GetCompanyHQ():                    " + AICompany.GetCompanyHQ(AICompany.COMPANY_SELF));
 
	print("  BuildCompanyHQ():                  " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(129, 129)));
 
	print("  GetCompanyHQ():                    " + AICompany.GetCompanyHQ(AICompany.COMPANY_SELF));
 
	print("  BuildCompanyHQ():                  " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(129, 128)));
 
	print("  BuildCompanyHQ():                  " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(239, 76)));
 
	print("  GetLastErrorString():              " + AIError.GetLastErrorString());
 
	print("  GetAutoRenewStatus();              " + AICompany.GetAutoRenewStatus(AICompany.COMPANY_SELF));
 
	print("  SetAutoRenewStatus(true);          " + AICompany.SetAutoRenewStatus(true));
src/object_cmd.cpp
Show inline comments
 
@@ -248,7 +248,14 @@ CommandCost CmdBuildObject(TileIndex til
 
			} else {
 
				if (!allow_ground) return_cmd_error(STR_ERROR_MUST_BE_BUILT_ON_WATER);
 
				/* For non-water tiles, we'll have to clear it before building. */
 
				cost.AddCost(DoCommand(t, 0, 0, flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR));
 

	
 
				/* When relocating HQ, allow it to be relocated (partial) on itself. */
 
				if (!(type == OBJECT_HQ &&
 
						IsTileType(t, MP_OBJECT) &&
 
						IsTileOwner(t, _current_company) &&
 
						IsObjectType(t, OBJECT_HQ))) {
 
					cost.AddCost(DoCommand(t, 0, 0, flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR));
 
				}
 
			}
 
		}
 

	
0 comments (0 inline, 0 general)