Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed May 17, 2020
1 parent 1e31e74 commit 71a06bb
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ bool checkWriteable(const bfs::path& folder)
} // namespace

#undef main
int main(int /*argc*/, char* /*argv*/[])
int main(int /*argc*/, char* /*argv*/ [])
{
if(!RTTRCONFIG.Init())
{
Expand Down
18 changes: 12 additions & 6 deletions CGame_Event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ void CGame::EventHandling(SDL_Event* Event)
{
switch(Event->type)
{
case SDL_KEYDOWN: {
case SDL_KEYDOWN:
{
// NOTE: we will now deliver the data to menus, windows, map etc., sometimes we have to break the switch and stop
// delivering earlier, for doing this we make use of a variable showing us the deliver status
bool delivered = false;
Expand Down Expand Up @@ -86,7 +87,8 @@ void CGame::EventHandling(SDL_Event* Event)
callback::PleaseWait(WINDOW_QUIT_MESSAGE);
}
break;
case SDLK_F6: {
case SDLK_F6:
{
if(MapObj->getMap())
{
callback::PleaseWait(INITIALIZING_CALL);
Expand Down Expand Up @@ -120,15 +122,17 @@ void CGame::EventHandling(SDL_Event* Event)
break;
}

case SDL_KEYUP: {
case SDL_KEYUP:
{
// deliver keyboard data to map
if(MapObj)
MapObj->setKeyboardData(Event->key);

break;
}

case SDL_MOUSEMOTION: {
case SDL_MOUSEMOTION:
{
// setup mouse cursor data
if(MapObj && MapObj->isActive())
{
Expand Down Expand Up @@ -217,7 +221,8 @@ void CGame::EventHandling(SDL_Event* Event)
break;
}

case SDL_MOUSEBUTTONDOWN: {
case SDL_MOUSEBUTTONDOWN:
{
// setup mouse cursor data
Cursor.clicked = true;
Cursor.button.left = false;
Expand Down Expand Up @@ -291,7 +296,8 @@ void CGame::EventHandling(SDL_Event* Event)
break;
}

case SDL_MOUSEBUTTONUP: {
case SDL_MOUSEBUTTONUP:
{
// setup mouse cursor data
Cursor.clicked = false;

Expand Down
3 changes: 2 additions & 1 deletion CMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,8 @@ void CMap::setKeyboardData(const SDL_KeyboardEvent& key)
case SDLK_UP:
case SDLK_DOWN:
case SDLK_LEFT:
case SDLK_RIGHT: {
case SDLK_RIGHT:
{
Position offset{key.keysym.sym == SDLK_LEFT ? -100 : (key.keysym.sym == SDLK_RIGHT ? 100 : 0),
key.keysym.sym == SDLK_UP ? -100 : (key.keysym.sym == SDLK_DOWN ? 100 : 0)};
moveMap(offset);
Expand Down
14 changes: 10 additions & 4 deletions CSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,11 @@ Uint32 CSurface::GetPixel(SDL_Surface* surface, int x, int y)
else
return p[0] | p[1] << 8 | p[2] << 16;

case 4: return *(Uint32*)p; //-V206
case 4:
return *(Uint32*)p; //-V206

default: return 0; /* shouldn't happen, but avoids warnings */
default:
return 0; /* shouldn't happen, but avoids warnings */
}
}

Expand Down Expand Up @@ -1088,9 +1090,13 @@ void CSurface::DrawTriangle(SDL_Surface* display, const DisplayRectangle& displa
}
break;
// stone
case 0xCC: objIdx = MAPPIC_GRANITE_1_1 + (P2.objectType - 0x01); break;
case 0xCC:
objIdx = MAPPIC_GRANITE_1_1 + (P2.objectType - 0x01);
break;
// stone
case 0xCD: objIdx = MAPPIC_GRANITE_2_1 + (P2.objectType - 0x01); break;
case 0xCD:
objIdx = MAPPIC_GRANITE_2_1 + (P2.objectType - 0x01);
break;
// headquarter
case 0x80: // node2.objectType is the number of the player beginning with 0x00
//%7 cause in the original game there are only 7 players and 7 different flags
Expand Down
9 changes: 6 additions & 3 deletions callbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,8 @@ void callback::EditorLoadMenu(int Param)

switch(Param)
{
case INITIALIZING_CALL: {
case INITIALIZING_CALL:
{
if(WNDLoad)
break;
WNDLoad = global::s2->RegisterWindow(std::make_unique<CWindow>(EditorLoadMenu, WINDOWQUIT, WindowPos::Center, Extent(280, 320),
Expand Down Expand Up @@ -787,7 +788,8 @@ void callback::EditorLoadMenu(int Param)
}
break;

case LOADMAP: {
case LOADMAP:
{
if(curFilename.empty())
return;
PleaseWait(INITIALIZING_CALL);
Expand Down Expand Up @@ -893,7 +895,8 @@ void callback::EditorSaveMenu(int Param)
TXTF_Author = nullptr;
break;

case SAVEMAP: {
case SAVEMAP:
{
PleaseWait(INITIALIZING_CALL);

MapObj->setMapname(TXTF_Mapname->getText());
Expand Down

0 comments on commit 71a06bb

Please sign in to comment.