Commit 54bd72b5 authored by Oskar Skog's avatar Oskar Skog

issue/27

parent cb1b443e
......@@ -5,6 +5,7 @@
- Don't remove highscores file on uninstall. Added a new target
"nuke" instead
- Added pypy and python symlinks uninstall without version number.
* anonymine.py: issue/27: No need for the issue/14 fix.
2019-07-07 Oskar Skog <https://oskog97.com/#contact>
0.5.9
......
......@@ -77,9 +77,6 @@ Copyright (c) Oskar Skog, 2016-2019
Released under the Simplified BSD license (2 clause).
\n"""
# TODO: Don't forget to delete this
bug27 = 'auto' # 'auto', 'on' or 'off'
class curses_game():
'''Class for interface object for `engine.play_game(interface)`.
......@@ -233,37 +230,6 @@ class curses_game():
textics properties.
'''
# https://gitlab.com/oskog97/anonymine/issues/14
# Detected on:
# OS: Debian 8 (Linux 3.16) (x86-64)
# curses.version: 2.2
# Library: ncurses5.9
# Description:
# After forking, it appears, when the field is being initialized, the
# curses mode stops working.
# Solution:
# Define a program mode and temporarily reset to shell mode while
# initializing the field.
# The cursor can still not be hidden, so it will be moved to an
# unimportant place.
# The screen requires one complete redrawal of the screen, so that
# will also be done.
# NOTICE:
# DO NOT REMOVE.
# This is referenced from the source.
# Update 2016-07-17:
# The windows only needs to be redrawn on initialization, not on every
# click.
# Trying to leave and re-enter curses mode was no good.
# Update 2016-12-10 (pre 0.4.2):
# No need to temporarily reset to shell mode every time a cell is
# revealed. The issue was that game_status changed. Fixed in 0.3.11
# Update 2019-03-09 (0.5.6):
# The workaround breaks the game on Windows. Detect platform and disable.
# Update 2019-07-07 (0.5.9):
# Debian is no longer affected by this issue. Created new issue #27 in
# Gitlab.
def __init__(self, cfgfile, gametype):
'''Create interface object and enter curses mode.
......@@ -273,14 +239,6 @@ class curses_game():
WARNING: This does not leave curses mode on exceptions!
'''
# TODO: Don't forget about bug #27
if bug27 == 'auto':
self.curses_voodoo = not sys.platform.startswith('win')
elif bug27 == 'on':
self.curses_voodoo = True
elif bug27 == 'off':
self.curses_voodoo = False
# Constants
self.travel_diffs = {
'square': {
......@@ -335,7 +293,6 @@ class curses_game():
self.old_cursor = curses.curs_set(0)
except:
pass
curses.def_prog_mode() # BUG: see comments above __init__
# Check that we have a reasonable size on the window.
height, width = self.window.getmaxyx()
......@@ -521,7 +478,7 @@ class curses_game():
else:
self.print_square(engine.field)
# Remember that self.height has already been decremented by one.
self.window.move(self.height, 0) # BUG: see comments above __init__
self.window.move(self.height, 0) # TODO: Check issue/14 and issue/27
self.window.refresh()
def input(self, engine):
......@@ -570,12 +527,8 @@ class curses_game():
pre_game = engine.game_status == 'pre-game'
if pre_game:
self.message('Initializing field... This may take a while.')
if self.curses_voodoo:
curses.reset_shell_mode() #BUG: see comments above __init__
engine.reveal(self.cursor)
if pre_game:
if self.curses_voodoo:
curses.reset_prog_mode() #BUG: see comments above __init__
# Clear junk that gets on the screen from impatient players.
self.window.redrawwin()
elif command in direction_keys:
......@@ -1270,30 +1223,12 @@ without guessing and supports three different game types:
]
)
)
# TODO: Don't forget to delete this
bug27_opt = parser.add_mutually_exclusive_group()
bug27_opt.add_argument(
'--bug27-on', action='store_const', dest='bug27', const='on',
help='Testing something, check out Gitlab for more info:'
)
bug27_opt.add_argument(
'--bug27-off', action='store_const', dest='bug27', const='off',
help='https://gitlab.com/oskog97/anonymine/issues/27'
)
#
# Parse the args and store the params.
args = parser.parse_args()
params = {}
user_input_required = True
error = False
# TODO: Don't forget to delete this
if args.bug27:
global bug27
bug27 = args.bug27
# Size, mines and gametype.
if args.size:
user_input_required = False
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment