Changeset - r28026:b046b2f1f539
[Not reviewed]
master
0 15 0
Rubidium - 14 months ago 2023-10-20 18:18:31
rubidium@openttd.org
Codechange: replace x.size() > 0 with !x.empty()
15 files changed with 23 insertions and 23 deletions:
0 comments (0 inline, 0 general)
src/3rdparty/squirrel/squirrel/sqbaselib.cpp
Show inline comments
 
@@ -763,7 +763,7 @@ static SQInteger closure_getinfos(HSQUIR
 
		res->NewSlot(SQString::Create(_ss(v),"name",-1),nc->_name);
 
		res->NewSlot(SQString::Create(_ss(v),"paramscheck",-1),nc->_nparamscheck);
 
		SQObjectPtr typecheck;
 
		if(nc->_typecheck.size() > 0) {
 
		if(!nc->_typecheck.empty()) {
 
			typecheck =
 
				SQArray::Create(_ss(v), nc->_typecheck.size());
 
			for(SQUnsignedInteger n = 0; n<nc->_typecheck.size(); n++) {
src/3rdparty/squirrel/squirrel/sqfuncstate.cpp
Show inline comments
 
@@ -564,7 +564,7 @@ void SQFuncState::PopChildState()
 

	
 
SQFuncState::~SQFuncState()
 
{
 
	while(_childstates.size() > 0)
 
	while(!_childstates.empty())
 
	{
 
		PopChildState();
 
	}
src/company_gui.cpp
Show inline comments
 
@@ -1008,7 +1008,7 @@ public:
 
					this->groups.ForceRebuild();
 
					this->BuildGroupList((CompanyID)this->window_number);
 

	
 
					if (this->groups.size() > 0) {
 
					if (!this->groups.empty()) {
 
						this->sel = this->groups[0]->index;
 
					}
 
				}
 
@@ -1095,7 +1095,7 @@ public:
 

	
 
				if (!Group::IsValidID(this->sel)) {
 
					this->sel = INVALID_GROUP;
 
					if (this->groups.size() > 0) this->sel = this->groups[0]->index;
 
					if (!this->groups.empty()) this->sel = this->groups[0]->index;
 
				}
 

	
 
				this->SetDirty();
src/misc/dbg_helpers.cpp
Show inline comments
 
@@ -139,7 +139,7 @@ void DumpTarget::BeginStruct(size_t type
 
{
 
	/* make composite name */
 
	std::string cur_name = GetCurrentStructName();
 
	if (cur_name.size() > 0) {
 
	if (!cur_name.empty()) {
 
		/* add name delimiter (we use structured names) */
 
		cur_name += ".";
 
	}
src/music/dmusic.cpp
Show inline comments
 
@@ -939,14 +939,14 @@ static const char *LoadDefaultDLSFile(co
 

	
 
			/* Calculate download size for the instrument. */
 
			size_t i_size = sizeof(DMUS_DOWNLOADINFO) + sizeof(DMUS_INSTRUMENT);
 
			if (dls_file.instruments[i].articulators.size() > 0) {
 
			if (!dls_file.instruments[i].articulators.empty()) {
 
				/* Articulations are stored as two chunks, one containing meta data and one with the actual articulation data. */
 
				offsets += 2;
 
				i_size += sizeof(DMUS_ARTICULATION2) + sizeof(CONNECTIONLIST) + sizeof(CONNECTION) * dls_file.instruments[i].articulators.size();
 
			}
 

	
 
			for (std::vector<DLSFile::DLSRegion>::iterator rgn = dls_file.instruments[i].regions.begin(); rgn != dls_file.instruments[i].regions.end(); rgn++) {
 
				if (rgn->articulators.size() > 0) {
 
				if (!rgn->articulators.empty()) {
 
					offsets += 2;
 
					i_size += sizeof(DMUS_ARTICULATION2) + sizeof(CONNECTIONLIST) + sizeof(CONNECTION) * rgn->articulators.size();
 
				}
 
@@ -999,7 +999,7 @@ static const char *LoadDefaultDLSFile(co
 
			instrument = inst_data + 1;
 

	
 
			/* Write global articulations. */
 
			if (dls_file.instruments[i].articulators.size() > 0) {
 
			if (!dls_file.instruments[i].articulators.empty()) {
 
				inst_data->ulGlobalArtIdx = last_offset;
 
				offset_table[last_offset++] = (char *)instrument - inst_base;
 
				offset_table[last_offset++] = (char *)instrument + sizeof(DMUS_ARTICULATION2) - inst_base;
 
@@ -1028,18 +1028,18 @@ static const char *LoadDefaultDLSFile(co
 
				/* The wave sample data will be taken from the region, if defined, otherwise from the wave itself. */
 
				if (rgn.wave_sample.cbSize != 0) {
 
					inst_region->WSMP = rgn.wave_sample;
 
					if (rgn.wave_loops.size() > 0) MemCpyT(inst_region->WLOOP, &rgn.wave_loops.front(), rgn.wave_loops.size());
 
					if (!rgn.wave_loops.empty()) MemCpyT(inst_region->WLOOP, &rgn.wave_loops.front(), rgn.wave_loops.size());
 

	
 
					instrument = (char *)(inst_region + 1) - sizeof(DMUS_REGION::WLOOP) + sizeof(WLOOP) * rgn.wave_loops.size();
 
				} else {
 
					inst_region->WSMP = rgn.wave_sample;
 
					if (dls_file.waves[wave_id].wave_loops.size() > 0) MemCpyT(inst_region->WLOOP, &dls_file.waves[wave_id].wave_loops.front(), dls_file.waves[wave_id].wave_loops.size());
 
					if (!dls_file.waves[wave_id].wave_loops.empty()) MemCpyT(inst_region->WLOOP, &dls_file.waves[wave_id].wave_loops.front(), dls_file.waves[wave_id].wave_loops.size());
 

	
 
					instrument = (char *)(inst_region + 1) - sizeof(DMUS_REGION::WLOOP) + sizeof(WLOOP) * dls_file.waves[wave_id].wave_loops.size();
 
				}
 

	
 
				/* Write local articulator data. */
 
				if (rgn.articulators.size() > 0) {
 
				if (!rgn.articulators.empty()) {
 
					inst_region->ulRegionArtIdx = last_offset;
 
					offset_table[last_offset++] = (char *)instrument - inst_base;
 
					offset_table[last_offset++] = (char *)instrument + sizeof(DMUS_ARTICULATION2) - inst_base;
 
@@ -1168,7 +1168,7 @@ void MusicDriver_DMusic::Stop()
 
	}
 

	
 
	/* Unloaded any instruments we loaded. */
 
	if (_dls_downloads.size() > 0) {
 
	if (!_dls_downloads.empty()) {
 
		IDirectMusicPortDownload *download_port = nullptr;
 
		_port->QueryInterface(IID_IDirectMusicPortDownload, (LPVOID *)&download_port);
 

	
src/music/midifile.cpp
Show inline comments
 
@@ -87,7 +87,7 @@ public:
 
	 */
 
	bool IsValid() const
 
	{
 
		return this->buf.size() > 0;
 
		return !this->buf.empty();
 
	}
 

	
 
	/**
src/network/network_content_gui.cpp
Show inline comments
 
@@ -824,7 +824,7 @@ public:
 
			case WID_NCL_NAME:
 
				if (this->content.SortType() == widget - WID_NCL_CHECKBOX) {
 
					this->content.ToggleSortOrder();
 
					if (this->content.size() > 0) this->list_pos = (int)this->content.size() - this->list_pos - 1;
 
					if (!this->content.empty()) this->list_pos = (int)this->content.size() - this->list_pos - 1;
 
				} else {
 
					this->content.SetSortType(widget - WID_NCL_CHECKBOX);
 
					this->content.ForceResort();
src/newgrf.cpp
Show inline comments
 
@@ -5240,7 +5240,7 @@ static void NewSpriteGroup(ByteReader *b
 
			}
 

	
 
			group->default_group = GetGroupFromGroupID(setid, type, buf->ReadWord());
 
			group->error_group = ranges.size() > 0 ? ranges[0].group : group->default_group;
 
			group->error_group = ranges.empty() ? group->default_group : ranges[0].group;
 
			/* nvar == 0 is a special case -- we turn our value into a callback result */
 
			group->calculated_result = ranges.empty();
 

	
src/newgrf_cargo.cpp
Show inline comments
 
@@ -86,7 +86,7 @@ CargoID GetCargoTranslation(uint8_t carg
 

	
 
	/* Other cases use (possibly translated) cargobits */
 

	
 
	if (grffile->cargo_list.size() > 0) {
 
	if (!grffile->cargo_list.empty()) {
 
		/* ...and the cargo is in bounds, then get the cargo ID for
 
		 * the label */
 
		if (cargo < grffile->cargo_list.size()) return GetCargoIDByLabel(grffile->cargo_list[cargo]);
src/os/macosx/string_osx.cpp
Show inline comments
 
@@ -367,7 +367,7 @@ int MacOSStringCompare(std::string_view 
 
	/* Query CoreText for word and cluster break information. */
 
	this->str_info.resize(utf16_to_utf8.size());
 

	
 
	if (utf16_str.size() > 0) {
 
	if (!utf16_str.empty()) {
 
		CFAutoRelease<CFStringRef> str(CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, &utf16_str[0], utf16_str.size(), kCFAllocatorNull));
 

	
 
		/* Get cluster breaks. */
src/os/windows/string_uniscribe.cpp
Show inline comments
 
@@ -550,11 +550,11 @@ const int *UniscribeParagraphLayout::Uni
 
	/* Query Uniscribe for word and cluster break information. */
 
	this->str_info.resize(utf16_to_utf8.size());
 

	
 
	if (utf16_str.size() > 0) {
 
	if (!utf16_str.empty()) {
 
		/* Itemize string into language runs. */
 
		std::vector<SCRIPT_ITEM> runs = UniscribeItemizeString(&utf16_str[0], (int32_t)utf16_str.size());
 

	
 
		for (std::vector<SCRIPT_ITEM>::const_iterator run = runs.begin(); runs.size() > 0 && run != runs.end() - 1; run++) {
 
		for (std::vector<SCRIPT_ITEM>::const_iterator run = runs.begin(); !runs.empty() && run != runs.end() - 1; run++) {
 
			/* Get information on valid word and character break.s */
 
			int len = (run + 1)->iCharPos - run->iCharPos;
 
			std::vector<SCRIPT_LOGATTR> attr(len);
src/story_gui.cpp
Show inline comments
 
@@ -877,7 +877,7 @@ public:
 
			if (!_story_page_pool.IsValidID(this->selected_page_id)) {
 
				this->selected_page_id = INVALID_STORY_PAGE;
 
			}
 
			if (this->selected_page_id == INVALID_STORY_PAGE && this->story_pages.size() > 0) {
 
			if (this->selected_page_id == INVALID_STORY_PAGE && !this->story_pages.empty()) {
 
				/* No page is selected, but there exist at least one available.
 
				 * => Select first page.
 
				 */
src/vehicle_gui.cpp
Show inline comments
 
@@ -476,7 +476,7 @@ byte GetBestFittingSubType(Vehicle *v_fr
 

	
 
	byte ret_refit_cyc = 0;
 
	bool success = false;
 
	if (subtypes.size() > 0) {
 
	if (!subtypes.empty()) {
 
		/* Check whether any articulated part is refittable to 'dest_cargo_type' with a subtype listed in 'subtypes' */
 
		for (Vehicle *v = v_for; v != nullptr; v = v->HasArticulatedPart() ? v->GetNextArticulatedPart() : nullptr) {
 
			const Engine *e = v->GetEngine();
src/widgets/dropdown.cpp
Show inline comments
 
@@ -134,7 +134,7 @@ struct DropdownWindow : Window {
 
	DropdownWindow(Window *parent, DropDownList &&list, int selected, int button, bool instant_close, const Point &position, const Dimension &size, Colours wi_colour, bool scroll)
 
			: Window(&_dropdown_desc), list(std::move(list))
 
	{
 
		assert(this->list.size() > 0);
 
		assert(!this->list.empty());
 

	
 
		this->position = position;
 

	
src/widgets/slider.cpp
Show inline comments
 
@@ -29,7 +29,7 @@ static const int SLIDER_WIDTH = 3;
 
void DrawSliderWidget(Rect r, int min_value, int max_value, int value, const std::map<int, StringID> &labels)
 
{
 
	/* Allow space for labels. We assume they are in the small font. */
 
	if (labels.size() > 0) r.bottom -= FONT_HEIGHT_SMALL + WidgetDimensions::scaled.hsep_normal;
 
	if (!labels.empty()) r.bottom -= FONT_HEIGHT_SMALL + WidgetDimensions::scaled.hsep_normal;
 

	
 
	max_value -= min_value;
 

	
0 comments (0 inline, 0 general)