Permalink
Browse files

Mehr Cleanup

git-svn-id: http://infon.googlecode.com/svn/trunk@163 8171fb75-e542-0410-96e4-03d5dd800671
  • Loading branch information...
1 parent e2c93bf commit 6b1938c9dbdab48319e4b0c6366857979304e2d8 @dividuum committed Dec 29, 2006
Showing with 17 additions and 16 deletions.
  1. +3 −0 client_creature.c
  2. +0 −12 infon.c
  3. +1 −3 infond.lua
  4. +1 −1 player-default.lua
  5. +12 −0 sdl_gui.c
View
@@ -96,6 +96,9 @@ static void client_creature_kill(client_creature_t *creature) {
}
void client_creature_move(int delta) {
+ if (delta == 0)
+ return;
+
client_creature_t *creature = &creatures[0];
for (int i = 0; i < MAXCREATURES; i++, creature++) {
View
12 infon.c
@@ -108,18 +108,6 @@ int main(int argc, char *argv[]) {
if (nowticks < lastticks || nowticks > lastticks + 1000) {
// Timewarp?
lastticks = nowticks;
-#ifdef WIN32
- Sleep(2);
-#else
- usleep(5000);
-#endif
- continue;
- } else if (delta < 20) {
-#ifdef WIN32
- Sleep(2);
-#else
- usleep(5000);
-#endif
continue;
}
lastticks = nowticks;
View
@@ -695,9 +695,7 @@ function start_bot(botcode, logfile, name, highlevelcode)
name = select(3, botcode:find("([^/\\]+)\.lua"))
end
local playerno = player_create(name or botcode, password, highlevelcode)
- if not playerno then
- error("cannot create new player")
- end
+ assert(playerno, "cannot create new player")
cprint(string.format("player %d - %s (%s) joined with password '%s'", playerno, name or botcode, botcode, password))
player_set_no_client_kick_time(playerno, 0)
if logfile then
View
@@ -28,7 +28,7 @@ function Creature:onRestart()
end
--- Called after beeing killed. Since the creature is already
+-- Called after being killed. Since the creature is already
-- dead, self.id cannot be used to call the Lowlevel API.
function Creature:onKilled(killer)
if killer == self.id then
View
@@ -129,6 +129,11 @@ static void handle_events() {
center_x -= event.motion.xrel;
center_y -= event.motion.yrel;
}
+ if (send_events && event.motion.state) {
+ int x = (event.motion.x - offset_x) * TILE_WIDTH / SPRITE_TILE_SIZE;
+ int y = (event.motion.y - offset_y) * TILE_HEIGHT / SPRITE_TILE_SIZE;
+ infon->printf("D%d,%d,%d\n", event.motion.state, x, y);
+ }
break;
case SDL_VIDEORESIZE:
video_resize(event.resize.w, event.resize.h);
@@ -563,6 +568,13 @@ static void sdl_tick(int gt, int delta) {
video_flip();
frames++;
+
+#ifdef WIN32
+ Sleep(20);
+#else
+ usleep(4000);
+#endif
+
}
static int sdl_open(int w, int h, int fs) {

0 comments on commit 6b1938c

Please sign in to comment.