1
0
Fork 0

(svn r25959) -Fix: clang warnings; either because type safety was assumed, or because technically the wrong value was tested

release/1.4
rubidium 2013-11-09 06:52:08 +00:00
parent 14b8f6e594
commit 85d4f8d65c
2 changed files with 3 additions and 2 deletions

View File

@ -107,7 +107,7 @@
EnforcePrecondition(false, company == ScriptCompany::COMPANY_INVALID || ScriptCompany::ResolveCompanyID(company) != ScriptCompany::COMPANY_INVALID); EnforcePrecondition(false, company == ScriptCompany::COMPANY_INVALID || ScriptCompany::ResolveCompanyID(company) != ScriptCompany::COMPANY_INVALID);
EnforcePrecondition(false, CountBits(buttons) >= 1 && CountBits(buttons) <= 3); EnforcePrecondition(false, CountBits(buttons) >= 1 && CountBits(buttons) <= 3);
EnforcePrecondition(false, buttons < (1 << ::GOAL_QUESTION_BUTTON_COUNT)); EnforcePrecondition(false, buttons < (1 << ::GOAL_QUESTION_BUTTON_COUNT));
EnforcePrecondition(false, type < ::GOAL_QUESTION_TYPE_COUNT); EnforcePrecondition(false, (int)type < ::GOAL_QUESTION_TYPE_COUNT);
uint8 c = company; uint8 c = company;
if (company == ScriptCompany::COMPANY_INVALID) c = INVALID_COMPANY; if (company == ScriptCompany::COMPANY_INVALID) c = INVALID_COMPANY;

View File

@ -21,9 +21,10 @@ uint32 VehicleListIdentifier::Pack()
{ {
byte c = this->company == OWNER_NONE ? 0xF : (byte)this->company; byte c = this->company == OWNER_NONE ? 0xF : (byte)this->company;
assert(c < (1 << 4)); assert(c < (1 << 4));
assert(this->type < (1 << 3));
assert(this->vtype < (1 << 2)); assert(this->vtype < (1 << 2));
assert(this->index < (1 << 20)); assert(this->index < (1 << 20));
assert(this->type < VLT_END);
assert_compile(VLT_END <= (1 << 3));
return c << 28 | this->type << 23 | this->vtype << 26 | this->index; return c << 28 | this->type << 23 | this->vtype << 26 | this->index;
} }