Changeset - r8253:2016acbc61ce
[Not reviewed]
master
0 2 0
peter1138 - 16 years ago 2008-01-12 13:36:22
peter1138@openttd.org
(svn r11817) -Codechange: Base vehicle group validity on owner, not name.
2 files changed with 6 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/group.h
Show inline comments
 
@@ -26,7 +26,7 @@ struct Group : PoolItem<Group, GroupID, 
 
	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;
src/group_cmd.cpp
Show inline comments
 
@@ -45,20 +45,20 @@ static inline void UpdateNumEngineGroup(
 
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 @@ CommandCost CmdCreateGroup(TileIndex til
 

	
 
	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;
 

	
0 comments (0 inline, 0 general)