This repository has been archived by the owner on Apr 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Shikanime
committed
Feb 5, 2018
1 parent
0cafad7
commit 8f9a8ba
Showing
13 changed files
with
415 additions
and
414 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
{ | ||
"files.associations": { | ||
"cmath": "cpp", | ||
"cstddef": "cpp", | ||
"cstdint": "cpp", | ||
"cstdio": "cpp", | ||
"cstdlib": "cpp", | ||
"cstring": "cpp", | ||
"cwchar": "cpp", | ||
"exception": "cpp", | ||
"initializer_list": "cpp", | ||
"ios": "cpp", | ||
"iosfwd": "cpp", | ||
"iostream": "cpp", | ||
"istream": "cpp", | ||
"limits": "cpp", | ||
"new": "cpp", | ||
"ostream": "cpp", | ||
"sstream": "cpp", | ||
"stdexcept": "cpp", | ||
"streambuf": "cpp", | ||
"string": "cpp", | ||
"system_error": "cpp", | ||
"type_traits": "cpp", | ||
"typeinfo": "cpp", | ||
"utility": "cpp", | ||
"xfacet": "cpp", | ||
"xiosbase": "cpp", | ||
"xlocale": "cpp", | ||
"xlocinfo": "cpp", | ||
"xlocnum": "cpp", | ||
"xmemory0": "cpp", | ||
"xstddef": "cpp", | ||
"xstring": "cpp", | ||
"xtr1common": "cpp", | ||
"xutility": "cpp" | ||
} | ||
{ | ||
"files.associations": { | ||
"cmath": "cpp", | ||
"cstddef": "cpp", | ||
"cstdint": "cpp", | ||
"cstdio": "cpp", | ||
"cstdlib": "cpp", | ||
"cstring": "cpp", | ||
"cwchar": "cpp", | ||
"exception": "cpp", | ||
"initializer_list": "cpp", | ||
"ios": "cpp", | ||
"iosfwd": "cpp", | ||
"iostream": "cpp", | ||
"istream": "cpp", | ||
"limits": "cpp", | ||
"new": "cpp", | ||
"ostream": "cpp", | ||
"sstream": "cpp", | ||
"stdexcept": "cpp", | ||
"streambuf": "cpp", | ||
"string": "cpp", | ||
"system_error": "cpp", | ||
"type_traits": "cpp", | ||
"typeinfo": "cpp", | ||
"utility": "cpp", | ||
"xfacet": "cpp", | ||
"xiosbase": "cpp", | ||
"xlocale": "cpp", | ||
"xlocinfo": "cpp", | ||
"xlocnum": "cpp", | ||
"xmemory0": "cpp", | ||
"xstddef": "cpp", | ||
"xstring": "cpp", | ||
"xtr1common": "cpp", | ||
"xutility": "cpp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,146 +1,146 @@ | ||
#include "CellProperty.hh" | ||
|
||
CellProperty::CellProperty(const bool walkable, const bool swimmable, const bool flyable, const bool event, const bool monster) noexcept | ||
: _walkable(walkable), _swimmable(swimmable), _flyable(flyable), _event(event), _monster(monster) | ||
{ | ||
} | ||
|
||
CellProperty::CellProperty(const CellType cell) noexcept | ||
{ | ||
switch (cell) { | ||
case CellType::GrassCell: | ||
CellProperty(true, false, true, false, false); | ||
break; | ||
case CellType::WaterCell: | ||
CellProperty(false, true, true, false, false); | ||
break; | ||
case CellType::RockCell: | ||
CellProperty(false, false, true, false, false); | ||
break; | ||
case CellType::MountainCell: | ||
default: | ||
CellProperty(false, false, false, false, false); | ||
break; | ||
} | ||
} | ||
|
||
bool CellProperty::operator==(CellProperty property) const noexcept | ||
{ | ||
return this->isEqual(property); | ||
} | ||
|
||
bool CellProperty::operator!=(CellProperty property) const noexcept | ||
{ | ||
return !this->isEqual(property); | ||
} | ||
|
||
bool CellProperty::isEqual(const CellProperty property) const noexcept | ||
{ | ||
return (this->isWalkable() == property.isWalkable()) && | ||
(this->isSwimmable() == property.isSwimmable()) && | ||
(this->isFlyable() == property.isFlyable()) && | ||
(this->isEvent() == property.isEvent()) && | ||
(this->isMonster() == property.isMonster()); | ||
} | ||
|
||
bool CellProperty::isWalkable(void) const noexcept | ||
{ | ||
return _walkable; | ||
} | ||
|
||
void CellProperty::setWalkable(void) noexcept | ||
{ | ||
this->_walkable = true; | ||
} | ||
|
||
void CellProperty::setNotWalkable(void) noexcept | ||
{ | ||
this->_walkable = false; | ||
} | ||
|
||
bool CellProperty::isSwimmable(void) const noexcept | ||
{ | ||
return this->_swimmable; | ||
} | ||
|
||
void CellProperty::setSwimmable(void) noexcept | ||
{ | ||
this->_swimmable = true; | ||
} | ||
|
||
void CellProperty::setNotSwimmable(void) noexcept | ||
{ | ||
this->_swimmable = false; | ||
} | ||
|
||
bool CellProperty::isFlyable(void) const noexcept | ||
{ | ||
return this->_flyable; | ||
} | ||
|
||
void CellProperty::setFlyable(void) noexcept | ||
{ | ||
this->_flyable = true; | ||
} | ||
|
||
void CellProperty::setNotFlyable(void) noexcept | ||
{ | ||
this->_flyable = false; | ||
} | ||
|
||
bool CellProperty::isEvent(void) const noexcept | ||
{ | ||
return this->_event; | ||
} | ||
|
||
void CellProperty::setEvent(void) noexcept | ||
{ | ||
this->_event = true; | ||
} | ||
|
||
void CellProperty::setNotEvent(void) noexcept | ||
{ | ||
this->_event = false; | ||
} | ||
|
||
bool CellProperty::isMonster(void) const noexcept | ||
{ | ||
return _monster; | ||
} | ||
|
||
void CellProperty::setMonster(void) noexcept | ||
{ | ||
this->_monster = true; | ||
} | ||
|
||
void CellProperty::setNotMonster(void) noexcept | ||
{ | ||
this->_monster = false; | ||
} | ||
|
||
CellProperty getCellFlags(const CellType cell) noexcept | ||
{ | ||
switch (cell) { | ||
case CellType::GrassCell: | ||
return CellProperty(true, false, true, false, false); | ||
case CellType::WaterCell: | ||
return CellProperty(false, true, true, false, false); | ||
case CellType::RockCell: | ||
return CellProperty(false, false, true, false, false); | ||
case CellType::MountainCell: | ||
return CellProperty(false, false, false, false, false); | ||
default: | ||
return CellProperty(false, false, false, false, false); | ||
} | ||
} | ||
|
||
bool hasFlag(CellType cell, CellProperty property) noexcept | ||
{ | ||
CellProperty cellProperty(getCellFlags(cell)); | ||
|
||
return (cellProperty.isWalkable() == property.isWalkable()) || | ||
(cellProperty.isSwimmable() == property.isSwimmable()) || | ||
(cellProperty.isFlyable() == property.isFlyable()) || | ||
(cellProperty.isEvent() == property.isEvent()) || | ||
(cellProperty.isMonster() == property.isMonster()); | ||
#include "CellProperty.hh" | ||
|
||
CellProperty::CellProperty(const bool walkable, const bool swimmable, const bool flyable, const bool event, const bool monster) noexcept | ||
: _walkable(walkable), _swimmable(swimmable), _flyable(flyable), _event(event), _monster(monster) | ||
{ | ||
} | ||
|
||
CellProperty::CellProperty(const CellType cell) noexcept | ||
{ | ||
switch (cell) { | ||
case CellType::GrassCell: | ||
CellProperty(true, false, true, false, false); | ||
break; | ||
case CellType::WaterCell: | ||
CellProperty(false, true, true, false, false); | ||
break; | ||
case CellType::RockCell: | ||
CellProperty(false, false, true, false, false); | ||
break; | ||
case CellType::MountainCell: | ||
default: | ||
CellProperty(false, false, false, false, false); | ||
break; | ||
} | ||
} | ||
|
||
bool CellProperty::operator==(CellProperty property) const noexcept | ||
{ | ||
return this->isEqual(property); | ||
} | ||
|
||
bool CellProperty::operator!=(CellProperty property) const noexcept | ||
{ | ||
return !this->isEqual(property); | ||
} | ||
|
||
bool CellProperty::isEqual(const CellProperty property) const noexcept | ||
{ | ||
return (this->isWalkable() == property.isWalkable()) && | ||
(this->isSwimmable() == property.isSwimmable()) && | ||
(this->isFlyable() == property.isFlyable()) && | ||
(this->isEvent() == property.isEvent()) && | ||
(this->isMonster() == property.isMonster()); | ||
} | ||
|
||
bool CellProperty::isWalkable(void) const noexcept | ||
{ | ||
return _walkable; | ||
} | ||
|
||
void CellProperty::setWalkable(void) noexcept | ||
{ | ||
this->_walkable = true; | ||
} | ||
|
||
void CellProperty::setNotWalkable(void) noexcept | ||
{ | ||
this->_walkable = false; | ||
} | ||
|
||
bool CellProperty::isSwimmable(void) const noexcept | ||
{ | ||
return this->_swimmable; | ||
} | ||
|
||
void CellProperty::setSwimmable(void) noexcept | ||
{ | ||
this->_swimmable = true; | ||
} | ||
|
||
void CellProperty::setNotSwimmable(void) noexcept | ||
{ | ||
this->_swimmable = false; | ||
} | ||
|
||
bool CellProperty::isFlyable(void) const noexcept | ||
{ | ||
return this->_flyable; | ||
} | ||
|
||
void CellProperty::setFlyable(void) noexcept | ||
{ | ||
this->_flyable = true; | ||
} | ||
|
||
void CellProperty::setNotFlyable(void) noexcept | ||
{ | ||
this->_flyable = false; | ||
} | ||
|
||
bool CellProperty::isEvent(void) const noexcept | ||
{ | ||
return this->_event; | ||
} | ||
|
||
void CellProperty::setEvent(void) noexcept | ||
{ | ||
this->_event = true; | ||
} | ||
|
||
void CellProperty::setNotEvent(void) noexcept | ||
{ | ||
this->_event = false; | ||
} | ||
|
||
bool CellProperty::isMonster(void) const noexcept | ||
{ | ||
return _monster; | ||
} | ||
|
||
void CellProperty::setMonster(void) noexcept | ||
{ | ||
this->_monster = true; | ||
} | ||
|
||
void CellProperty::setNotMonster(void) noexcept | ||
{ | ||
this->_monster = false; | ||
} | ||
|
||
CellProperty getCellFlags(const CellType cell) noexcept | ||
{ | ||
switch (cell) { | ||
case CellType::GrassCell: | ||
return CellProperty(true, false, true, false, false); | ||
case CellType::WaterCell: | ||
return CellProperty(false, true, true, false, false); | ||
case CellType::RockCell: | ||
return CellProperty(false, false, true, false, false); | ||
case CellType::MountainCell: | ||
return CellProperty(false, false, false, false, false); | ||
default: | ||
return CellProperty(false, false, false, false, false); | ||
} | ||
} | ||
|
||
bool hasFlag(CellType cell, CellProperty property) noexcept | ||
{ | ||
CellProperty cellProperty(getCellFlags(cell)); | ||
|
||
return (cellProperty.isWalkable() == property.isWalkable()) || | ||
(cellProperty.isSwimmable() == property.isSwimmable()) || | ||
(cellProperty.isFlyable() == property.isFlyable()) || | ||
(cellProperty.isEvent() == property.isEvent()) || | ||
(cellProperty.isMonster() == property.isMonster()); | ||
} |
Oops, something went wrong.