summaryrefslogtreecommitdiff
path: root/src/text.cpp
blob: de335eb41674b7bb534eadcc7281b20118e73a92 (plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#include "common.hpp"

namespace text {

language_t language = LANG_ENGLISH;

static const char *human_names[] = {
	"Kowalski", "Jackson", "Carter", "O'Neill", "Hammond", "Mitchell"
};

#define count(A) (sizeof(A) / sizeof((A)[0]))

static std::string get_english(index_t index)
{
	switch (index) {
	case SAY_BLOCKED:
		return "Something is in my way.";

	case SAY_NO_PATH:
		return "I can't get there.";

	case SAY_READY:
		return "Ready for orders.";

	case SAY_MOVING:
		return "On my way.";

	case UNIT_ALIEN:
		return "Alien";

	case UNIT_HUMAN:
		return human_names[rand() % count(human_names)];

	case UNIT_DEATH:
		return "died";

	case UNIT_ATTACK:
		return "attacks";

	case UNIT_MISS:
		return "miss";

	case UNIT_CRITICAL_MISS:
		return "critical miss";

	case UNIT_HIT:
		return "hit";

	case UNIT_CRITICAL_HIT:
		return "critical hit";

	case UNIT_DAMAGE:
		return "deals damage to";

	default:
		abort();
	}
}

static std::string get_polish(index_t index)
{
	switch (index) {
	case SAY_BLOCKED:
		return "Coś jest na mojej drodze.";

	case SAY_NO_PATH:
		return "Nie mogę się tam dostać.";

	case SAY_READY:
		return "Gotowy na rozkaz.";

	case SAY_MOVING:
		return "Jestem w drodze.";

	case UNIT_ALIEN:
		return "Obcy";

	case UNIT_HUMAN:
		return human_names[rand() % count(human_names)];

	case UNIT_DEATH:
		return "nie żyje";

	case UNIT_ATTACK:
		return "atakuje";

	case UNIT_MISS:
		return "chybienie";

	case UNIT_CRITICAL_MISS:
		return "chybienie krytyczne";

	case UNIT_HIT:
		return "trafienie";

	case UNIT_CRITICAL_HIT:
		return "trafienie krytyczne";

	case UNIT_DAMAGE:
		return "zadaje obrażenia";

	default:
		abort();
	}
}
std::string get(index_t index)
{
	switch (language) {
	case LANG_ENGLISH:
		return get_english(index);

	case LANG_POLISH:
		return get_polish(index);

	default:
		abort();
	}
}

} // namespace text