OSDN Git Service

Field::UpdateSight() を追加、一部実装。 Add Field::UpdateSight() and implement that in part.
authorDeskull <desull@users.sourceforge.jp>
Wed, 7 Jan 2015 14:31:29 +0000 (23:31 +0900)
committerDeskull <desull@users.sourceforge.jp>
Wed, 7 Jan 2015 14:31:29 +0000 (23:31 +0900)
Deeangband/Creature.cpp
Deeangband/Field.cpp
Deeangband/Field.h

index 5c85968..1ae2753 100644 (file)
@@ -430,7 +430,6 @@ namespace Deeangband
                std::vector<Coordinates>::iterator rangeIt;
                this->sight.clear();
                this->position.GetRoundRange(rangeVec, 0, 12);
-               //std::for_each(rangeVec.begin(), rangeVec.end(), [&](const Coordinates r) { this->lore.GetFieldLore(0, r->GetX(), r.GetY()); });
                for(rangeIt = rangeVec.begin(); rangeIt != rangeVec.end(); rangeIt++)
                {
                        if(fieldPtr->HaveSight(this->position.GetX(), this->position.GetY(), rangeIt->GetX(), rangeIt->GetY()))
index 4914080..e81e3c7 100644 (file)
@@ -93,6 +93,22 @@ namespace Deeangband
                return true;
        }
 
+       void Field::UpdateSight(void)
+       {
+               int x, y;
+               this->sightPass.resize((this->width * 2 + 1) * (this->height * 2 + 1));
+               this->physicalPass.resize((this->width * 2 + 1) * (this->height * 2 + 1));
+
+               for(y = 1; y < this->height * 2 + 1; y += 2)
+               {
+                       for(x = 1; x < this->width * 2 + 1; x += 2)
+                       {
+                               this->sightPass[y * this->width + x] = (this->GetSquare(x / 2, y / 2)->GetFloorTag() == "VANILLA_PERMANENT_WALL");
+                               this->physicalPass[y * this->width + x] = (this->GetSquare(x / 2, y / 2)->GetFloorTag() == "VANILLA_PERMANENT_WALL");
+                       }
+               }
+       }
+
        bool Field::HaveSight(int bx, int by, int tx, int ty)
        {
                std::vector<Coordinates> coordVec;
index 583d397..6d5806a 100644 (file)
@@ -35,6 +35,10 @@ namespace Deeangband
                std::vector<boost::shared_ptr<Door>> doors; //!<\83h\83A\83C\83\93\83X\83^\83\93\83X\82Ì\94z\97ñ
                std::vector<boost::shared_ptr<Trap>> traps; //!<\83g\83\89\83b\83v\83C\83\93\83X\83^\83\93\83X\82Ì\94z\97ñ
                std::vector<boost::shared_ptr<Item>> items; //!<\83A\83C\83e\83\80\83C\83\93\83X\83^\83\93\83X\82Ì\94z\97ñ
+
+               std::vector<bool> sightPass; //!< \8el\8b÷\8e\8b\8ao\92Ê\89ß\83t\83\89\83O
+               std::vector<bool> physicalPass; //!< \8el\8b÷\95¨\97\9d\92Ê\89ß\83t\83\89\83O
+
                MAP_LENGTH width;  //!< \83t\83\8d\83A\82Ì\89¡\83T\83C\83Y
                MAP_LENGTH height; //!< \83t\83\8d\83A\82Ì\8fc\83T\83C\83Y
                bool generated; //!< \83t\83\8d\83A\90\90¬\8dÏ\82Ý
@@ -145,6 +149,12 @@ namespace Deeangband
                 */
                bool Field::HaveSight(int bx, int by, int tx, int ty);
 
+               /*!
+                * @brief \8e\8b\8aE\94»\92è\8aî\8f\80\82Ì\82½\82ß\82Ì\8el\8b÷\83t\83\89\83O\82ð\91S\82Ä\8dX\90V\82·\82é\81B
+                * @return \82È\82µ
+                */
+               void Field::UpdateSight(void);
+
        };
 
 }