Skip to content

Commit

Permalink
#235 Created VertRightsRightBase and VertLeftsLeftBase helper traits.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich2 committed Apr 11, 2023
1 parent 93c9f30 commit 7e4339a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
6 changes: 3 additions & 3 deletions EGrid/src/eg320/Terr320E30.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object Terr320E30 extends Long320Terrs
TRow(134, Hland(1, 4, Hilly()), hills, hills, sea * 3, mtain),
VRow(133, Mouth(1530, HVUp)),
TRow(132, Hland(2, 1, Hilly()), hills, Hland(1, 4, Hilly()), hills * 4),
VRow(131, Mouth(1528, HVDR)),
VRow(131, VertRightsRight(1522), Mouth(1528, HVDR)),
TRow(130, Hland(4, 2, Hilly()), Hland(4, 3, Hilly()), Hland(3, 1, Hilly()), Hland(2, 3, Hilly()), hills * 4),
VRow(129, Mouth(1536, HVUR)),
TRow(128, sea * 2, Isle(Hilly()), sea, Isle(Hilly()), hills, desert * 2),
Expand All @@ -48,6 +48,6 @@ object Terr320E30 extends Long320Terrs
}
help.run

corners.setCorner(132, 1524, 4, HVRt)
corners.setCorner(130, 1522, 0, HVRt)
//corners.setCorner(132, 1524, 4, HVRt)
//corners.setCorner(130, 1522, 0, HVRt)
}
1 change: 1 addition & 0 deletions EGrid/src/egrid/WTerrSetter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ abstract class WTerrSetter(gridIn: HGrid, val terrs: HCenLayer[WTile], val sTerr
case class SetSide(c: Int, terr: WSideSome = Sea) extends VRowElem with SetSideBase
case class Mouth(c: Int, dirn: HVDirn, st: WSideSome = Sea) extends VRowElem with MouthBase
case class VertIn(c: Int, dirn: HVDirn, terr: WSideSome = Sea) extends VRowElem with VertInBase
case class VertRightsRight(c: Int, terr: WSideSome = Sea, magnitude: Int = 3) extends VRowElem with VertRightsRightBase
}
36 changes: 36 additions & 0 deletions Tiling/srcHex/HSetter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,40 @@ trait HSetter[TT <: AnyRef, ST, SST <: ST with HSideSome]
def terr: SST
def run(row: Int): Unit = sTerrs.set(row, c, terr)
}

/** Used for setting the a vertex on the left edge of a grid. Sets the vetex to the right on both hex tiles. */
trait VertRightsRightBase
{ /** The c coordinate of the vertex. */
def c: Int

/** The magnitude of the offset. */
def magnitude: Int

def run(row: Int): Unit = if (HVert.rcISHigh(row, c)){
corners.setCorner(row + 1, c + 2, 4, HVRt, magnitude)
corners.setCorner(row - 1, c, 0, HVRt, magnitude)
}
else{
corners.setCorner(row + 1, c, 3, HVRt, magnitude)
corners.setCorner(row - 1, c + 2, 5, HVRt, magnitude)
}
}

/** Used for setting the a vertex on the right edge of a grid. Sets the vertex to the left on both hex tiles. */
trait VertLeftsLeftBase
{ /** The c coordinate of the vertex. */
def c: Int

/** The magnitude of the offset. */
def magnitude: Int

def run(row: Int): Unit = if (HVert.rcISHigh(row, c))
{ corners.setCorner(row + 1, c - 2, 2, HVLt, magnitude)
corners.setCorner(row - 1, c, 0, HVLt, magnitude)
}
else
{ corners.setCorner(row + 1, c, 3, HVLt, magnitude)
corners.setCorner(row - 1, c - 2, 1, HVLt, magnitude)
}
}
}

0 comments on commit 7e4339a

Please sign in to comment.