Skip to content
This repository was archived by the owner on Oct 16, 2023. It is now read-only.

Commit

Permalink
Version 0.2.0 from develop.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMaximum authored Dec 30, 2016
2 parents d428661 + e6633c9 commit 73eafd1
Show file tree
Hide file tree
Showing 34 changed files with 2,614 additions and 198 deletions.
6 changes: 2 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ add_definitions(-Wno-deprecated)

set (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR})
link_directories(${PROJECT_SOURCE_DIR}/lib/yaml/build)
link_directories(${PROJECT_SOURCE_DIR}/lib/tinyxml)
include_directories("${PROJECT_SOURCE_DIR}/lib/yaml/include")
include_directories("${PROJECT_SOURCE_DIR}/lib/tinyxml")

set (PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src)

set (VERSION_MAJOR 0)
set (VERSION_MINOR 1)
set (VERSION_MINOR 2)
set (VERSION_PATCH 0)

# configure a header file to pass some of the CMake settings
Expand All @@ -29,4 +27,4 @@ file(GLOB_RECURSE SOURCES src/*.cpp)

add_executable(Mania++ ${SOURCES}
lib/pugixml/libpugixml.a)
target_link_libraries(Mania++ yaml-cpp ${EXECUTABLE_OUTPUT_PATH}/lib/pugixml/libpugixml.a)
target_link_libraries(Mania++ yaml-cpp ${EXECUTABLE_OUTPUT_PATH}/lib/pugixml/libpugixml.a dl)
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ Mania++ is (currently) not compatible with Windows systems and the ```./install.
* [CMake](https://cmake.org)

## Aims and working points ##
* Create more usable objects (f.e. `Map`)
* [Be comparable or better than standard PhpRemote](https://themaximum.github.io/mania-pp/comparison.html)
* Create more usable objects (f.e. `Record`?)
* Expand usable objects (`Player` and `Map`)
* Working plugin system
* Plugin interface
* Callback handling
Expand All @@ -37,7 +39,7 @@ Mania++ is (currently) not compatible with Windows systems and the ```./install.
* Send methods and receive responses
* Receive callbacks
* De-XMLify responses and callbacks
* Create usable objects (f.e. `Player`)
* Create usable objects (f.e. `Player` and `Map`)
* Working configuration system (YAML)

## Installing for the first time ##
Expand All @@ -56,7 +58,7 @@ Mania++ is (currently) not compatible with Windows systems and the ```./install.
* ```./Mania++```

## Check documentation of latest develop commit ##
* Latest master: not yet available
* Latest master: [Doxygen HTML](https://themaximum.github.io/mania-pp/docs/master/html/)
* Latest develop: [Doxygen HTML](https://themaximum.github.io/mania-pp/docs/develop/html/)

## Generate code documentation for current code ##
Expand Down
2 changes: 1 addition & 1 deletion doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ LOOKUP_CACHE_SIZE = 0
# normally produced when WARNINGS is set to YES.
# The default value is: NO.

EXTRACT_ALL = YES
EXTRACT_ALL = NO

# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
# be included in the documentation.
Expand Down
19 changes: 19 additions & 0 deletions plugins/HelloGoodbye/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
cmake_minimum_required (VERSION 2.6)
project (HelloGoodbyePlugin)

add_definitions(-std=c++11)
add_definitions(-Wno-deprecated)
add_definitions(-Wl,--export-dynamic)

set (LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR})
link_directories(${PROJECT_SOURCE_DIR}/../../lib/yaml/build)
include_directories("${PROJECT_SOURCE_DIR}/../../lib/yaml/include")
set (PROJECT_SOURCE_DIR ${PROJECT_SOURCE_DIR}/src)

include_directories("${PROJECT_BINARY_DIR}")
include_directories("${PROJECT_SOURCE_DIR}/../../../src")

file(GLOB_RECURSE SOURCES src/*.cpp)

add_library(HelloGoodbyePlugin SHARED ${SOURCES})
target_link_libraries(HelloGoodbyePlugin yaml-cpp)
4 changes: 4 additions & 0 deletions plugins/HelloGoodbye/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmake -DCMAKE_BUILD_TYPE=Debug -H. -Bbuild

cd ./build
make
39 changes: 39 additions & 0 deletions plugins/HelloGoodbye/src/HelloGoodbyePlugin.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include "HelloGoodbyePlugin.h"

HelloGoodbyePlugin::HelloGoodbyePlugin()
{
Version = "0.1.0";
Author = "TheM";

PlayerConnect.push_back([this](Player player) { OnPlayerConnect(player); });
PlayerDisconnect.push_back([this](Player player) { OnPlayerDisconnect(player); });
}

void HelloGoodbyePlugin::Init()
{
std::cout << "[ INFO ] Current amount of maps: " << maps->size() << std::endl;
}

void HelloGoodbyePlugin::OnPlayerConnect(Player player)
{
std::cout << "PLUGIN Player Connected: " << player.Login << "!" << std::endl;

std::stringstream chatMessage;
chatMessage << "Player joins: ";
chatMessage << player.NickName;
chatMessage << " $s$Ladder: ";
chatMessage << player.LadderRanking;

methods->ChatSendServerMessage(chatMessage.str());
}

void HelloGoodbyePlugin::OnPlayerDisconnect(Player player)
{
std::cout << "PLUGIN Player Disconnected: " << player.Login << "!" << std::endl;

std::stringstream chatMessage;
chatMessage << player.NickName;
chatMessage << " $s$zhas left the game.";

methods->ChatSendServerMessage(chatMessage.str());
}
17 changes: 17 additions & 0 deletions plugins/HelloGoodbye/src/HelloGoodbyePlugin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef HELLOGOODBYEPLUGIN_H_
#define HELLOGOODBYEPLUGIN_H_

#include <sstream>
#include "Plugins/Plugin.h"

class HelloGoodbyePlugin : public Plugin
{
public:
HelloGoodbyePlugin();

void Init();
void OnPlayerConnect(Player player);
void OnPlayerDisconnect(Player player);
};

#endif // HELLOGOODBYEPLUGIN_H_
25 changes: 25 additions & 0 deletions plugins/HelloGoodbye/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "HelloGoodbyePlugin.h"

/**
* Mania++ is a Server Controller for TrackMania 2 servers, written in C++.
* Copyright (C) 2016 Max Klaversma <maxklaversma@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

extern "C" Plugin* startPlugin()
{
HelloGoodbyePlugin* plugin = new HelloGoodbyePlugin();
return (Plugin*)plugin;
}
Loading

0 comments on commit 73eafd1

Please sign in to comment.