Turn some stray C source files in the main src directory into C++

This commit is contained in:
ROllerozxa 2026-06-18 21:58:57 +02:00
commit e9d944afa8
13 changed files with 35 additions and 68 deletions

View file

@ -109,9 +109,7 @@ include_directories(
src/
${CMAKE_CURRENT_BINARY_DIR})
file(GLOB SRCS
src/*.c
file(GLOB SRCS CONFIGURE_DEPENDS
lib/GLAD/src/gl.c
lib/lua/*.c
lib/SDL_image/*.c
@ -131,7 +129,7 @@ if(UNITY_BUILD)
lib/Box2D/_unity_chunk.cc)
else()
file(GLOB MAIN_SRCS
file(GLOB MAIN_SRCS CONFIGURE_DEPENDS
src/tms/core/*.c
src/tms/math/*.c
src/tms/cpp.cc
@ -151,7 +149,7 @@ else()
endif()
if(BACKEND_IMGUI)
file(GLOB IMGUI_SRCS
file(GLOB IMGUI_SRCS CONFIGURE_DEPENDS
lib/imgui/*.cpp
lib/imgui/misc/freetype/*.cpp
src/ui/*.cc)
@ -177,7 +175,7 @@ if(NOT SCREENSHOT_BUILD)
add_definitions(-DBUILD_CURL)
endif()
file(GLOB SDL_mixer_SRCS lib/SDL_mixer/*.c)
file(GLOB SDL_mixer_SRCS CONFIGURE_DEPENDS lib/SDL_mixer/*.c)
list(APPEND SRCS ${SDL_mixer_SRCS})
endif()
@ -193,7 +191,7 @@ endif()
if(USE_LUASOCKET)
add_definitions(-DBUILD_LUASOCKET)
file(GLOB LUASOCKET_SRCS
file(GLOB LUASOCKET_SRCS CONFIGURE_DEPENDS
lib/luasocket/*.c)
list(APPEND SRCS ${LUASOCKET_SRCS})

View file

@ -149,6 +149,7 @@
#include "rack.cc"
#include "ragdoll.cc"
#include "rail.cc"
#include "rand.cc"
#include "rc_activator.cc"
#include "receiver.cc"
//#include "repair_station.cc"
@ -160,6 +161,7 @@
#include "robot_parts.cc"
#include "rocket.cc"
#include "rope.cc"
#include "rotozoom.cc"
#include "rubberband.cc"
#include "sawtooth.cc"
#include "scanner.cc"

View file

@ -5,7 +5,7 @@
#include "gentype.hh"
#include "terrain.hh"
#include "settings.hh"
#include "noise.h"
#include "noise.hh"
#include "misc.hh"
bool chunk_window::initialized = false;

View file

@ -1,3 +1,4 @@
#include "game.hh"
#include "absorber.hh"
#include "adventure.hh"
#include "basepixel.hh"
@ -16,10 +17,10 @@
#include "font.hh"
#include "fxemitter.hh"
#include "game-message.hh"
#include "game.hh"
#include "gravityman.hh"
#include "grid.hh"
#include "group.hh"
#include "gui.hh"
#include "i0o1gate.hh"
#include "i1o1gate.hh"
#include "i2o1gate.hh"
@ -40,16 +41,18 @@
#include "panel.hh"
#include "pixel.hh"
#include "plant.hh"
#include "player_activator.hh"
#include "polygon.hh"
#include "progress.hh"
#include "proximitysensor.hh"
#include "ragdoll.hh"
#include "rand.h"
#include "rand.hh"
#include "rc_activator.hh"
#include "robot.hh"
#include "robot_parts.hh"
#include "robotman.hh"
#include "rope.hh"
#include "rotozoom.hh"
#include "screenshot_marker.hh"
#include "scup.hh"
#include "settings.hh"
@ -58,6 +61,7 @@
#include "soundman.hh"
#include "soundmanager.hh"
#include "spritebuffer.hh"
#include "terrain.hh" /* for print_screen_point_info */
#include "text.hh"
#include "textbuffer.hh"
#include "tpixel.hh"
@ -66,22 +70,11 @@
#include "widget_manager.hh"
#include "worker.hh"
#include "world.hh"
#include "player_activator.hh"
#include "gui.hh"
#ifdef DEBUG
/* for print_screen_point_info */
#include "terrain.hh"
#endif
#include <SDL3/SDL.h>
#include <glad/gl.h>
#include <unistd.h>
#include <iterator>
#include <map>
#include <SDL3/SDL.h>
#include "SDL2_rotozoom.h"
#include <unistd.h>
#define MAX_COPY_ENTITIES 10

View file

@ -6,7 +6,7 @@
#include "item.hh"
#include "faction.hh"
#include "robot.hh"
#include "noise.h"
#include "noise.hh"
#include "ladder.hh"
#include "tiles.hh"
#include "factory.hh"

View file

@ -1,7 +1,8 @@
#include "noise.h"
#include "rand.h"
#include "noise.hh"
#include "rand.hh"
#include <limits.h>
#include <sys/types.h>
#define FASTFLOOR(x) ( ((x)>0) ? ((int)x) : (((int)x)-1) )
/*

View file

@ -1,8 +1,5 @@
#ifndef _NOISE__H_
#define _NOISE__H_
#pragma once
void _noise_init_perm(unsigned long seed);
float _noise1 (float x);
float _noise2 (float x, float y);
#endif

View file

@ -1,4 +1,4 @@
#include "rand.h"
#include "rand.hh"
/* Period parameters */
#define N 624
@ -67,3 +67,6 @@ unsigned long genrand_int32(void)
return y;
}
#undef N
#undef M

View file

@ -1,16 +0,0 @@
#ifndef _MTRAND__H_
#define _MTRAND__H_
#ifdef __cplusplus
extern "C" {
#endif
void init_genrand(unsigned long s);
unsigned long genrand_int32(void);
#ifdef __cplusplus
}
#endif
#endif

4
src/rand.hh Normal file
View file

@ -0,0 +1,4 @@
#pragma once
void init_genrand(unsigned long s);
unsigned long genrand_int32(void);

View file

@ -34,7 +34,7 @@ Andreas Schiffler -- aschiffler at ferzkopp dot net
#include <stdlib.h>
#include <string.h>
#include "SDL2_rotozoom.h"
#include "rotozoom.hh"
/* ---- Internally used structures */

View file

@ -26,26 +26,11 @@ distribution.
Andreas Schiffler -- aschiffler at ferzkopp dot net
*/
#ifndef _SDL2_rotozoom_h
#define _SDL2_rotozoom_h
#pragma once
#include <math.h>
#include <SDL3/SDL.h>
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
extern SDL_Surface *zoomSurface(SDL_Surface * src, double zoomx, double zoomy);
#include <SDL3/SDL.h>
extern SDL_Surface *zoomSurface(SDL_Surface * src, double zoomx, double zoomy);
extern void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#endif
extern void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight);

View file

@ -3,7 +3,7 @@
#include "chunk.hh"
#include "object_factory.hh"
#include "game.hh"
#include "noise.h"
#include "noise.hh"
#include "plant.hh"
#include "gentype.hh"
#include "decorations.hh"