OSDN Git Service

Field::UpdateSight() を実装。 / Implement Field::UpdateSight().
authorDeskull <desull@users.sourceforge.jp>
Thu, 8 Jan 2015 13:15:44 +0000 (22:15 +0900)
committerDeskull <desull@users.sourceforge.jp>
Thu, 8 Jan 2015 13:15:44 +0000 (22:15 +0900)
Deeangband/Field.cpp

index aadada5..1a2f70f 100644 (file)
@@ -103,8 +103,8 @@ namespace Deeangband
                {
                        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");
+                               this->sightPass[y * this->width + x] = !this->GetSquare(x / 2, y / 2)->IsWall();
+                               this->physicalPass[y * this->width + x] = !this->GetSquare(x / 2, y / 2)->IsWall();
                        }
                }
 
@@ -112,10 +112,12 @@ namespace Deeangband
                {
                        for(x = 0; x < this->width * 2 + 1; x += 2)
                        {
-                               if(this->GetSquare(x / 2 - 1, y / 2 - 1) && this->GetSquare(x / 2 - 1, y / 2 - 1)->GetFloorTag() == "VANILLA_PERMANENT_WALL" ||
-                                       this->GetSquare(x / 2 - 1, y / 2 - 1) && this->GetSquare(x / 2 - 1, y / 2 - 1)->GetFloorTag() == "VANILLA_PERMANENT_WALL" ||
-                                       this->GetSquare(x / 2 - 1, y / 2 - 1) && this->GetSquare(x / 2 - 1, y / 2 - 1)->GetFloorTag() == "VANILLA_PERMANENT_WALL" ||
-                                       this->GetSquare(x / 2 - 1, y / 2 - 1) && this->GetSquare(x / 2 - 1, y / 2 - 1)->GetFloorTag() == "VANILLA_PERMANENT_WALL")
+                               if(!this->GetSquare(x / 2 - 1, y / 2 - 1) || !this->GetSquare(x / 2 - 1, y / 2) || !this->GetSquare(x / 2, y / 2 - 1) || !this->GetSquare(x / 2, y / 2))
+                               {
+                                       this->sightPass[y * this->width + x] = false;
+                                       this->physicalPass[y * this->width + x] = false;
+                               }
+                               else if(this->GetSquare(x / 2 - 1, y / 2 - 1)->IsWall() || this->GetSquare(x / 2, y / 2 - 1)->IsWall() || this->GetSquare(x / 2 - 1, y / 2)->IsWall() || this->GetSquare(x / 2, y / 2 )->IsWall())
                                {
                                        this->sightPass[y * this->width + x] = false;
                                        this->physicalPass[y * this->width + x] = false;
@@ -128,6 +130,49 @@ namespace Deeangband
                        }
                }
 
+               for(y = 0; y < this->height * 2 + 1; y += 2)
+               {
+                       for(x = 1; x < this->width * 2 + 1; x += 2)
+                       {
+                               if(!this->GetSquare(x / 2, y / 2 - 1) || !this->GetSquare(x / 2, y / 2))
+                               {
+                                       this->sightPass[y * this->width + x] = false;
+                                       this->physicalPass[y * this->width + x] = false;
+                               }
+                               else if(this->GetSquare(x / 2, y / 2 - 1)->IsWall() || this->GetSquare(x / 2, y / 2)->IsWall())
+                               {
+                                       this->sightPass[y * this->width + x] = false;
+                                       this->physicalPass[y * this->width + x] = false;
+                               }
+                               else
+                               {
+                                       this->sightPass[y * this->width + x] = true;
+                                       this->physicalPass[y * this->width + x] = true;
+                               }
+                       }
+               }
+
+               for(y = 1; y < this->height * 2 + 1; y += 2)
+               {
+                       for(x = 0; x < this->width * 2 + 1; x += 2)
+                       {
+                               if(!this->GetSquare(x / 2 - 1, y / 2) || !this->GetSquare(x / 2, y / 2))
+                               {
+                                       this->sightPass[y * this->width + x] = false;
+                                       this->physicalPass[y * this->width + x] = false;
+                               }
+                               else if(this->GetSquare(x / 2 - 1, y / 2)->IsWall() || this->GetSquare(x / 2, y / 2)->IsWall())
+                               {
+                                       this->sightPass[y * this->width + x] = false;
+                                       this->physicalPass[y * this->width + x] = false;
+                               }
+                               else
+                               {
+                                       this->sightPass[y * this->width + x] = true;
+                                       this->physicalPass[y * this->width + x] = true;
+                               }
+                       }
+               }
 
        }