From 9cf1a1976282a307af04959d93e5234166cf38b4 Mon Sep 17 00:00:00 2001 From: smatz Date: Tue, 27 Jan 2009 01:15:29 +0000 Subject: (svn r15281) -Fix: company could never have auto-assigned colour 0 (dark blue) --- src/company_cmd.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index 6cc2fe0d4..2c9bd26ab 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -330,7 +330,7 @@ static const Colours _similar_colour[COLOUR_END][2] = { { COLOUR_GREY, INVALID_COLOUR }, // COLOUR_WHITE }; -static byte GenerateCompanyColour() +static Colours GenerateCompanyColour() { Colours colours[COLOUR_END]; @@ -426,10 +426,13 @@ Company *DoStartupNewCompany(bool is_ai) { if (!Company::CanAllocateItem()) return NULL; + /* we have to generate colour before this company is valid */ + Colours colour = GenerateCompanyColour(); + Company *c = new Company(STR_SV_UNNAMED, is_ai); - /* Make a color */ - c->colour = GenerateCompanyColour(); + c->colour = colour; + ResetCompanyLivery(c); _company_colours[c->index] = c->colour; -- cgit v1.2.3-70-g09d2