Skip to content

Commit

Permalink
Change most C-headers <xx.h> into C++-headers <cxx>.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarod42 committed Apr 30, 2024
1 parent 497539b commit da81760
Show file tree
Hide file tree
Showing 43 changed files with 114 additions and 125 deletions.
18 changes: 8 additions & 10 deletions src/action/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@
-- Includes
----------------------------------------------------------------------------*/

#include <time.h>

#include "stratagus.h"
#include "version.h"

#include "actions.h"

#include "action/action_attack.h"
Expand All @@ -58,7 +53,6 @@
#include "action/action_train.h"
#include "action/action_unload.h"
#include "action/action_upgradeto.h"

#include "animation/animation_die.h"
#include "commands.h"
#include "game.h"
Expand All @@ -71,19 +65,23 @@
#include "player.h"
#include "script.h"
#include "spells.h"
#include "stratagus.h"
#include "unit.h"
#include "unit_find.h"
#include "unit_manager.h"
#include "unittype.h"
#include "version.h"

#ifdef USE_STACKTRACE
#include <stdexcept>
#include <stacktrace/call_stack.hpp>
#include <stacktrace/stack_exception.hpp>
# include <stacktrace/call_stack.hpp>
# include <stacktrace/stack_exception.hpp>
# include <stdexcept>
#else
#include "st_backtrace.h"
# include "st_backtrace.h"
#endif

#include <ctime>

/*----------------------------------------------------------------------------
-- Variables
----------------------------------------------------------------------------*/
Expand Down
5 changes: 2 additions & 3 deletions src/animation/animation_die.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@
-- Includes
----------------------------------------------------------------------------*/

#include "stratagus.h"

#include "animation/animation_die.h"

#include "stratagus.h"
#include "unit.h"

#include <stdio.h>
#include <cstdio>

void CAnimation_Die::Action(CUnit &unit, int & /*move*/, int /*scale*/) const /* override */
{
Expand Down
5 changes: 2 additions & 3 deletions src/animation/animation_setplayervar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@
-- Includes
----------------------------------------------------------------------------*/

#include "stratagus.h"

#include "animation/animation_setplayervar.h"

#include "animation.h"
#include "stratagus.h"
#include "unit.h"

#include <cstdio>
#include <sstream>
#include <stdio.h>

/**
** Gets the player data.
Expand Down
6 changes: 2 additions & 4 deletions src/animation/animation_setvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,14 @@
-- Includes
----------------------------------------------------------------------------*/

#include "stratagus.h"

#include "animation/animation_setvar.h"

#include "actions.h"
#include "map.h"
#include "unit.h"
#include "unit_manager.h"
#include "map.h"

#include <stdio.h>
#include <cstdio>
#include <sstream>

void CAnimation_SetVar::Action(CUnit &unit, int & /*move*/, int /*scale*/) const /* override */
Expand Down
4 changes: 1 addition & 3 deletions src/game/replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
// Includes
//----------------------------------------------------------------------------

#include "stratagus.h"

#include "replay.h"

#include "actions.h"
Expand All @@ -56,8 +54,8 @@
#include "unittype.h"
#include "version.h"

#include <ctime>
#include <sstream>
#include <time.h>

extern fs::path ExpandPath(const std::string &path);
extern void StartMap(const std::string &filename, bool clean);
Expand Down
2 changes: 1 addition & 1 deletion src/game/savegame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#include "upgrade.h"
#include "version.h"

#include <time.h>
#include <ctime>

extern void StartMap(const std::string &filename, bool clean);

Expand Down
2 changes: 2 additions & 0 deletions src/include/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@
#include "icons.h"
#endif

#include "stratagus.h"
#include "unitsound.h"
#include "vec2i.h"

#include <optional>
#include <vector>

Expand Down
1 change: 1 addition & 0 deletions src/include/iolib.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
----------------------------------------------------------------------------*/

#include "filesystem.h"
#include "stratagus.h"

#include <SDL.h>
#include <memory>
Expand Down
1 change: 1 addition & 0 deletions src/include/luacallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#define LUA_CALLBACK_HEADER_FILE

#include <map>
#include <memory>
#include <string>
#include <string_view>
#include <tuple>
Expand Down
1 change: 1 addition & 0 deletions src/include/sdl2_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include <SDL.h>
#include <memory>
#include <vector>

//@{

Expand Down
2 changes: 2 additions & 0 deletions src/include/unitptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

//@{

#include <cstddef>

class CUnit;


Expand Down
3 changes: 3 additions & 0 deletions src/include/upgrade_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
-- Includes
----------------------------------------------------------------------------*/

#include "settings.h"

#include <cstring>
#include <memory>
#include <vector>

Expand Down
2 changes: 1 addition & 1 deletion src/include/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ extern uint32_t fletcher32(const std::string &content);
-- Strings
----------------------------------------------------------------------------*/

#include <string.h>
#include <cstring>

#ifndef _TRUNCATE
#define _TRUNCATE ((size_t)-1)
Expand Down
11 changes: 5 additions & 6 deletions src/map/fow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,17 @@
-- Includes
----------------------------------------------------------------------------*/

#include <string.h>
#include <algorithm>

#include "stratagus.h"

#include "fow.h"

#include "../video/intern_video.h"
#include "map.h"
#include "player.h"
#include "stratagus.h"
#include "tile.h"
#include "ui.h"
#include "viewport.h"
#include "../video/intern_video.h"

#include <algorithm>

/*----------------------------------------------------------------------------
-- Defines
Expand Down
6 changes: 3 additions & 3 deletions src/map/fow_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
-- Includes
----------------------------------------------------------------------------*/

#include <string.h>
#include <algorithm>
#include "fow_utils.h"

#include "stratagus.h"
#include "fow_utils.h"

#include <algorithm>
#include <cstring>

/*----------------------------------------------------------------------------
-- Defines
Expand Down
10 changes: 5 additions & 5 deletions src/map/map_wall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@
-- Includes
----------------------------------------------------------------------------*/

#include <stdio.h>

#include "stratagus.h"
#include "map.h"
#include "fov.h"
#include "map.h"
#include "player.h"
#include "stratagus.h"
#include "tileset.h"
#include "ui.h"
#include "player.h"
#include "unittype.h"

#include <cstdio>

/*----------------------------------------------------------------------------
-- Functions
----------------------------------------------------------------------------*/
Expand Down
2 changes: 1 addition & 1 deletion src/map/script_tileset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
#include "video.h"

#include <SDL_image.h>
#include <cmath>
#include <cstring>
#include <math.h>
#include <set>

/*----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/map/tileset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@

#include "tileset.h"

#include <limits.h>
#include <climits>

/*----------------------------------------------------------------------------
-- Variables
Expand Down
6 changes: 2 additions & 4 deletions src/missile/missile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
-- Includes
----------------------------------------------------------------------------*/

#include <math.h>

#include "stratagus.h"

#include "missile.h"

#include "action/action_spellcast.h"
Expand All @@ -57,6 +53,8 @@
#include "unittype.h"
#include "video.h"

#include <cmath>

/*----------------------------------------------------------------------------
-- Declarations
----------------------------------------------------------------------------*/
Expand Down
10 changes: 4 additions & 6 deletions src/missile/missile_parabolic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,14 @@
-- Includes
----------------------------------------------------------------------------*/

#include <stdio.h>

#include "stratagus.h"

#include "missile.h"

#include "luacallback.h"
#include "map.h"
#include "missile.h"
#include "stratagus.h"
#include "unit_find.h"

#include <cstdio>

/**
** Calculate parabolic trajectories.
**
Expand Down
9 changes: 3 additions & 6 deletions src/missile/missile_tracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,14 @@
-- Includes
----------------------------------------------------------------------------*/

#include <stdio.h>

#include "stratagus.h"

#include "missile.h"

#include "luacallback.h"
#include "map.h"
#include "missile.h"
#include "unit.h"
#include "unit_find.h"

#include <cstdio>

/**
** Handle tracer missile.
**
Expand Down
4 changes: 2 additions & 2 deletions src/network/net_lowlevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@

#include "net_lowlevel.h"

#include <stdio.h>
#include <cerrno>
#include <cstdio>
#include <fcntl.h>
#include <errno.h>

//----------------------------------------------------------------------------
// Declarations
Expand Down
2 changes: 1 addition & 1 deletion src/network/netsockets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "network/netsockets.h"
#include "net_lowlevel.h"

#include <stdio.h>
#include <cstdio>

//
// CHost
Expand Down
5 changes: 2 additions & 3 deletions src/network/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,6 @@
#include "online_service.h"
#include "stratagus.h"

#include <stddef.h>
#include <list>

#include "network.h"

#include "actions.h"
Expand All @@ -244,7 +241,9 @@
#include "unittype.h"
#include "video.h"

#include <cstddef>
#include <deque>
#include <list>

//----------------------------------------------------------------------------
// Declaration
Expand Down
5 changes: 2 additions & 3 deletions src/particle/chunkparticle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@

//@{

#include <math.h>

#include "stratagus.h"
#include "particle.h"
#include "stratagus.h"
#include "video.h"

#include <cmath>

static const int gravity = 32 * 12;

Expand Down
Loading

0 comments on commit da81760

Please sign in to comment.