- wetness = 0
- for i in range(world_db["MAP_LENGTH"] ** 2):
- if world_db["MAP"][i] != ord("~") and world_db["wetmap"][i] > 48 \
- and 0 == (rand.next() % 5):
- world_db["wetmap"][i] -= 1
- wetness += 1
- if wetness > 0:
- positions_to_wet = []
- for i in range(world_db["MAP_LENGTH"] ** 2):
- if chr(world_db["MAP"][i]) in "_~":
- positions_to_wet += [i]
- while wetness > 0:
+ water = 0
+ positions_to_wet = []
+ for pos in range(world_db["MAP_LENGTH"] ** 2):
+ if world_db["MAP"][pos] == ord("0") \
+ and world_db["wetmap"][pos] < ord("5"):
+ positions_to_wet += [pos]
+ i_positions_to_wet = len(positions_to_wet)
+ for pos in range(world_db["MAP_LENGTH"] ** 2):
+ wetness = world_db["wetmap"][pos] - ord("0")
+ height = world_db["MAP"][pos] - ord("0")
+ if height == 0 and wetness > 0 \
+ and 0 == rand.next() % ((2 ** 16) / (2 ** wetness)):
+ world_db["MAP"][pos] = ord("-")
+ if pos in positions_to_wet:
+ positions_to_wet.remove(pos)
+ i_positions_to_wet -= 1
+ if ((wetness > 0 and height != 0) or wetness > 1) \
+ and 0 == rand.next() % 5:
+ world_db["wetmap"][pos] -= 1
+ water += 1
+ i_positions_to_wet -= 1
+ if i_positions_to_wet == 0:
+ break
+ if water > 0:
+ while water > 0: