mirror of
https://github.com/ddnet/ddnet.git
synced 2024-10-20 07:48:18 +00:00
17402cc43f
This is the strict version, ID → Id, UI → Ui, except DDNet which stays DDNet. This would fix #7750. Done using a naive rename script (for bash, use `shopt -s globstar`): ```fish sed -i \ -e 's/\([a-z]_\?\)ID/\1Id/g' \ -e 's/\([^ ]\)\<UI\>/\1Ui/g' \ -e 's/UI()/Ui()/g' \ -e 's/\<CUI\>/CUi/g' \ -e 's/\([\ta-z.(&]\|[,=|] \)ID\>/\1Id/g' \ -e 's/\<ID\>\([^ ").]\)/Id\1/g' \ -e 's/\<ID\([0-9]\)/Id\1/g' \ -e 's/\<ID\>\( [<=>:+*/-]\)/Id\1/g' \ -e 's/int ID/int Id/g' \ -e 's/\([a-z]_\?\)GPU/\1Gpu/g' \ -e 's/\([a-z]_\?\)IP/\1Ip/g' \ -e 's/\([a-z]_\?\)CID/\1Cid/g' \ -e 's/\([a-z]_\?\)MySQL/\1Mysql/g' \ -e 's/MySql/Mysql/g' \ -e 's/\([a-xz]_\?\)SQL/\1Sql/g' \ -e 's/DPMode/DpMode/g' \ -e 's/TTWGraphics/TTwGraphics/g' \ \ -e 's/Ipointer/IPointer/g' \ -e 's/\.vendorId/.vendorID/g' \ -e 's/\.windowId/.windowID/g' \ -e 's/SDL_GetWindowFromId/SDL_GetWindowFromID/g' \ -e 's/SDL_AudioDeviceId/SDL_AudioDeviceID/g' \ -e 's/SDL_JoystickId/SDL_JoystickID/g' \ -e 's/SDL_JoystickInstanceId/SDL_JoystickInstanceID/g' \ -e 's/AVCodecId/AVCodecID/g' \ src/**/*.cpp src/**/*.h {datasrc,scripts}/**/*.py git checkout -- src/engine/external ``` I like this option because it presents clear rules. Still needs fixups because of the naive replacement, I'd do this if we want this merged.
49 lines
1,016 B
C++
49 lines
1,016 B
C++
#include "editor.h"
|
|
|
|
#include "layer_selector.h"
|
|
|
|
void CLayerSelector::Init(CEditor *pEditor)
|
|
{
|
|
CEditorComponent::Init(pEditor);
|
|
|
|
m_SelectionOffset = 0;
|
|
}
|
|
|
|
bool CLayerSelector::SelectByTile()
|
|
{
|
|
// ctrl+rightclick a map index to select the layer that has a tile there
|
|
if(Ui()->HotItem() != &Editor()->m_MapEditorId)
|
|
return false;
|
|
if(!Input()->ModifierIsPressed() || !Ui()->MouseButtonClicked(1))
|
|
return false;
|
|
|
|
int MatchedGroup = -1;
|
|
int MatchedLayer = -1;
|
|
int Matches = 0;
|
|
bool IsFound = false;
|
|
for(auto HoverTile : Editor()->HoverTiles())
|
|
{
|
|
if(MatchedGroup == -1)
|
|
{
|
|
MatchedGroup = HoverTile.m_Group;
|
|
MatchedLayer = HoverTile.m_Layer;
|
|
}
|
|
if(++Matches > m_SelectionOffset)
|
|
{
|
|
m_SelectionOffset++;
|
|
MatchedGroup = HoverTile.m_Group;
|
|
MatchedLayer = HoverTile.m_Layer;
|
|
IsFound = true;
|
|
break;
|
|
}
|
|
}
|
|
if(MatchedGroup != -1 && MatchedLayer != -1)
|
|
{
|
|
if(!IsFound)
|
|
m_SelectionOffset = 1;
|
|
Editor()->SelectLayer(MatchedLayer, MatchedGroup);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|