home
·
contact
·
privacy
projects
/
plomrogue2-experiments
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Automatically log in if login name already provided previously.
[plomrogue2-experiments]
/
new
/
plomrogue
/
mapping.py
diff --git
a/new/plomrogue/mapping.py
b/new/plomrogue/mapping.py
index 4c7658de4af83168481d24f3d16edd23a67f1813..b670938e64658e2ff34306483bdb6cb7adf12d77 100644
(file)
--- a/
new/plomrogue/mapping.py
+++ b/
new/plomrogue/mapping.py
@@
-20,7
+20,7
@@
class Map:
def __init__(self, size=YX(0, 0), init_char = '?', start_indented=True):
self.size = size
def __init__(self, size=YX(0, 0), init_char = '?', start_indented=True):
self.size = size
- self.terrain = init_char
*
self.size_i
+ self.terrain = init_char
*
self.size_i
self.start_indented = start_indented
def __getitem__(self, yx):
self.start_indented = start_indented
def __getitem__(self, yx):
@@
-64,6
+64,12
@@
class Map:
+class MapChunk(Map):
+ awake = 0 # asleep if zero
+ stats = {}
+
+
+
class MapGeometry():
def get_directions(self):
class MapGeometry():
def get_directions(self):
@@
-101,17
+107,20
@@
class MapGeometry():
def pos_in_view(self, pos, offset, maps_size):
return self.undouble_coordinate(maps_size, pos) - offset
def pos_in_view(self, pos, offset, maps_size):
return self.undouble_coordinate(maps_size, pos) - offset
- def get_view(self, maps_size, get_map, radius, view_offset):
+ def get_view
_and_seen_maps
(self, maps_size, get_map, radius, view_offset):
m = Map(size=YX(radius*2+1, radius*2+1),
start_indented=(view_offset.y % 2 == 0))
m = Map(size=YX(radius*2+1, radius*2+1),
start_indented=(view_offset.y % 2 == 0))
+ seen_maps = []
for pos in m:
seen_pos = self.correct_double_coordinate(maps_size, (0,0),
pos + view_offset)
for pos in m:
seen_pos = self.correct_double_coordinate(maps_size, (0,0),
pos + view_offset)
- seen_map = get_map(seen_pos[0], False)
+ if seen_pos[0] not in seen_maps:
+ seen_maps += [seen_pos[0]]
+ seen_map = get_map(seen_pos[0])
if seen_map is None:
seen_map = Map(size=maps_size)
m[pos] = seen_map[seen_pos[1]]
if seen_map is None:
seen_map = Map(size=maps_size)
m[pos] = seen_map[seen_pos[1]]
- return m
+ return m
, seen_maps
def correct_double_coordinate(self, map_size, big_yx, little_yx):
def correct_double_coordinate(self, map_size, big_yx, little_yx):