File: variant_template.cpp.erb

package info (click to toggle)
tagua 1.0~alpha2-15
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 8,028 kB
  • ctags: 7,178
  • sloc: cpp: 26,149; ansic: 13,039; makefile: 182; ruby: 87; sh: 39
file content (57 lines) | stat: -rw-r--r-- 1,755 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<% cvariant = variant.capitalize %>

#include "<%= variant %>.h"
#include "xchess/animator.h"
#include "xchess/piece.h"
#include "xchess/move.h"

class <%= cvariant %>Position : public ChessPosition {
public:
  typedef ChessPosition::Piece Piece;
  <%= cvariant %>Position();
  <%= cvariant %>Position(const ChessPosition&);
  <%= cvariant %>Position(Piece::Color turn, bool wk, bool wq,
                                          bool bk, bool bq, const Point& ep);
  virtual <%= cvariant %>Position* clone() const { return new <%= cvariant %>Position(*this); }
};

<%= cvariant %>Position::<%= cvariant %>Position() { }

<%= cvariant %>Position::<%= cvariant %>Position(const ChessPosition& other)
: ChessPosition(other) { }

<%= cvariant %>Position::<%= cvariant %>Position(Piece::Color turn, bool wk, bool wq,
                               bool bk, bool bq, const Point& ep)
: ChessPosition(turn, wk, wq, bk, bq, ep) { }



class <%= cvariant %>VariantInfo {
public:
  typedef <%= cvariant %>Position Position;
  typedef Position::Move Move;
  typedef Position::Piece Piece;
  typedef ChessAnimator Animator;
  static void loadPieces(PixmapLoader::Info&);
  static void forallPieces(PieceFunction& f);
  static int moveListLayout() { return 0; }
};

void <%= cvariant %>VariantInfo::loadPieces(PixmapLoader::Info& info) {
  ChessVariant::loadPieces(info);
}

void <%= cvariant %>VariantInfo::forallPieces(PieceFunction& f) {
  ChessVariant::forallPieces(f);
}



VariantInfo* <%= cvariant %>Variant::static_<%= variant %>_variant = 0;

VariantInfo* <%= cvariant %>Variant::info() {
  if (!static_<%= variant %>_variant)
    static_<%= variant %>_variant = new WrappedVariantInfo<<%= cvariant %>VariantInfo>;
  return static_<%= variant %>_variant;
}