Skip to content

Commit

Permalink
clang format
Browse files Browse the repository at this point in the history
  • Loading branch information
goblinhack committed Jan 8, 2025
1 parent 81ade69 commit ea2bde7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
2 changes: 2 additions & 0 deletions src/my_tps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright Neil McGill, [email protected]
//

/* clang-format off */
bool templates_init(void);

/* begin shell marker1 */
Expand All @@ -18,3 +19,4 @@ bool tp_load_door();
bool tp_load_wall();
bool tp_load_floor();
/* end shell marker1 */
/* clang-format on */
30 changes: 14 additions & 16 deletions src/tp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// they have fixed numbers. This list helps to achieve that. It is optional for a template
// to be in this list
//
/* clang-format off */
std::initializer_list< std::string > tps = {
// clang-format off
"", // ID 0 means unused
Expand All @@ -42,15 +43,16 @@ std::initializer_list< std::string > tps = {
"floor",
/* end shell marker1 */
};
/* clang-format on */

class Tp
{
public:
uint8_t z_depth {};

TpId id {};
TpId id {};

std::vector<class Tile *> tiles;
std::vector< class Tile * > tiles;

bool is_monst_class[ MONST_CLASS_MAX ] {};

Expand Down Expand Up @@ -82,7 +84,7 @@ using Tpidmap = std::vector< class Tp * >;
Tpidmap tp_id_map;

// begin sort marker3 {
static Tpidmap tp_flag_map[THING_FLAG_MAX];
static Tpidmap tp_flag_map[ THING_FLAG_MAX ];
static Tpidmap tp_monst_class[ MONST_CLASS_MAX ];
// end sort marker3 }

Expand Down Expand Up @@ -219,8 +221,8 @@ Tpp tp_load(const char *name_in)
DIE("tp_load: thing template name [%s] already loaded", name_in);
}

auto tp = new Tp();
tp->name = name;
auto tp = new Tp();
tp->name = name;
tp->text_short_name = name;

auto result = tp_name_map.insert(std::make_pair(name, tp));
Expand Down Expand Up @@ -250,7 +252,7 @@ Tilep tp_first_tile(Tpp tp)
//
// Get the first anim tile.
//
return tp->tiles[0];
return tp->tiles[ 0 ];
}

void tp_random_dungeon_init(void)
Expand All @@ -269,8 +271,8 @@ void tp_random_dungeon_init(void)
}

for (auto f = 0; f < THING_FLAG_MAX; f++) {
if (tp->flag[f]) {
tp_flag_map[f].push_back(tp);
if (tp->flag[ f ]) {
tp_flag_map[ f ].push_back(tp);
}
}
}
Expand Down Expand Up @@ -329,11 +331,11 @@ Tpp tp_random_monst(int c)
Tpp tp_random(ThingFlag f)
{
TRACE_NO_INDENT();
if (unlikely(! tp_flag_map[f].size())) {
if (unlikely(! tp_flag_map[ f ].size())) {
DIE("No wall found");
return nullptr;
}
return tp_get_with_no_rarity_filter(tp_flag_map[f]);
return tp_get_with_no_rarity_filter(tp_flag_map[ f ]);
}

Tilep tp_tiles_get(Tpp tp, int index) { return tp->tiles[ index ]; }
Expand All @@ -344,13 +346,9 @@ const char *tp_name(Tpp tp) { return tp->name.c_str(); }
const char *to_string(Tpp tp) { return tp->text_short_name.c_str(); }
const char *to_short_string(Tpp tp) { return tp->text_short_name.c_str(); }

bool tp_flag(Tpp tp, ThingFlag f) {
return tp->flag[f];
}
bool tp_flag(Tpp tp, ThingFlag f) { return tp->flag[ f ]; }

void tp_flag_set(Tpp tp, ThingFlag f, bool val) {
tp->flag[f] = val;
}
void tp_flag_set(Tpp tp, ThingFlag f, bool val) { tp->flag[ f ] = val; }

uint8_t tp_player_index_get(Tpp tp) { return tp->player_index; };
void tp_player_index_set(Tpp tp, uint8_t val) { tp->player_index = val; };
Expand Down
2 changes: 2 additions & 0 deletions src/tps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "my_callstack.hpp"
#include "my_tps.hpp"
/* clang-format off */

bool templates_init(void)
{
Expand Down Expand Up @@ -42,3 +43,4 @@ bool templates_init(void)

return true;
}
/* clang-format on */

0 comments on commit ea2bde7

Please sign in to comment.