예제 #1
0
파일: map.py 프로젝트: D-Vaillant/murderrl
def build_manor (type):
    m = manor.ManorCollection(builder.builder_by_type(type))
    # Add doors and windows, etc.
    m.add_features()

    # Add bed rooms for a number of suspects.
    sl = person.SuspectList(10)
    list = sl.get_id_name_tuples()
    m.init_room_names(list)

    return m
예제 #2
0
    def __init__ (self, type = None):
        """
        Initialise the manor, viewport and other objects and parameters.

        :``type``: The manor layout type. One of B (base), L, U, H, R (random).
                   *Default random*.
        """
        # First, build the manor.
        self.base_manor = manor.ManorCollection(builder.builder_by_type(type, min_rooms=NUM_SUSPECTS + 2))

        # Add doors and windows, etc.
        self.base_manor.add_features()

        self.add_suspects()

        self.add_alibis()
        self.init_suspect_positions()
        self.suspect_list.add_hair_colours()
        self.add_victim_body()

        # Combine the room shapes into a canvas.
        self.canvas = self.base_manor.combine()

        # Draw features on canvas.
        for pos in coord.RectangleIterator(self.canvas.size()):
            feat = self.base_manor.get_feature(pos)
            if feat != NOTHING and feat != WALL and feat != FLOOR:
                self.canvas.__setitem__(pos, feat.glyph())

        # Initialise the view port.
        self.vp = viewport.ViewPort(buffer=self.canvas,
                                    width =min(self.canvas.size().width, MAX_COLUMNS),
                                    height=min(self.canvas.size().height, MAX_ROWS))

        # Initialise a couple of other variables.
        self.initialise_parameters()
예제 #3
0
#!/usr/bin/env python
"""
unit test for manor building.
"""

from builder import builder

if __name__=="__main__":

    import sys
    type = None
    if len(sys.argv) > 1:
        type = sys.argv[1].upper()

    m = builder.builder_by_type(type)

    print m.combine()