Changeset - r16208:fb601446b60b
[Not reviewed]
master
0 2 0
rubidium - 14 years ago 2010-10-12 19:48:42
rubidium@openttd.org
(svn r20919) -Fix [FS#4140]: objects didn't change colour when the company changed colour. Now they do, except when the "decide colour" callback is (defined to be) used
2 files changed with 24 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/company_cmd.cpp
Show inline comments
 
@@ -986,6 +986,9 @@ CommandCost CmdSetCompanyColour(TileInde
 
		FOR_ALL_VEHICLES(v) {
 
			if (v->owner == _current_company) v->InvalidateNewGRFCache();
 
		}
 

	
 
		extern void UpdateObjectColours(const Company *c);
 
		UpdateObjectColours(c);
 
	}
 
	return CommandCost();
 
}
src/object_cmd.cpp
Show inline comments
 
@@ -128,6 +128,27 @@ void UpdateCompanyHQ(TileIndex tile, uin
 
	}
 
}
 

	
 
/**
 
 * Updates the colour of the object whenever a company changes.
 
 * @param c The company the company colour changed of.
 
 */
 
void UpdateObjectColours(const Company *c)
 
{
 
	Object *obj;
 
	FOR_ALL_OBJECTS(obj) {
 
		Owner owner = GetTileOwner(obj->location.tile);
 
		/* Not the current owner, so colour doesn't change. */
 
		if (owner != c->index) continue;
 

	
 
		const ObjectSpec *spec = ObjectSpec::GetByTile(obj->location.tile);
 
		/* Using the object colour callback, so not using company colour. */
 
		if (HasBit(spec->callback_mask, CBM_OBJ_COLOUR)) continue;
 

	
 
		const Livery *l = c->livery;
 
		obj->colour = ((spec->flags & OBJECT_FLAG_2CC_COLOUR) ? (l->colour2 * 16) : 0) + l->colour1;
 
	}
 
}
 

	
 
extern CommandCost CheckBuildableTile(TileIndex tile, uint invalid_dirs, int &allowed_z, bool check_bridge);
 
static CommandCost ClearTile_Object(TileIndex tile, DoCommandFlag flags);
 

	
0 comments (0 inline, 0 general)