Merge pull request #2012 from Dune-jr/codacy-fixes

Fix a few relevant issues raised by Codacy. #2009
This commit is contained in:
oy 2019-02-03 12:47:00 +01:00 committed by GitHub
commit 040b02c627
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 19 deletions

View file

@ -1044,5 +1044,5 @@
"id": "YT", "id": "YT",
"code": 175 "code": 175
} }
]}, ]}
} }

View file

@ -159,7 +159,7 @@
"condition": [ "condition": [
{"x": 0, "y": -1, "value": "empty"}, {"x": 0, "y": -1, "value": "empty"},
{"x": 1, "y": 0, "value": "empty"}, {"x": 1, "y": 0, "value": "empty"},
{"x": 1, "y": 1, "value": "full"}, {"x": 1, "y": 1, "value": "full"}
] ]
}, },
{ {

View file

@ -517,10 +517,10 @@ void CServerBrowser::RequestImpl(const NETADDR &Addr, CServerEntry *pEntry)
Data.m_pfnCallback = CBFTrackPacket; Data.m_pfnCallback = CBFTrackPacket;
Data.m_pCallbackUser = this; Data.m_pCallbackUser = this;
m_pNetClient->Send(&Packet, NET_TOKEN_NONE, &Data); m_pNetClient->Send(&Packet, NET_TOKEN_NONE, &Data);
pEntry->m_TrackID = Data.m_TrackID;
if(pEntry) if(pEntry)
{ {
pEntry->m_TrackID = Data.m_TrackID;
pEntry->m_RequestTime = time_get(); pEntry->m_RequestTime = time_get();
pEntry->m_InfoState = CServerEntry::STATE_PENDING; pEntry->m_InfoState = CServerEntry::STATE_PENDING;
} }

View file

@ -3517,7 +3517,6 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
static int sEnvelopeEditorID = 0; static int sEnvelopeEditorID = 0;
static int s_ActiveChannels = 0xf; static int s_ActiveChannels = 0xf;
if(pEnvelope)
{ {
CUIRect Button; CUIRect Button;
@ -3578,23 +3577,20 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
if(UI()->HotItem() == &sEnvelopeEditorID) if(UI()->HotItem() == &sEnvelopeEditorID)
{ {
// do stuff // do stuff
if(pEnvelope) if(UI()->MouseButtonClicked(1))
{ {
if(UI()->MouseButtonClicked(1)) // add point
{ int Time = (int)(((UI()->MouseX()-View.x)*TimeScale)*1000.0f);
// add point float aChannels[4];
int Time = (int)(((UI()->MouseX()-View.x)*TimeScale)*1000.0f); pEnvelope->Eval(Time/1000.0f, aChannels);
float aChannels[4]; pEnvelope->AddPoint(Time,
pEnvelope->Eval(Time/1000.0f, aChannels); f2fx(aChannels[0]), f2fx(aChannels[1]),
pEnvelope->AddPoint(Time, f2fx(aChannels[2]), f2fx(aChannels[3]));
f2fx(aChannels[0]), f2fx(aChannels[1]), m_Map.m_Modified = true;
f2fx(aChannels[2]), f2fx(aChannels[3]));
m_Map.m_Modified = true;
}
m_ShowEnvelopePreview = SHOWENV_SELECTED;
m_pTooltip = "Press right mouse button to create a new point";
} }
m_ShowEnvelopePreview = SHOWENV_SELECTED;
m_pTooltip = "Press right mouse button to create a new point";
} }
vec3 aColors[] = {vec3(1,0.2f,0.2f), vec3(0.2f,1,0.2f), vec3(0.2f,0.2f,1), vec3(1,1,0.2f)}; vec3 aColors[] = {vec3(1,0.2f,0.2f), vec3(0.2f,1,0.2f), vec3(0.2f,0.2f,1), vec3(1,1,0.2f)};