forked from cataclysmbnteam/Cataclysm-BN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iuse_software.cpp
77 lines (67 loc) · 1.9 KB
/
iuse_software.cpp
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
#include "iuse_software.h"
#include <algorithm>
#include <map>
#include <string>
#include "cursesdef.h"
#include "iuse_software_kitten.h"
#include "iuse_software_lightson.h"
#include "iuse_software_minesweeper.h"
#include "iuse_software_snake.h"
#include "iuse_software_sokoban.h"
#include "output.h"
#include "point.h"
#include "string_formatter.h"
#include "translations.h"
bool play_videogame( const std::string &function_name,
std::string &end_message,
int &score )
{
if( function_name == "null" ) {
score = 30;
return true; // generic game
}
if( function_name == "robot_finds_kitten" ) {
robot_finds_kitten findkitten;
bool foundkitten = findkitten.ret;
if( foundkitten ) {
end_message = _( "You found kitten!" );
score = 30;
}
return foundkitten;
} else if( function_name == "snake_game" ) {
snake_game sg;
int iScore = sg.start_game();
if( iScore >= 10000 ) {
score = 30;
} else if( iScore >= 5000 ) {
score = 15;
} else {
score = 5;
}
return true;
} else if( function_name == "sokoban_game" ) {
sokoban_game sg;
int iScore = sg.start_game();
if( iScore >= 5000 ) {
score = 30;
} else if( iScore >= 1000 ) {
score = 15;
} else {
score = 5;
}
return true;
} else if( function_name == "minesweeper_game" ) {
minesweeper_game mg;
score = mg.start_game();
return true;
} else if( function_name == "lightson_game" ) {
lightson_game lg;
int iScore = lg.start_game();
score = std::min( 15, iScore * 3 );
return true;
} else {
debugmsg( "Invalid function_name for play_videogame." );
score = 0;
return false;
}
}