mirror of https://github.com/OpenTTD/OpenTTD
(svn r23835) -Change [FS#4999]: Make signs placed in scenario editor belong to the GS. That way they are always shown in game and are not editable.
parent
b9192ac432
commit
5bf1710a28
|
@ -234,8 +234,9 @@
|
||||||
* 168 23637
|
* 168 23637
|
||||||
* 169 23816
|
* 169 23816
|
||||||
* 170 23826
|
* 170 23826
|
||||||
|
* 171 23835
|
||||||
*/
|
*/
|
||||||
extern const uint16 SAVEGAME_VERSION = 170; ///< Current savegame version of OpenTTD.
|
extern const uint16 SAVEGAME_VERSION = 171; ///< Current savegame version of OpenTTD.
|
||||||
|
|
||||||
SavegameType _savegame_type; ///< type of savegame we are loading
|
SavegameType _savegame_type; ///< type of savegame we are loading
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include "../stdafx.h"
|
#include "../stdafx.h"
|
||||||
#include "../signs_base.h"
|
#include "../signs_base.h"
|
||||||
|
#include "../fios.h"
|
||||||
|
|
||||||
#include "saveload.h"
|
#include "saveload.h"
|
||||||
|
|
||||||
|
@ -55,6 +56,11 @@ static void Load_SIGN()
|
||||||
if (IsSavegameVersionBefore(6, 1) || (IsSavegameVersionBefore(83) && si->owner == INVALID_OWNER)) {
|
if (IsSavegameVersionBefore(6, 1) || (IsSavegameVersionBefore(83) && si->owner == INVALID_OWNER)) {
|
||||||
si->owner = OWNER_NONE;
|
si->owner = OWNER_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Signs placed in scenario editor shall now be OWNER_DEITY */
|
||||||
|
if (IsSavegameVersionBefore(171) && si->owner == OWNER_NONE && _saveload_mode == SLD_LOAD_SCENARIO) {
|
||||||
|
si->owner = OWNER_DEITY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ CommandCost CmdPlaceSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||||
|
|
||||||
/* When we execute, really make the sign */
|
/* When we execute, really make the sign */
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
Sign *si = new Sign(_current_company);
|
Sign *si = new Sign(_game_mode == GM_EDITOR ? OWNER_DEITY : _current_company);
|
||||||
int x = TileX(tile) * TILE_SIZE;
|
int x = TileX(tile) * TILE_SIZE;
|
||||||
int y = TileY(tile) * TILE_SIZE;
|
int y = TileY(tile) * TILE_SIZE;
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ CommandCost CmdRenameSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||||
{
|
{
|
||||||
Sign *si = Sign::GetIfValid(p1);
|
Sign *si = Sign::GetIfValid(p1);
|
||||||
if (si == NULL) return CMD_ERROR;
|
if (si == NULL) return CMD_ERROR;
|
||||||
if (si->owner == OWNER_DEITY && _current_company != OWNER_DEITY) return CMD_ERROR;
|
if (si->owner == OWNER_DEITY && _current_company != OWNER_DEITY && _game_mode != GM_EDITOR) return CMD_ERROR;
|
||||||
|
|
||||||
/* Rename the signs when empty, otherwise remove it */
|
/* Rename the signs when empty, otherwise remove it */
|
||||||
if (!StrEmpty(text)) {
|
if (!StrEmpty(text)) {
|
||||||
|
@ -89,7 +89,7 @@ CommandCost CmdRenameSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||||
free(si->name);
|
free(si->name);
|
||||||
/* Assign the new one */
|
/* Assign the new one */
|
||||||
si->name = strdup(text);
|
si->name = strdup(text);
|
||||||
si->owner = _current_company;
|
if (_game_mode != GM_EDITOR) si->owner = _current_company;
|
||||||
|
|
||||||
si->UpdateVirtCoord();
|
si->UpdateVirtCoord();
|
||||||
InvalidateWindowData(WC_SIGN_LIST, 0, 1);
|
InvalidateWindowData(WC_SIGN_LIST, 0, 1);
|
||||||
|
|
|
@ -1872,8 +1872,8 @@ static bool CheckClickOnSign(const ViewPort *vp, int x, int y)
|
||||||
const Sign *si;
|
const Sign *si;
|
||||||
FOR_ALL_SIGNS(si) {
|
FOR_ALL_SIGNS(si) {
|
||||||
/* If competitor signs are hidden, don't check signs that aren't owned by local company */
|
/* If competitor signs are hidden, don't check signs that aren't owned by local company */
|
||||||
if (!HasBit(_display_opt, DO_SHOW_COMPETITOR_SIGNS) && _local_company != si->owner) continue;
|
if (!HasBit(_display_opt, DO_SHOW_COMPETITOR_SIGNS) && _local_company != si->owner && si->owner != OWNER_DEITY) continue;
|
||||||
if (si->owner == OWNER_DEITY) continue;
|
if (si->owner == OWNER_DEITY && _game_mode != GM_EDITOR) continue;
|
||||||
|
|
||||||
if (CheckClickOnViewportSign(vp, x, y, &si->sign)) {
|
if (CheckClickOnViewportSign(vp, x, y, &si->sign)) {
|
||||||
HandleClickOnSign(si);
|
HandleClickOnSign(si);
|
||||||
|
|
Loading…
Reference in New Issue