Changeset - r28027:1fc5ad405b2c
[Not reviewed]
master
0 11 0
Rubidium - 14 months ago 2023-10-20 18:22:49
rubidium@openttd.org
Codechange: replace x.size() != 0 with !x.empty()
11 files changed with 12 insertions and 12 deletions:
0 comments (0 inline, 0 general)
src/autoreplace_gui.cpp
Show inline comments
 
@@ -222,7 +222,7 @@ class ReplaceVehicleWindow : public Wind
 
			/* We need to rebuild the left engines list */
 
			this->GenerateReplaceVehList(true);
 
			this->vscroll[0]->SetCount(this->engines[0].size());
 
			if (this->reset_sel_engine && this->sel_engine[0] == INVALID_ENGINE && this->engines[0].size() != 0) {
 
			if (this->reset_sel_engine && this->sel_engine[0] == INVALID_ENGINE && !this->engines[0].empty()) {
 
				this->sel_engine[0] = this->engines[0][0].engine_id;
 
			}
 
		}
src/depot_gui.cpp
Show inline comments
 
@@ -810,7 +810,7 @@ struct DepotWindow : Window {
 

	
 
			case WID_D_SELL_ALL:
 
				/* Only open the confirmation window if there are anything to sell */
 
				if (this->vehicle_list.size() != 0 || this->wagon_list.size() != 0) {
 
				if (!this->vehicle_list.empty() || !this->wagon_list.empty()) {
 
					SetDParam(0, this->type);
 
					SetDParam(1, this->GetDepotIndex());
 
					ShowQuery(
src/gfx_layout_icu.cpp
Show inline comments
 
@@ -132,7 +132,7 @@ ICUParagraphLayout::ICUVisualRun::ICUVis
 
	glyphs(run.glyphs), glyph_to_char(run.glyph_to_char), total_advance(run.total_advance), font(run.font)
 
{
 
	/* If there are no positions, the ICURun was not Shaped; that should never happen. */
 
	assert(run.positions.size() != 0);
 
	assert(!run.positions.empty());
 
	this->positions.reserve(run.positions.size());
 

	
 
	/* "positions" is an array of x/y. So we need to alternate. */
src/group_gui.cpp
Show inline comments
 
@@ -960,7 +960,7 @@ public:
 
				break;
 

	
 
			case WID_GL_MANAGE_VEHICLES_DROPDOWN:
 
				assert(this->vehicles.size() != 0);
 
				assert(!this->vehicles.empty());
 

	
 
				switch (index) {
 
					case ADI_REPLACE: // Replace window
src/network/core/udp.cpp
Show inline comments
 
@@ -50,7 +50,7 @@ bool NetworkUDPSocketHandler::Listen()
 
		addr.Listen(SOCK_DGRAM, &this->sockets);
 
	}
 

	
 
	return this->sockets.size() != 0;
 
	return !this->sockets.empty();
 
}
 

	
 
/**
src/network/network_chat_gui.cpp
Show inline comments
 
@@ -67,7 +67,7 @@ static uint8_t *_chatmessage_backup = nu
 
 */
 
static inline bool HaveChatMessages(bool show_all)
 
{
 
	if (show_all) return _chatmsg_list.size() != 0;
 
	if (show_all) return !_chatmsg_list.empty();
 

	
 
	auto now = std::chrono::steady_clock::now();
 
	for (auto &cmsg : _chatmsg_list) {
src/newgrf.cpp
Show inline comments
 
@@ -9069,7 +9069,7 @@ static void CalculateRefitMasks()
 
			/* Figure out which CTT to use for the default cargo, if it is 'first refittable'. */
 
			const GRFFile *file = _gted[engine].defaultcargo_grf;
 
			if (file == nullptr) file = e->GetGRF();
 
			if (file != nullptr && file->grf_version >= 8 && file->cargo_list.size() != 0) {
 
			if (file != nullptr && file->grf_version >= 8 && !file->cargo_list.empty()) {
 
				/* Use first refittable cargo from cargo translation table */
 
				byte best_local_slot = UINT8_MAX;
 
				for (CargoID cargo_type : SetCargoBitIterator(ei->refit_mask)) {
src/newgrf_gui.cpp
Show inline comments
 
@@ -163,7 +163,7 @@ struct NewGRFParametersWindow : public W
 
		clicked_row(UINT_MAX),
 
		editable(editable)
 
	{
 
		this->action14present = (c->num_valid_params != c->param.size() || c->param_info.size() != 0);
 
		this->action14present = (c->num_valid_params != c->param.size() || !c->param_info.empty());
 

	
 
		this->CreateNestedTree();
 
		this->vscroll = this->GetScrollbar(WID_NP_SCROLLBAR);
src/string.cpp
Show inline comments
 
@@ -594,7 +594,7 @@ char *strcasestr(const char *haystack, c
 
 */
 
static std::string_view SkipGarbage(std::string_view str)
 
{
 
	while (str.size() != 0 && (str[0] < '0' || IsInsideMM(str[0], ';', '@' + 1) || IsInsideMM(str[0], '[', '`' + 1) || IsInsideMM(str[0], '{', '~' + 1))) str.remove_prefix(1);
 
	while (!str.empty() && (str[0] < '0' || IsInsideMM(str[0], ';', '@' + 1) || IsInsideMM(str[0], '[', '`' + 1) || IsInsideMM(str[0], '{', '~' + 1))) str.remove_prefix(1);
 
	return str;
 
}
 

	
src/vehicle_gui.cpp
Show inline comments
 
@@ -2080,7 +2080,7 @@ public:
 
				break;
 

	
 
			case WID_VL_MANAGE_VEHICLES_DROPDOWN:
 
				assert(this->vehicles.size() != 0);
 
				assert(!this->vehicles.empty());
 

	
 
				switch (index) {
 
					case ADI_REPLACE: // Replace window
src/viewport.cpp
Show inline comments
 
@@ -1747,7 +1747,7 @@ void ViewportDoDraw(const Viewport *vp, 
 

	
 
	DrawTextEffects(&_vd.dpi);
 

	
 
	if (_vd.tile_sprites_to_draw.size() != 0) ViewportDrawTileSprites(&_vd.tile_sprites_to_draw);
 
	if (!_vd.tile_sprites_to_draw.empty()) ViewportDrawTileSprites(&_vd.tile_sprites_to_draw);
 

	
 
	for (auto &psd : _vd.parent_sprites_to_draw) {
 
		_vd.parent_sprites_to_sort.push_back(&psd);
 
@@ -1773,7 +1773,7 @@ void ViewportDoDraw(const Viewport *vp, 
 
		vp->overlay->Draw(&dp);
 
	}
 

	
 
	if (_vd.string_sprites_to_draw.size() != 0) {
 
	if (!_vd.string_sprites_to_draw.empty()) {
 
		/* translate to world coordinates */
 
		dp.left = UnScaleByZoom(_vd.dpi.left, zoom);
 
		dp.top = UnScaleByZoom(_vd.dpi.top, zoom);
0 comments (0 inline, 0 general)