mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Simplify some CodeQL-flagged trivial switches
parent
a15e584e40
commit
066ae6f3fb
|
@ -328,12 +328,9 @@ void GamelogPrint(std::function<void(const char*)> proc)
|
|||
case GLCT_GRFBUG: {
|
||||
/* A specific bug in a NewGRF, that could cause wide spread problems, has been noted during the execution of the game. */
|
||||
GrfIDMapping::Pair *gm = grf_names.Find(lc->grfrem.grfid);
|
||||
switch (lc->grfbug.bug) {
|
||||
default: NOT_REACHED();
|
||||
case GBUG_VEH_LENGTH:
|
||||
assert (lc->grfbug.bug == GBUG_VEH_LENGTH);
|
||||
|
||||
buf += seprintf(buf, lastof(buffer), "Rail vehicle changes length outside a depot: GRF ID %08X, internal ID 0x%X", BSWAP32(lc->grfbug.grfid), (uint)lc->grfbug.data);
|
||||
break;
|
||||
}
|
||||
buf = PrintGrfInfo(buf, lastof(buffer), lc->grfbug.grfid, nullptr, gm != grf_names.End() ? gm->second.gc : nullptr);
|
||||
if (gm == grf_names.End()) buf += seprintf(buf, lastof(buffer), ". Gamelog inconsistency: GrfID was never added!");
|
||||
break;
|
||||
|
|
|
@ -360,12 +360,9 @@ public:
|
|||
void OnInvalidateData(int data = 0, bool gui_scope = true) override
|
||||
{
|
||||
if (!gui_scope) return;
|
||||
switch (data) {
|
||||
case 1:
|
||||
|
||||
/* ReInit, "debug" sprite might have changed */
|
||||
this->ReInit();
|
||||
break;
|
||||
}
|
||||
if (data == 1) this->ReInit();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -565,9 +565,8 @@ public:
|
|||
{
|
||||
if (pt.x == -1) return;
|
||||
|
||||
switch (select_proc) {
|
||||
default: NOT_REACHED();
|
||||
case DDSP_BUILD_OBJECT:
|
||||
assert(select_proc == DDSP_BUILD_OBJECT);
|
||||
|
||||
if (!_settings_game.construction.freeform_edges) {
|
||||
/* When end_tile is MP_VOID, the error tile will not be visible to the
|
||||
* user. This happens when terraforming at the southern border. */
|
||||
|
@ -577,8 +576,6 @@ public:
|
|||
const ObjectSpec *spec = ObjectClass::Get(_selected_object_class)->GetSpec(_selected_object_index);
|
||||
Command<CMD_BUILD_OBJECT_AREA>::Post(STR_ERROR_CAN_T_BUILD_OBJECT, CcPlaySound_CONSTRUCTION_OTHER,
|
||||
end_tile, start_tile, spec->Index(), _selected_object_view, (_ctrl_pressed ? true : false));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnPlaceObjectAbort() override
|
||||
|
|
|
@ -552,9 +552,7 @@ static CallBackFunction ToolbarSubsidiesClick(Window *w)
|
|||
*/
|
||||
static CallBackFunction MenuClickSubsidies(int index)
|
||||
{
|
||||
switch (index) {
|
||||
case 0: ShowSubsidiesList(); break;
|
||||
}
|
||||
ShowSubsidiesList();
|
||||
return CBF_NONE;
|
||||
}
|
||||
|
||||
|
|
|
@ -955,14 +955,10 @@ bool OpenGLBackend::Resize(int w, int h, bool force)
|
|||
|
||||
_glActiveTexture(GL_TEXTURE0);
|
||||
_glBindTexture(GL_TEXTURE_2D, this->vid_texture);
|
||||
switch (bpp) {
|
||||
case 8:
|
||||
if (bpp == 8) {
|
||||
_glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, w, h, 0, GL_RED, GL_UNSIGNED_BYTE, nullptr);
|
||||
break;
|
||||
|
||||
default:
|
||||
} else {
|
||||
_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nullptr);
|
||||
break;
|
||||
}
|
||||
_glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
|
||||
|
@ -1224,14 +1220,10 @@ void OpenGLBackend::ReleaseVideoBuffer(const Rect &update_rect)
|
|||
_glActiveTexture(GL_TEXTURE0);
|
||||
_glBindTexture(GL_TEXTURE_2D, this->vid_texture);
|
||||
_glPixelStorei(GL_UNPACK_ROW_LENGTH, _screen.pitch);
|
||||
switch (BlitterFactory::GetCurrentBlitter()->GetScreenDepth()) {
|
||||
case 8:
|
||||
_glTexSubImage2D(GL_TEXTURE_2D, 0, update_rect.left, update_rect.top, update_rect.right - update_rect.left, update_rect.bottom - update_rect.top, GL_RED, GL_UNSIGNED_BYTE, (GLvoid *)(size_t)(update_rect.top * _screen.pitch + update_rect.left));
|
||||
break;
|
||||
|
||||
default:
|
||||
_glTexSubImage2D(GL_TEXTURE_2D, 0, update_rect.left, update_rect.top, update_rect.right - update_rect.left, update_rect.bottom - update_rect.top, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, (GLvoid *)(size_t)(update_rect.top * _screen.pitch * 4 + update_rect.left * 4));
|
||||
break;
|
||||
if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 8) {
|
||||
_glTexSubImage2D(GL_TEXTURE_2D, 0, update_rect.left, update_rect.top, update_rect.right - update_rect.left, update_rect.bottom - update_rect.top, GL_RED, GL_UNSIGNED_BYTE, (GLvoid*)(size_t)(update_rect.top * _screen.pitch + update_rect.left));
|
||||
} else {
|
||||
_glTexSubImage2D(GL_TEXTURE_2D, 0, update_rect.left, update_rect.top, update_rect.right - update_rect.left, update_rect.bottom - update_rect.top, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, (GLvoid*)(size_t)(update_rect.top * _screen.pitch * 4 + update_rect.left * 4));
|
||||
}
|
||||
|
||||
#ifndef NO_GL_BUFFER_SYNC
|
||||
|
|
Loading…
Reference in New Issue