Skip to content

Commit

Permalink
Update header inclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
edo9300 committed Jan 5, 2024
1 parent 8b4bd4a commit 5ccba86
Show file tree
Hide file tree
Showing 26 changed files with 129 additions and 113 deletions.
16 changes: 9 additions & 7 deletions card.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include <algorithm> //std::sort
#include <cstring> //std::memcpy
#include <utility> //std::pair, std::make_pair, std::swap
#include <set>
#include <vector>
#include "card.h"
#include "field.h"
#include "effect.h"
#include "duel.h"
#include "group.h"
#include "effect.h"
#include "field.h"
#include "interpreter.h"
#include <algorithm>
#include <iterator>

bool card_sort::operator()(const card* c1, const card* c2) const {
return c1->cardid < c2->cardid;
Expand Down Expand Up @@ -2170,7 +2172,7 @@ void card::refresh_disable_status() {
else
set_status(STATUS_DISABLED, FALSE);
}
std::tuple<uint8_t, effect*> card::refresh_control_status() {
std::pair<uint8_t, effect*> card::refresh_control_status() {
uint8_t final = owner;
effect* ceffect = nullptr;
uint32_t last_id = 0;
Expand All @@ -2185,7 +2187,7 @@ std::tuple<uint8_t, effect*> card::refresh_control_status() {
ceffect = peffect;
}
}
return std::make_tuple(final, ceffect);
return std::make_pair(final, ceffect);
}
void card::count_turn(uint16_t ct) {
turn_counter = ct;
Expand Down
13 changes: 6 additions & 7 deletions card.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@
#ifndef CARD_H_
#define CARD_H_

#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include "containers_fwd.h"
#include "common.h"
#include "lua_obj.h"
#include "duel.h"
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <tuple>
#include "lua_obj.h"

class card;
class duel;
Expand Down Expand Up @@ -267,7 +266,7 @@ class card : public lua_obj_helper<LuaParam::CARD> {
void reset(uint32_t id, uint32_t reset_type);
void reset_effect_count();
void refresh_disable_status();
std::tuple<uint8_t, effect*> refresh_control_status();
std::pair<uint8_t, effect*> refresh_control_status();

void count_turn(uint16_t ct);
void create_relation(card* target, uint32_t reset);
Expand Down
4 changes: 2 additions & 2 deletions containers_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#ifndef CONTAINERS_FWD_H
#define CONTAINERS_FWD_H

#include <vector>
#include <cstdint>
#include <set>
#include <list>
#include <map>
#include <unordered_map>
#include <vector>
#include <set>

class group;

Expand Down
9 changes: 5 additions & 4 deletions duel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include "duel.h"
#include "interpreter.h"
#include "field.h"
#include <array>
#include <cstring> //std::memcpy
#include "card.h"
#include "duel.h"
#include "effect.h"
#include "group.h"
#include "field.h"
#include "interpreter.h"

duel::duel(const OCG_DuelOptions& options) :
random(std::array<uint64_t,4>{ { options.seed[0], options.seed[1], options.seed[2], options.seed[3] } }),
Expand Down
13 changes: 7 additions & 6 deletions duel.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@
#ifndef DUEL_H_
#define DUEL_H_

#include <deque>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <utility> //std::forward
#include <vector>
#include "common.h"
#include "ocgapi_types.h"
#include "group.h"
#include "interpreter.h"
#include "ocgapi_types.h"
#include "RNG/Xoshiro256.hpp"
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <deque>

class card;
class effect;
Expand Down
5 changes: 3 additions & 2 deletions effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include "effect.h"
#include <vector>
#include "card.h"
#include "duel.h"
#include "group.h"
#include "effect.h"
#include "field.h"
#include "interpreter.h"

bool effect_sort_id(const effect* e1, const effect* e2) {
Expand Down
7 changes: 3 additions & 4 deletions effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@
#ifndef EFFECT_H_
#define EFFECT_H_

#include <cstdlib>
#include <lua.h> //lua_Integer
#include <vector>
#include <map>
#include "common.h"
#include "lua_obj.h"
#include "field.h"
#include "effect_constants.h"
#include "lua_obj.h"

class card;
class duel;
class group;
struct chain;
struct tevent;
enum effect_flag : uint32_t;
enum effect_flag2 : uint32_t;
Expand Down
11 changes: 7 additions & 4 deletions field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include <algorithm>
#include "field.h"
#include "duel.h"
#include <algorithm> //std::sort, std::swap, std::find, std::find_if, std::min, std::none_of
#include <cstring> //std::memcmp
#include <utility> //std::move
#include <vector>
#include "card.h"
#include "group.h"
#include "duel.h"
#include "effect.h"
#include "field.h"
#include "group.h"
#include "interpreter.h"

int32_t field::field_used_count[32] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5};
Expand Down
20 changes: 9 additions & 11 deletions field.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@
#ifndef FIELD_H_
#define FIELD_H_

#include "containers_fwd.h"
#include "common.h"
#include "card.h"
#include "progressivebuffer.h"
#include <vector>
#include <set>
#include <map>
#include <list>
#include <array>
#include <functional>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cmath>
#include <utility> //std::forward
#include <vector>
#include "card.h"
#include "common.h"
#include "containers_fwd.h"
#include "progressivebuffer.h"

class duel;
class group;
Expand Down
3 changes: 1 addition & 2 deletions function_array_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
#define MAKE_LUA_NAME(module, name) MAKE_LUA_NAME_IMPL(module, name)

#ifndef __INTELLISENSE__
#include <type_traits>
#include <array>
#include <lauxlib.h>

#include <type_traits>
#include "common.h"

//use forceinline only in release builds
Expand Down
2 changes: 1 addition & 1 deletion group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include "group.h"
#include "card.h"
#include "group.h"

group::group(duel* pd, lua_obj* pobj) :
lua_obj_helper(pd)
Expand Down
6 changes: 3 additions & 3 deletions group.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
#ifndef GROUP_H_
#define GROUP_H_

#include "containers_fwd.h"
#include "common.h"
#include "lua_obj.h"
#include <set>
#include <vector>
#include "common.h"
#include "containers_fwd.h"
#include "lua_obj.h"

class card;
class duel;
Expand Down
12 changes: 7 additions & 5 deletions interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include "lua_obj.h"
#include <cstring> //std::memcpy
#include <utility> //std::exchange
#include <vector>
#include "duel.h"
#include "group.h"
#include "card.h"
#include "effect.h"
#include "scriptlib.h"
#include "field.h"
#include "interpreter.h"
#include <cmath>
#include <utility> //std::exchange
#include "lua_obj.h"
#include "group.h"
#include "scriptlib.h"

using namespace scriptlib;

Expand Down
13 changes: 5 additions & 8 deletions interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,15 @@
#define INTERPRETER_H_

// Due to longjmp behaviour, we must build Lua as C++ to avoid UB
#include <cstdio> //std::snprintf
#include <lauxlib.h>
#include <list>
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>

#include "common.h"
#include <unordered_map>
#include <list>
#include <vector>
#include <utility> //std::forward
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include "common.h"
#include "lua_obj.h"
#include "ocgapi_types.h"

Expand Down
10 changes: 6 additions & 4 deletions libcard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include <algorithm>
#include "scriptlib.h"
#include "duel.h"
#include "field.h"
#include <algorithm> //std::any_of
#include <iterator> //std::distance
#include <set>
#include "card.h"
#include "duel.h"
#include "effect.h"
#include "field.h"
#include "group.h"
#include "scriptlib.h"

#define LUA_MODULE Card
using LUA_CLASS = card;
Expand Down
4 changes: 2 additions & 2 deletions libdebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include "scriptlib.h"
#include "card.h"
#include "duel.h"
#include "field.h"
#include "card.h"
#include "scriptlib.h"

#define LUA_MODULE Debug
#include "function_array_helper.h"
Expand Down
13 changes: 7 additions & 6 deletions libduel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include <algorithm>
#include <numeric>
#include "scriptlib.h"
#include "duel.h"
#include "field.h"
#include <algorithm> //std::min, std::find
#include <numeric> //std::iota
#include <utility> //std::move, std::swap
#include "card.h"
#include "bit.h"
#include "duel.h"
#include "effect.h"
#include "field.h"
#include "group.h"
#include "bit.h"
#include "scriptlib.h"

#define LUA_MODULE Duel
#include "function_array_helper.h"
Expand Down
6 changes: 2 additions & 4 deletions libeffect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include "scriptlib.h"
#include "duel.h"
#include "field.h"
#include "card.h"
#include "effect.h"
#include "group.h"
#include "field.h"
#include "scriptlib.h"

#define LUA_MODULE Effect
using LUA_CLASS = effect;
Expand Down
15 changes: 9 additions & 6 deletions libgroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include <iterator>
#include <algorithm>
#include "scriptlib.h"
#include "group.h"
#include <algorithm> //std::find, std::remove, std::includes, std::set_intersection
#include <iterator> //std::advance, std::inserter
#include <set>
#include <tuple>
#include <utility> //std::move, std::swap
#include "bit.h"
#include "card.h"
#include "effect.h"
#include "duel.h"
#include "bit.h"
#include "field.h"
#include "group.h"
#include "scriptlib.h"

#define LUA_MODULE Group
using LUA_CLASS = group;
Expand Down
Loading

0 comments on commit 5ccba86

Please sign in to comment.