Skip to content

Commit

Permalink
Merge pull request #2 from CeRiAl/dev
Browse files Browse the repository at this point in the history
Make everything work in VSCode and get rid of most warnings.
  • Loading branch information
CeRiAl authored Jun 25, 2020
2 parents 571f6b0 + 5a3a23c commit 487227a
Show file tree
Hide file tree
Showing 18 changed files with 82 additions and 31 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: C/C++ CI

on:
push:
branches: [ master, sdl2 ]
pull_request:
branches: [ master, sdl2 ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install build dependencies
run: sudo apt-get install libsdl1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libpng-dev

- name: Configure project
run: |
mkdir $GITHUB_WORKSPACE/build
cd $GITHUB_WORKSPACE/build
cmake ..
- name: Run make
run: |
cd $GITHUB_WORKSPACE/build
make
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
game.log
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
}
7 changes: 7 additions & 0 deletions projects/freesynd.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"folders": [
{
"path": ".."
}
]
}
5 changes: 3 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ set (SOURCES
ia/behaviour.cpp
default_ini.h
freesynd.cpp
ipastim.cpp
ipastim.cpp
gfx/dirtylist.cpp
gfx/fliplayer.cpp
gfx/font.cpp
Expand Down Expand Up @@ -99,7 +99,7 @@ set(HEADERS
common.h
config.h
cp437.h
ipastim.h
ipastim.h
keys.h
map.h
mapmanager.h
Expand Down Expand Up @@ -223,6 +223,7 @@ if (BUILD_DEV_TOOLS)
editor/listmissionmenu.h)

add_executable (dump
default_ini.h
dump.cpp
gfx/dirtylist.cpp
gfx/fliplayer.cpp
Expand Down
4 changes: 2 additions & 2 deletions src/agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ bool Agent::loadFromFile(PortableFile &infile, const FormatVersion& v) {
male_ = infile.read8b();
// active
active_ = infile.read8b();
// health : not used
int health = infile.read32();
// health
// int health = infile.read32(); // FIXME: not used

return true;
}
15 changes: 9 additions & 6 deletions src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,19 @@
#include "menus/gamemenuid.h"

App::App(bool disable_sound):
context_(new AppContext),
session_(new GameSession()), game_ctlr_(new GameController),
screen_(new Screen(GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT))
context_(new AppContext),
session_(new GameSession()),
game_ctlr_(new GameController),
screen_(new Screen(GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT)),
#ifdef SYSTEM_SDL
, system_(new SystemSDL())
system_(new SystemSDL()),
#else
#error A suitable System object has not been defined!
#endif
, intro_sounds_(disable_sound), game_sounds_(disable_sound), music_(disable_sound),
menus_(new GameMenuFactory(), &game_sounds_)
intro_sounds_(disable_sound),
game_sounds_(disable_sound),
music_(disable_sound),
menus_(new GameMenuFactory(), &game_sounds_)
{
running_ = true;
#ifdef _DEBUG
Expand Down
12 changes: 6 additions & 6 deletions src/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,22 @@ class App : public Singleton < App > {
private:
bool running_;
/*! A structure to hold general application informations.*/
std::auto_ptr<AppContext> context_;
std::unique_ptr<AppContext> context_;
/*! A structure to hold player informations.*/
std::auto_ptr<GameSession> session_;
std::unique_ptr<GameSession> session_;
/*! Controls the game logic. */
std::auto_ptr<GameController> game_ctlr_;
std::auto_ptr<Screen> screen_;
std::auto_ptr<System> system_;
std::unique_ptr<GameController> game_ctlr_;
std::unique_ptr<Screen> screen_;
std::unique_ptr<System> system_;

std::string iniPath_;

GameSpriteManager game_sprites_;
MenuManager menus_;
MapManager maps_;
SoundManager intro_sounds_;
SoundManager game_sounds_;
MusicManager music_;
MenuManager menus_;
};

#define g_App App::singleton()
Expand Down
2 changes: 1 addition & 1 deletion src/dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ int main(int argc, char *argv[]) {
}

LOG(Log::k_FLG_INFO, "Main", "main", ("----- Initializing application..."))
std::auto_ptr<EditorApp> app(new EditorApp(disable_sound));
std::unique_ptr<EditorApp> app(new EditorApp(disable_sound));

if (app->initialize(iniPath)) {
LOG(Log::k_FLG_INFO, "Main", "main", ("----- Initializing application completed"))
Expand Down
11 changes: 7 additions & 4 deletions src/editor/editorapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,17 @@
#include "editor/editormenuid.h"

EditorApp::EditorApp(bool disable_sound):
context_(new AppContext), game_ctlr_(new GameController),
screen_(new Screen(GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT))
screen_(new Screen(GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT)),
#ifdef SYSTEM_SDL
, system_(new SystemSDL())
system_(new SystemSDL()),
#else
#error A suitable System object has not been defined!
#endif
, intro_sounds_(disable_sound), game_sounds_(disable_sound), music_(disable_sound),
context_(new AppContext),
game_ctlr_(new GameController),
intro_sounds_(disable_sound),
game_sounds_(disable_sound),
music_(disable_sound),
menus_(new EditorMenuFactory(), &game_sounds_)
{
running_ = true;
Expand Down
10 changes: 5 additions & 5 deletions src/editor/editorapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,21 @@ class EditorApp : public Singleton < EditorApp > {
private:
bool running_;

std::auto_ptr<Screen> screen_;
std::auto_ptr<System> system_;
std::unique_ptr<Screen> screen_;
std::unique_ptr<System> system_;
/*! A structure to hold general application informations.*/
std::auto_ptr<AppContext> context_;
std::unique_ptr<AppContext> context_;
/*! Controls the game logic. */
std::auto_ptr<GameController> game_ctlr_;
std::unique_ptr<GameController> game_ctlr_;

std::string iniPath_;

GameSpriteManager game_sprites_;
MenuManager menus_;
MapManager maps_;
SoundManager intro_sounds_;
SoundManager game_sounds_;
MusicManager music_;
MenuManager menus_;
/*!
* Use to store id of missions that are found in the search menu.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/freesynd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ int main(int argc, char *argv[]) {
}

LOG(Log::k_FLG_INFO, "Main", "main", ("----- Initializing application..."))
std::auto_ptr<App> app(new App(disable_sound));
std::unique_ptr<App> app(new App(disable_sound));

if (app->initialize(iniPath)) {
// setting the cheat codes
Expand Down
2 changes: 2 additions & 0 deletions src/gfx/font.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class MenuFont : public Font {
};

protected:
using Font::getSprite;

//! returns the sprite which can be highlighted or not
virtual Sprite *getSprite(unsigned char dos_char, bool highlighted);
//! draws a text at the given position
Expand Down
1 change: 1 addition & 0 deletions src/mapobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ class Static : public ShootableMapObject {
//! Set whether to include static in search for blockers
void setExcludedFromBlockers(bool exclude) { excludedFromBlockers_ = exclude; }

using MapObject::animate;
virtual bool animate(int elapsed, Mission *obj) {
return MapObject::animate(elapsed);
}
Expand Down
2 changes: 1 addition & 1 deletion src/menus/squadselection.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class SquadSelection {
}

~Iterator() {
idx_ = idx_;
// idx_ = idx_;
}

// The assignment and relational operators are straightforward
Expand Down
2 changes: 2 additions & 0 deletions src/ped.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ class PedInstance : public ShootableMovableMapObject, public WeaponHolder,
bool switchActionStateTo(uint32 as);
bool switchActionStateFrom(uint32 as);
void synchDrawnAnimWithActionState(void);

using MapObject::animate;
bool animate(int elapsed, Mission *mission);

void drawSelectorAnim(int x, int y);
Expand Down
2 changes: 1 addition & 1 deletion src/sound/sdlmixersound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void SdlMixerSound::stop(int channel) const
}

/*!
* Each sample has its own volume wich is taken into account
* Each sample has its own volume which is taken into account
* on the mixing phase. This method sets the volume of this
* sample.
* \param A value between 0 and maximum volume.
Expand Down
3 changes: 1 addition & 2 deletions src/tools/embed.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
add_executable (embed tools/embed.c)
function (embed_data input name output)
get_target_property (GENERATOR_EXE embed LOCATION)
add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${output}
COMMAND ${GENERATOR_EXE} ${CMAKE_CURRENT_SOURCE_DIR}/${input} ${name} ${output}
COMMAND $<TARGET_FILE:embed> ${CMAKE_CURRENT_SOURCE_DIR}/${input} ${name} ${output}
DEPENDS embed
MAIN_DEPENDENCY ${input}
)
Expand Down

0 comments on commit 487227a

Please sign in to comment.