forked from DFHack/dfhack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkittens.cpp
More file actions
86 lines (80 loc) · 2.12 KB
/
Copy pathkittens.cpp
File metadata and controls
86 lines (80 loc) · 2.12 KB
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
#include <dfhack/Core.h>
#include <dfhack/Console.h>
#include <dfhack/Export.h>
#include <dfhack/PluginManager.h>
#include <vector>
#include <string>
using std::vector;
using std::string;
using namespace DFHack;
//FIXME: possible race conditions with calling kittens from the IO thread and shutdown from Core.
bool shutdown_flag = false;
bool final_flag = true;
DFhackCExport command_result kittens (Core * c, vector <string> & parameters);
DFhackCExport const char * plugin_name ( void )
{
return "kittens";
}
DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
commands.clear();
commands.push_back(PluginCommand("kittens","Rainbow kittens. What else?",kittens));
commands.push_back(PluginCommand("kittanz","Guess what. More rainbow kittenz.",kittens));
return CR_OK;
}
DFhackCExport command_result plugin_shutdown ( Core * c )
{
shutdown_flag = true;
while(!final_flag)
{
c->con->msleep(60);
}
return CR_OK;
}
DFhackCExport command_result kittens (Core * c, vector <string> & parameters)
{
final_flag = false;
Console * con = c->con;
const char * kittenz1 []=
{
" ____",
" (. \\",
" \\ | ",
" \\ |___(\\--/)",
" __/ ( . . )",
" \"'._. '-.O.'",
" '-. \\ \"|\\",
" '.,,/'.,,mrf",
0
};
con->cursor(false);
con->clear();
int color = 1;
while(1)
{
if(shutdown_flag)
{
final_flag = true;
c->con->reset_color();
dfout << std::endl << "MEOW!" << std::endl << std::flush;
return CR_OK;
}
con->color(color);
int index = 0;
const char * kit = kittenz1[index];
con->gotoxy(1,1);
dfout << "Your DF is now full of kittens!" << std::endl;
while (kit != 0)
{
con->gotoxy(5,5+index);
dfout << kit;
index++;
kit = kittenz1[index];
}
dfout.flush();
con->msleep(60);
color ++;
if(color > 15)
color = 1;
}
}