Skip to content

Commit

Permalink
Removes 'flat' from config and move to globals.
Browse files Browse the repository at this point in the history
  • Loading branch information
BertrandBordage committed Apr 12, 2013
1 parent 8699a6e commit 6adee76
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 2 additions & 0 deletions globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
GAME_MODE_CHOICES = (SURVIVAL_MODE, CREATIVE_MODE)
GAME_MODE = CREATIVE_MODE

FLAT_MODE = False


#
# User input
Expand Down
7 changes: 3 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ def initialize_config():

world = 'World'

get_or_update_config(world, 'flat', False, conv=bool) # dont make mountains, make a flat world
get_or_update_config(world, 'size', 64, conv=int)
globals.SHOW_FOG = get_or_update_config(world, 'show_fog', True, conv=bool)
globals.SHOW_FOG = get_or_update_config(
world, 'show_fog', globals.SHOW_FOG, conv=bool)

# Adds missing keys to configuration file and converts to pyglet keys.
for control, default_key_name in globals.KEY_BINDINGS.items():
Expand Down Expand Up @@ -157,8 +157,7 @@ def main(options):
globals.TERRAIN_CHOICE = options.terrain
globals.TERRAIN = globals.TERRAIN_CHOICES[options.terrain]

if options.flat:
get_or_update_config('World', 'flat', 'true')
globals.FLAT_MODE = options.flat

if options.fast:
globals.TIME_RATE /= 20
Expand Down
3 changes: 1 addition & 2 deletions model.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def initialize(self):
world_size = globals.config.getint('World', 'size')
world_type = globals.TERRAIN_CHOICE # FIXME: Unify names!
hill_height = globals.TERRAIN['hill_height']
flat_world = globals.config.getboolean('World', 'flat')
self.max_trees = globals.TERRAIN['max_trees']
tree_chance = self.max_trees / float(world_size *
(globals.SECTOR_SIZE ** 3))
Expand Down Expand Up @@ -97,7 +96,7 @@ def initialize(self):
tree_class = random.choice(tree_class)
self.generate_tree((x, y - 2, z), tree_class)

if flat_world:
if globals.FLAT_MODE:
return

o = n - 10 + hill_height - 6
Expand Down

0 comments on commit 6adee76

Please sign in to comment.