Mercurial > hg > openttd
changeset 8253:dd29551d3c67 draft
(svn r11817) -Codechange: Base vehicle group validity on owner, not name.
author | peter1138 <peter1138@openttd.org> |
---|---|
date | Sat, 12 Jan 2008 13:36:22 +0000 |
parents | 9961adeaa4a0 |
children | 7d580c9c41fb |
files | src/group.h src/group_cmd.cpp |
diffstat | 2 files changed, 6 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/group.h +++ b/src/group.h @@ -26,7 +26,7 @@ bool replace_protection; ///< If set to true, the global autoreplace have no effect on the group uint16 num_engines[TOTAL_NUM_ENGINES]; ///< Caches the number of engines of each type the player owns (no need to save this) - Group(StringID str = STR_NULL); + Group(PlayerID owner = INVALID_PLAYER); virtual ~Group(); bool IsValid() const;
--- a/src/group_cmd.cpp +++ b/src/group_cmd.cpp @@ -45,20 +45,20 @@ DEFINE_OLD_POOL_GENERIC(Group, Group) -Group::Group(StringID str) +Group::Group(PlayerID owner) { - this->string_id = str; + this->owner = owner; } Group::~Group() { DeleteName(this->string_id); - this->string_id = STR_NULL; + this->owner = INVALID_PLAYER; } bool Group::IsValid() const { - return this->string_id != STR_NULL; + return this->owner != INVALID_PLAYER; } void InitializeGroup(void) @@ -93,13 +93,12 @@ AutoPtrT<Group> g_auto_delete; - Group *g = new Group(STR_EMPTY); + Group *g = new Group(_current_player); if (g == NULL) return CMD_ERROR; g_auto_delete = g; if (flags & DC_EXEC) { - g->owner = _current_player; g->replace_protection = false; g->vehicle_type = vt;