|
1 | | -#pragma once |
2 | | -#include <exception> |
3 | | -#include <string> |
4 | | - |
5 | | -using namespace std; |
6 | | - |
7 | | -class GameException : public exception{ |
8 | | -protected : |
9 | | - string message; |
10 | | -public : |
11 | | - GameException(const string& message); |
12 | | - virtual const char* what() const noexcept; |
13 | | -}; |
14 | | - |
15 | | - |
16 | | -// ECONOMY |
17 | | -class InsufficientFundsException : public GameException { |
18 | | -private : |
19 | | - int required; |
20 | | - int cur; |
21 | | -public : |
22 | | - InsufficientFundsException(const int& required, const int& cur); |
23 | | -}; |
24 | | - |
25 | | -// CARD |
26 | | -class InventoryFullException : public GameException{ |
27 | | -public : |
28 | | - InventoryFullException(); |
29 | | -}; |
30 | | - |
31 | | -class CardNotFoundException : public GameException{ |
32 | | -private : |
33 | | - string cardName; |
34 | | -public : |
35 | | - CardNotFoundException(const string& cardName); |
36 | | -}; |
37 | | - |
38 | | -class AlreadyUseCardException : public GameException{ |
39 | | -public : |
40 | | - AlreadyUseCardException(); |
41 | | -}; |
42 | | - |
43 | | -class UseCardAfterDiceException : public GameException{ |
44 | | -public : |
45 | | - UseCardAfterDiceException(); |
46 | | -}; |
47 | | - |
48 | | -// Property |
49 | | -class TileNotFoundException : public GameException{ |
50 | | -private : |
51 | | - string code; |
52 | | -public : |
53 | | - TileNotFoundException(const string& code); |
54 | | -}; |
55 | | - |
56 | | -class PropertyNotOwnedException : public GameException{ |
57 | | -public : |
58 | | - PropertyNotOwnedException(); |
59 | | -}; |
60 | | - |
61 | | -class PropertyAlreadyOwnedException : public GameException{ |
62 | | -public : |
63 | | - PropertyAlreadyOwnedException(); |
64 | | -}; |
65 | | - |
66 | | -// MORTGAGE |
67 | | -class PropertyMortgagedException : public GameException{ |
68 | | -public : |
69 | | - PropertyMortgagedException(); |
70 | | -}; |
71 | | - |
72 | | -class NotMortgagedException : public GameException{ |
73 | | -public : |
74 | | - NotMortgagedException(); |
75 | | -}; |
76 | | - |
77 | | -class HasBuildingForMortgage : public GameException{ |
78 | | -public : |
79 | | - HasBuildingForMortgage(); |
80 | | -}; |
81 | | - |
82 | | -// BUILD |
83 | | -class UnevenBuildingException : public GameException{ |
84 | | -private : |
85 | | - string color; |
86 | | -public : |
87 | | - UnevenBuildingException(const string& color); |
88 | | -}; |
89 | | - |
90 | | -class MaxBuildingException : public GameException{ |
91 | | -public : |
92 | | - MaxBuildingException(); |
93 | | -}; |
94 | | - |
95 | | -class UpgradeHotelException : public GameException{ |
96 | | -public : |
97 | | - UpgradeHotelException(); |
98 | | -}; |
99 | | - |
100 | | -// INPUT |
101 | | -class InvalidCommandException : public GameException{ |
102 | | -public : |
103 | | - InvalidCommandException(); |
104 | | -}; |
105 | | - |
106 | | -class InvalidArgumentException : public GameException{ |
107 | | -private : |
108 | | - string arg; |
109 | | -public : |
110 | | - InvalidArgumentException(const string& arg); |
111 | | -}; |
112 | | - |
113 | | -// Dice |
114 | | -class RollDiceException : public GameException{ |
115 | | -public : |
116 | | - RollDiceException(); |
117 | | -}; |
118 | | - |
119 | | -// System |
120 | | -class FileNotFoundException : public GameException{ |
121 | | -private : |
122 | | - string filename; |
123 | | -public : |
124 | | - FileNotFoundException(const string& filename); |
125 | | -}; |
| 1 | +#pragma once |
| 2 | +#include <exception> |
| 3 | +#include <string> |
| 4 | + |
| 5 | +using namespace std; |
| 6 | + |
| 7 | +class GameException : public exception{ |
| 8 | +protected : |
| 9 | + string message; |
| 10 | +public : |
| 11 | + GameException(const string& message); |
| 12 | + virtual const char* what() const noexcept; |
| 13 | +}; |
| 14 | + |
| 15 | + |
| 16 | +// ECONOMY |
| 17 | +class InsufficientFundsException : public GameException { |
| 18 | +private : |
| 19 | + int required; |
| 20 | + int cur; |
| 21 | +public : |
| 22 | + InsufficientFundsException(const int& required, const int& cur); |
| 23 | +}; |
| 24 | + |
| 25 | +// CARD |
| 26 | +class InventoryFullException : public GameException{ |
| 27 | +public : |
| 28 | + InventoryFullException(); |
| 29 | +}; |
| 30 | + |
| 31 | +class CardNotFoundException : public GameException{ |
| 32 | +private : |
| 33 | + string cardName; |
| 34 | +public : |
| 35 | + CardNotFoundException(const string& cardName); |
| 36 | +}; |
| 37 | + |
| 38 | +class AlreadyUseCardException : public GameException{ |
| 39 | +public : |
| 40 | + AlreadyUseCardException(); |
| 41 | +}; |
| 42 | + |
| 43 | +class UseCardAfterDiceException : public GameException{ |
| 44 | +public : |
| 45 | + UseCardAfterDiceException(); |
| 46 | +}; |
| 47 | + |
| 48 | +// Property |
| 49 | +class TileNotFoundException : public GameException{ |
| 50 | +private : |
| 51 | + string code; |
| 52 | +public : |
| 53 | + TileNotFoundException(const string& code); |
| 54 | +}; |
| 55 | + |
| 56 | +class PropertyNotOwnedException : public GameException{ |
| 57 | +public : |
| 58 | + PropertyNotOwnedException(); |
| 59 | +}; |
| 60 | + |
| 61 | +class PropertyAlreadyOwnedException : public GameException{ |
| 62 | +public : |
| 63 | + PropertyAlreadyOwnedException(); |
| 64 | +}; |
| 65 | + |
| 66 | +// MORTGAGE |
| 67 | +class PropertyMortgagedException : public GameException{ |
| 68 | +public : |
| 69 | + PropertyMortgagedException(); |
| 70 | +}; |
| 71 | + |
| 72 | +class NotMortgagedException : public GameException{ |
| 73 | +public : |
| 74 | + NotMortgagedException(); |
| 75 | +}; |
| 76 | + |
| 77 | +class HasBuildingForMortgage : public GameException{ |
| 78 | +public : |
| 79 | + HasBuildingForMortgage(); |
| 80 | +}; |
| 81 | + |
| 82 | +// BUILD |
| 83 | +class UnevenBuildingException : public GameException{ |
| 84 | +private : |
| 85 | + string color; |
| 86 | +public : |
| 87 | + UnevenBuildingException(const string& color); |
| 88 | +}; |
| 89 | + |
| 90 | +class MaxBuildingException : public GameException{ |
| 91 | +public : |
| 92 | + MaxBuildingException(); |
| 93 | +}; |
| 94 | + |
| 95 | +class UpgradeHotelException : public GameException{ |
| 96 | +public : |
| 97 | + UpgradeHotelException(); |
| 98 | +}; |
| 99 | + |
| 100 | +// INPUT |
| 101 | +class InvalidCommandException : public GameException{ |
| 102 | +public : |
| 103 | + InvalidCommandException(); |
| 104 | +}; |
| 105 | + |
| 106 | +class InvalidArgumentException : public GameException{ |
| 107 | +private : |
| 108 | + string arg; |
| 109 | +public : |
| 110 | + InvalidArgumentException(const string& arg); |
| 111 | +}; |
| 112 | + |
| 113 | +// Dice |
| 114 | +class RollDiceException : public GameException{ |
| 115 | +public : |
| 116 | + RollDiceException(); |
| 117 | +}; |
| 118 | + |
| 119 | +// System |
| 120 | +class FileNotFoundException : public GameException{ |
| 121 | +private : |
| 122 | + string filename; |
| 123 | +public : |
| 124 | + FileNotFoundException(const string& filename); |
| 125 | +}; |
0 commit comments