Changeset - r20912:595943d1a598
[Not reviewed]
master
0 2 0
rubidium - 11 years ago 2013-11-09 06:52:08
rubidium@openttd.org
(svn r25959) -Fix: clang warnings; either because type safety was assumed, or because technically the wrong value was tested
2 files changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/script/api/script_goal.cpp
Show inline comments
 
@@ -98,25 +98,25 @@
 

	
 
/* static */ bool ScriptGoal::Question(uint16 uniqueid, ScriptCompany::CompanyID company, Text *question, QuestionType type, int buttons)
 
{
 
	CCountedPtr<Text> counter(question);
 

	
 
	EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
 
	EnforcePrecondition(false, question != NULL);
 
	const char *text = question->GetEncodedText();
 
	EnforcePreconditionEncodedText(false, text);
 
	EnforcePrecondition(false, company == ScriptCompany::COMPANY_INVALID || ScriptCompany::ResolveCompanyID(company) != ScriptCompany::COMPANY_INVALID);
 
	EnforcePrecondition(false, CountBits(buttons) >= 1 && CountBits(buttons) <= 3);
 
	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;
 
	if (company == ScriptCompany::COMPANY_INVALID) c = INVALID_COMPANY;
 

	
 
	return ScriptObject::DoCommand(0, uniqueid | (c << 16) | (type << 24), buttons, CMD_GOAL_QUESTION, text);
 
}
 

	
 
/* static */ bool ScriptGoal::CloseQuestion(uint16 uniqueid)
 
{
 
	EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);
 

	
 
	return ScriptObject::DoCommand(0, uniqueid, 0, CMD_GOAL_QUESTION_ANSWER);
src/vehiclelist.cpp
Show inline comments
 
@@ -12,27 +12,28 @@
 
#include "stdafx.h"
 
#include "train.h"
 
#include "vehiclelist.h"
 

	
 
/**
 
 * Pack a VehicleListIdentifier in a single uint32.
 
 * @return The packed identifier.
 
 */
 
uint32 VehicleListIdentifier::Pack()
 
{
 
	byte c = this->company == OWNER_NONE ? 0xF : (byte)this->company;
 
	assert(c             < (1 <<  4));
 
	assert(this->type    < (1 <<  3));
 
	assert(this->vtype   < (1 <<  2));
 
	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;
 
}
 

	
 
/**
 
 * Unpack a VehicleListIdentifier from a single uint32.
 
 * @param data The data to unpack.
 
 * @return true iff the data was valid (enough).
 
 */
 
bool VehicleListIdentifier::Unpack(uint32 data)
 
{
 
	byte c        = GB(data, 28, 4);
0 comments (0 inline, 0 general)