mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-03 12:59:33 +00:00
(svn r14169) -Codechange: rename location_of_house for location_of_HQ, which is more exact and less subject to interpretation
This commit is contained in:
parent
cf52b683c0
commit
08898f69be
@ -3956,7 +3956,7 @@ static void AiBuildCompanyHQ(Player *p)
|
||||
{
|
||||
TileIndex tile;
|
||||
|
||||
if (p->location_of_house == 0 &&
|
||||
if (p->location_of_HQ == 0 &&
|
||||
p->last_build_coordinate != 0) {
|
||||
tile = AdjustTileCoordRandomly(p->last_build_coordinate, 8);
|
||||
DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_BUILD_COMPANY_HQ);
|
||||
|
@ -107,7 +107,7 @@ static void AiNew_State_WakeUp(Player *p)
|
||||
int c;
|
||||
assert(_players_ainew[p->index].state == AI_STATE_WAKE_UP);
|
||||
// First, check if we have a HQ
|
||||
if (p->location_of_house == 0) {
|
||||
if (p->location_of_HQ == 0) {
|
||||
// We have no HQ yet, build one on a random place
|
||||
// Random till we found a place for it!
|
||||
// TODO: this should not be on a random place..
|
||||
|
@ -993,7 +993,7 @@ static const OldChunks player_chunk[] = {
|
||||
OCL_SVAR( OC_UINT8, Player, block_preview ),
|
||||
OCL_VAR( OC_UINT8, 1, &ai_tick ),
|
||||
OCL_SVAR( OC_UINT8, Player, avail_railtypes ),
|
||||
OCL_SVAR( OC_TILE, Player, location_of_house ),
|
||||
OCL_SVAR( OC_TILE, Player, location_of_HQ ),
|
||||
OCL_SVAR( OC_UINT8, Player, share_owners[0] ),
|
||||
OCL_SVAR( OC_UINT8, Player, share_owners[1] ),
|
||||
OCL_SVAR( OC_UINT8, Player, share_owners[2] ),
|
||||
@ -1041,8 +1041,8 @@ static bool LoadOldPlayer(LoadgameState *ls, int num)
|
||||
|
||||
_player_colors[num] = p->player_color;
|
||||
p->inaugurated_year -= ORIGINAL_BASE_YEAR;
|
||||
if (p->location_of_house == 0xFFFF)
|
||||
p->location_of_house = 0;
|
||||
if (p->location_of_HQ == 0xFFFF)
|
||||
p->location_of_HQ = 0;
|
||||
|
||||
/* State 20 for AI players is sell vehicle. Since the AI struct is not
|
||||
* really figured out as of now, _players_ai[p->index].cur_veh; needed for 'sell vehicle'
|
||||
|
@ -56,7 +56,7 @@ struct Player : PoolItem<Player, PlayerByte, &_Player_pool> {
|
||||
|
||||
uint32 cargo_types; ///< which cargo types were transported the last year
|
||||
|
||||
TileIndex location_of_house;
|
||||
TileIndex location_of_HQ;
|
||||
TileIndex last_build_coordinate;
|
||||
|
||||
PlayerByte share_owners[4];
|
||||
|
@ -1185,10 +1185,10 @@ struct PlayerCompanyWindow : Window
|
||||
this->SetWidgetHiddenState(PCW_WIDGET_COLOR_SCHEME, !local);
|
||||
this->SetWidgetHiddenState(PCW_WIDGET_PRESIDENT_NAME, !local);
|
||||
this->SetWidgetHiddenState(PCW_WIDGET_COMPANY_NAME, !local);
|
||||
this->widget[PCW_WIDGET_BUILD_VIEW_HQ].data = (local && p->location_of_house == 0) ? STR_706F_BUILD_HQ : STR_7072_VIEW_HQ;
|
||||
if (local && p->location_of_house != 0) this->widget[PCW_WIDGET_BUILD_VIEW_HQ].type = WWT_PUSHTXTBTN; //HQ is already built.
|
||||
this->SetWidgetDisabledState(PCW_WIDGET_BUILD_VIEW_HQ, !local && p->location_of_house == 0);
|
||||
this->SetWidgetHiddenState(PCW_WIDGET_RELOCATE_HQ, !local || p->location_of_house == 0);
|
||||
this->widget[PCW_WIDGET_BUILD_VIEW_HQ].data = (local && p->location_of_HQ == 0) ? STR_706F_BUILD_HQ : STR_7072_VIEW_HQ;
|
||||
if (local && p->location_of_HQ != 0) this->widget[PCW_WIDGET_BUILD_VIEW_HQ].type = WWT_PUSHTXTBTN; //HQ is already built.
|
||||
this->SetWidgetDisabledState(PCW_WIDGET_BUILD_VIEW_HQ, !local && p->location_of_HQ == 0);
|
||||
this->SetWidgetHiddenState(PCW_WIDGET_RELOCATE_HQ, !local || p->location_of_HQ == 0);
|
||||
this->SetWidgetHiddenState(PCW_WIDGET_BUY_SHARE, local);
|
||||
this->SetWidgetHiddenState(PCW_WIDGET_SELL_SHARE, local);
|
||||
this->SetWidgetHiddenState(PCW_WIDGET_COMPANY_PASSWORD, !local || !_networking);
|
||||
@ -1267,7 +1267,7 @@ struct PlayerCompanyWindow : Window
|
||||
break;
|
||||
|
||||
case PCW_WIDGET_BUILD_VIEW_HQ: {
|
||||
TileIndex tile = GetPlayer((PlayerID)this->window_number)->location_of_house;
|
||||
TileIndex tile = GetPlayer((PlayerID)this->window_number)->location_of_HQ;
|
||||
if (tile == 0) {
|
||||
if ((byte)this->window_number != _local_player) return;
|
||||
SetObjectToPlaceWnd(SPR_CURSOR_HQ, PAL_NONE, VHM_RECT, this);
|
||||
|
@ -1125,8 +1125,8 @@ static const SaveLoad _player_desc[] = {
|
||||
|
||||
SLE_CONDVAR(Player, cargo_types, SLE_FILE_U16 | SLE_VAR_U32, 0, 93),
|
||||
SLE_CONDVAR(Player, cargo_types, SLE_UINT32, 94, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Player, location_of_house, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
|
||||
SLE_CONDVAR(Player, location_of_house, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Player, location_of_HQ, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
|
||||
SLE_CONDVAR(Player, location_of_HQ, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Player, last_build_coordinate, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
|
||||
SLE_CONDVAR(Player, last_build_coordinate, SLE_UINT32, 6, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Player, inaugurated_year, SLE_FILE_U8 | SLE_VAR_I32, 0, 30),
|
||||
|
@ -45,13 +45,13 @@ static CommandCost DestroyCompanyHQ(PlayerID pid, uint32 flags)
|
||||
Player *p = GetPlayer(pid);
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
TileIndex t = p->location_of_house;
|
||||
TileIndex t = p->location_of_HQ;
|
||||
|
||||
DoClearSquare(t + TileDiffXY(0, 0));
|
||||
DoClearSquare(t + TileDiffXY(0, 1));
|
||||
DoClearSquare(t + TileDiffXY(1, 0));
|
||||
DoClearSquare(t + TileDiffXY(1, 1));
|
||||
p->location_of_house = 0; // reset HQ position
|
||||
p->location_of_HQ = 0; // reset HQ position
|
||||
InvalidateWindow(WC_COMPANY, pid);
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ static CommandCost DestroyCompanyHQ(PlayerID pid, uint32 flags)
|
||||
void UpdateCompanyHQ(Player *p, uint score)
|
||||
{
|
||||
byte val;
|
||||
TileIndex tile = p->location_of_house;
|
||||
TileIndex tile = p->location_of_HQ;
|
||||
|
||||
if (tile == 0) return;
|
||||
|
||||
@ -96,14 +96,14 @@ CommandCost CmdBuildCompanyHQ(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
|
||||
cost = CheckFlatLandBelow(tile, 2, 2, flags, 0, NULL);
|
||||
if (CmdFailed(cost)) return cost;
|
||||
|
||||
if (p->location_of_house != 0) { // Moving HQ
|
||||
if (p->location_of_HQ != 0) { // Moving HQ
|
||||
cost.AddCost(DestroyCompanyHQ(_current_player, flags));
|
||||
}
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
int score = UpdateCompanyRatingAndValue(p, false);
|
||||
|
||||
p->location_of_house = tile;
|
||||
p->location_of_HQ = tile;
|
||||
|
||||
MakeCompanyHQ(tile, _current_player);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user