Skip to content

Commit

Permalink
Process JSON Code: License + Dependency Check
Browse files Browse the repository at this point in the history
  • Loading branch information
jetrotal committed Jul 13, 2024
1 parent 1cc991f commit 85e9ac9
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/game_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5148,7 +5148,14 @@ bool Game_Interpreter::CommandEasyRpgSetInterpreterFlag(lcf::rpg::EventCommand c
return true;
}
bool Game_Interpreter::CommandProcessJson(lcf::rpg::EventCommand const& com) {

#ifndef HAVE_NLOHMANN_JSON
Output::Warning("CommandProcessJson: JSON not supported on this platform");
return true;
#else

if (!Player::IsPatchManiac()) {
Output::Warning("CommandProcessJson: This command needs Maniac Patch support");
return true;
}

Expand Down Expand Up @@ -5213,6 +5220,8 @@ bool Game_Interpreter::CommandProcessJson(lcf::rpg::EventCommand const& com) {
}

return true;

#endif // !HAVE_NLOHMANN_JSON
}

Game_Interpreter& Game_Interpreter::GetForegroundInterpreter() {
Expand Down
22 changes: 22 additions & 0 deletions src/json_helper.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
/*
* This file is part of EasyRPG Player.
*
* EasyRPG Player 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.
*
* EasyRPG Player 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 EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
*/

#include "json_helper.h"

#ifdef HAVE_NLOHMANN_JSON

#include "output.h"
#include <sstream>
#include <unordered_map>
Expand Down Expand Up @@ -148,3 +168,5 @@ namespace Json_Helper {
}

}

#endif // HAVE_NLOHMANN_JSON
22 changes: 22 additions & 0 deletions src/json_helper.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
/*
* This file is part of EasyRPG Player.
*
* EasyRPG Player 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.
*
* EasyRPG Player 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 EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef JSON_HELPER_H
#define JSON_HELPER_H

#include "system.h"

#ifdef HAVE_NLOHMANN_JSON

#include <string>
#include <nlohmann/json.hpp>

Expand All @@ -9,4 +30,5 @@ namespace Json_Helper {
std::string SetValue(std::string_view json_data, std::string_view json_path, std::string_view value);
}

#endif // HAVE_NLOHMANN_JSON
#endif // JSON_HELPER_H

0 comments on commit 85e9ac9

Please sign in to comment.