[sorrows-mudlib] r206 committed - - roguelike.py: Fix double user removal from world bug....

0 views
Skip to first unread message

sorrows...@googlecode.com

unread,
May 12, 2011, 8:56:59 AM5/12/11
to sorrows-mud...@googlegroups.com
Revision: 206
Author: richard.m.tew
Date: Thu May 12 05:56:07 2011
Log: - roguelike.py: Fix double user removal from world bug.
- world.py: Fix spawning of monsters / wildlife.
http://code.google.com/p/sorrows-mudlib/source/detail?r=206

Modified:
/trunk/games/roguelike/services/world.py
/trunk/games/roguelike/shells/roguelike.py

=======================================
--- /trunk/games/roguelike/services/world.py Fri Jan 7 05:23:18 2011
+++ /trunk/games/roguelike/services/world.py Thu May 12 05:56:07 2011
@@ -358,13 +358,13 @@
# the dungeon freely. Two second tick for movement.

def ManageFloraAndFauna(self):
- stackless.tasklet(self.RunNPC, CUBE_TILE, COLOUR_YELLOW)()
+ stackless.tasklet(self.RunNPC)(CUBE_TILE, COLOUR_YELLOW)
tasklet_sleep(10.0)
- stackless.tasklet(self.RunNPC, DRAGON_TILE, COLOUR_GREEN)()
+ stackless.tasklet(self.RunNPC)(DRAGON_TILE, COLOUR_GREEN)
tasklet_sleep(10.0)
- stackless.tasklet(self.RunNPC, DRAGON_TILE, COLOUR_GREEN)()
+ stackless.tasklet(self.RunNPC)(DRAGON_TILE, COLOUR_GREEN)
tasklet_sleep(10.0)
- stackless.tasklet(self.RunNPC, DRAGON_TILE, COLOUR_GREEN)()
+ stackless.tasklet(self.RunNPC)(DRAGON_TILE, COLOUR_GREEN)


def RunNPC(self, tile, fgColour, bgColour=None):
=======================================
--- /trunk/games/roguelike/shells/roguelike.py Thu May 12 05:09:54 2011
+++ /trunk/games/roguelike/shells/roguelike.py Thu May 12 05:56:07 2011
@@ -3,6 +3,15 @@
# - NPC logic. This is very simple now, but taking this further would be
# something to think about.
#
+# - Connection level changes:
+# - Ability to set a per-packet delay before sending to user.
+# - Ability to set a per-character delay before sending to user.
+#
+# - Windows Telnet:
+# - Why are escape characters not working.
+# - What characters should be displayed when unicode characters cannot
+# be encoded as CP437.
+# ** Putty is currently the preferrred and working client.

## LUXURY TASKS
#
@@ -76,9 +85,9 @@

# Escape codes.

-ESC_UTF8_CHARSET = "\x1b%G"
-ESC_DEFAULT_CHARSET = "\x1b%@"
-ESC_SCO_CHARSET = "\x1b(U"
+ESC_UTF8_CHARSET = "\x1b%G"
+ESC_DEFAULT_CHARSET = "\x1b%@"
+ESC_SCO_CHARSET = "\x1b(U"


CHAR_TILE = "@"
@@ -87,7 +96,7 @@
WALL_TILE2 = "2"
FLOOR_TILE = " "
DOOR_TILE = "D"
-CUBE_TILE = "C"
+CUBE_TILE = "C"

charMap = {
"unicode" : {
@@ -109,6 +118,8 @@
"light-up-and-left": u"\u2518",
"full-block": u"\u2588",
"medium-shade": u"\u2592",
+ "black-square": u"\u25A0",
+ "white-square": u"\u25A1",
}
}

@@ -118,10 +129,11 @@
if not encodingCharMap:
encodingCharMap = {}
for key_, value_ in charMap["unicode"].iteritems():
- encodingCharMap[key_] = value_.encode(encoding)
+ encodingCharMap[key_] = value_.encode(encoding, "ignore")
charMap[encoding] = encodingCharMap
- return encodingCharMap[key]
-
+ if key in encodingCharMap:
+ return encodingCharMap[key]
+ return key

TILE_SEEN = 1
TILE_OPEN = 2
@@ -223,8 +235,6 @@
# Events
------------------------------------------------------------------

def OnRemovalFromStack(self):
- sorrows.world.RemoveUser(self.user)
-
self.user.connection.optionLineMode = self.oldOptionLineMode
self.user.connection.telneg.will_echo()
self.user.Write(ESC_RESET_TERMINAL)

Reply all
Reply to author
Forward
0 new messages