Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool TurnContext::selectCard(const Interface::CardSelection& options, bool optional)
- {
- if(!optional && options.empty())
- throw Exception::LogicError("options cannot be empty if optional is false");
- if(options.empty())
- return false;
- if(options.size() == 1 && !optional){
- options.toggle(0);
- return true;
- }
- self.selectCard(*this, options);//(const TurnContext&, const Interface::CardSelection&, bool = true) = 0;
- if(!optional && options.countSelected() != 1)
- throw Exception::RuntimeError("!optional && options.countSelected() != 1");
- return true;//something above is surely wrong
- }
- size_t TurnContext::selectCards(const Interface::CardSelection& options, size_t min, size_t max)
- {
- if(!options.validate())
- throw Exception::LogicError("!options.validate()");
- if(options.empty()){
- min = max = 0;
- return 0;
- }
- min = 1;
- max = options.size();
- self.selectCards(*this, options, min, max);//(,, size_t min = 0, size_t max = -1)
- if(options.countSelected() == 0)
- throw Exception::RuntimeError("the player selection is invalid");
- return options.countSelected();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement