Permalink
Browse files

Added TODO and fixed copyrights.

I found the bug with map loading, see client/client.c:142
  • Loading branch information...
1 parent c040662 commit 0788870d3617bf9920e7ea0903963aa1a1267d96 @grouzen committed Jan 23, 2012
Showing with 48 additions and 30 deletions.
  1. +8 −0 CREDITS
  2. +2 −0 Ideas → IDEAS
  3. +1 −1 src/cdata.c
  4. +10 −5 src/client/client.c
  5. +1 −1 src/client/client.h
  6. +1 −1 src/client/ui/backend.h
  7. +10 −15 src/client/ui/ncurses/backend.c
  8. +12 −4 src/server/events.c
  9. +1 −1 src/server/events.h
  10. +1 −1 src/server/server.c
  11. +1 −1 src/server/server.h
View
@@ -0,0 +1,8 @@
+* Michael Nedokushev <grouzen.hexy@gmail.com>
+ Main developer.
+
+* Alexander Batischev <eual.jp@gmail.com>
+ Ideas generator and developer.
+
+* Jods <no@email>
+ Author of patch for function ncurses.c/ui_screen_update()
View
@@ -1,3 +1,5 @@
+# -*- mode: Org; -*-
+
* We may use first two lines in map to declare destroyable and undestroyable
elements. That would help artists to create maps they want not being
constrained by some hardcoded standard.
View
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011 Michael Nedokushev <grouzen.hexy@gmail.com>
+/* Copyright (c) 2011, 2012 Michael Nedokushev <grouzen.hexy@gmail.com>
* Copyright (c) 2011, 2012 Alexander Batischev <eual.jp@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
View
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011 Michael Nedokushev <grouzen.hexy@gmail.com>
+/* Copyright (c) 2011, 2012 Michael Nedokushev <grouzen.hexy@gmail.com>
* Copyright (c) 2011, 2012 Alexander Batischev <eual.jp@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -139,16 +139,23 @@ void event_connect_ok(struct msg *m)
uint8_t *mapname = m->event.connect_ok.mapname;
if(m->event.connect_ok.ok) {
+ /* TODO: fix bug with map.
+ Now client loads the map and use it as is,
+ but map is changing during the game, thus client
+ must load the map always from server.
+ */
pthread_mutex_lock(&map_mutex);
map = map_load(mapname);
pthread_mutex_unlock(&map_mutex);
if(map == NULL) {
- WARN("Map couldn't be loaded: %s. Trying to load it from server...\n", mapname);
+ WARN("Map couldn't be loaded: %s. Trying to load it from server...\n",
+ mapname);
/* TODO: call event_map_load_ask() which calls map_load(). */
quit(1);
}
- ui_notify_line_set("Connected with id: %u, map: %s.", m->event.connect_ok.id, (char *) mapname);
+ ui_notify_line_set("Connected with id: %u, map: %s.",
+ m->event.connect_ok.id, (char *) mapname);
pthread_mutex_lock(&player_mutex);
player->id = m->event.connect_ok.id;
@@ -421,8 +428,6 @@ void *queue_mngr_func(void *arg)
pthread_mutex_lock(&msgqueue_mutex);
pthread_cond_wait(&queue_mngr_cond, &msgqueue_mutex);
- //DEBUG("queue_mngr_func() get signal.\n");
-
/* Clean map from players, bullets, bonuses and other objects. */
if(map != NULL) {
pthread_mutex_lock(&map_mutex);
View
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011 Michael Nedokushev <grouzen.hexy@gmail.com>
+/* Copyright (c) 2011, 2012 Michael Nedokushev <grouzen.hexy@gmail.com>
* Copyright (c) 2011, 2012 Alexander Batischev <eual.jp@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
View
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011 Michael Nedokushev <grouzen.hexy@gmail.com>
+/* Copyright (c) 2011, 2012 Michael Nedokushev <grouzen.hexy@gmail.com>
* Copyright (c) 2011, 2012 Alexander Batischev <eual.jp@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -179,20 +179,11 @@ static void ui_status_line_update(void)
mvwaddstr(window, 1, 2, line);
}
-// TODO: rewrite to macros
-inline static bool check_bounds(int x, int y)
-{
- return (x >= 0 && y >= 0 &&
- x < map->width && y < map->height);
-}
-
-inline static int max(int a, int b)
-{
- return a > b ? a : b;
-}
-
static void ui_screen_update(void)
{
+#define CHECK_BOUNDS(x, y) (x >= 0 && y >= 0 && x < map->width && y < map->height)
+#define MAX(a, b) (a > b ? a : b)
+
int h, w, x, y;
/* Update screen's offsets. */
@@ -212,15 +203,16 @@ static void ui_screen_update(void)
}
/* TODO: dispatch and colorize. */
- h = max((screen.height - map->height) / 2, 2);
+ h = MAX((screen.height - map->height) / 2, 2);
for(y = screen.offset_y; h < screen.height; h++, y++) {
- w = max((screen.width - map->width) / 2, 1);
+ w = MAX((screen.width - map->width) / 2, 1);
for(x = screen.offset_x; w < screen.width + 1; w++, x++) {
- uint8_t o = check_bounds(x, y) ? map->objs[y][x] : MAP_EMPTY;
+ uint8_t o = CHECK_BOUNDS(x, y) ? map->objs[y][x] : MAP_EMPTY;
chtype type;
switch(o) {
case MAP_PLAYER:
+ // TODO: fix the bug. Player's type often changes from UI_MAP_PLAYER to UI_MAP_ENEMY and vice versa.
if(player->pos_y == 1 + y && player->pos_x == 1 + x)
type = UI_MAP_PLAYER;
else
@@ -240,6 +232,9 @@ static void ui_screen_update(void)
mvwaddch(window, h, w, type);
}
}
+
+#undef CHECK_BOUNDS
+#undef MAX
pthread_mutex_unlock(&map_mutex);
pthread_mutex_unlock(&player_mutex);
View
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011 Michael Nedokushev <grouzen.hexy@gmail.com>
+/* Copyright (c) 2011, 2012 Michael Nedokushev <grouzen.hexy@gmail.com>
* Copyright (c) 2011, 2012 Alexander Batischev <eual.jp@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -164,7 +164,8 @@ void event_disconnect_notify(uint8_t *nick)
struct players_slot *slot = players->root;
msg.type = MSGTYPE_DISCONNECT_NOTIFY;
- strncpy((char *) msg.event.disconnect_notify.nick, (char *) nick, NICK_MAX_LEN);
+ strncpy((char *) msg.event.disconnect_notify.nick,
+ (char *) nick, NICK_MAX_LEN);
slot = players->root;
while(slot != NULL) {
@@ -183,7 +184,8 @@ void event_connect_notify(struct player *p)
struct players_slot *slot = players->root;
msg.type = MSGTYPE_CONNECT_NOTIFY;
- strncpy((char *) msg.event.connect_notify.nick, (char *) p->nick, NICK_MAX_LEN);
+ strncpy((char *) msg.event.connect_notify.nick,
+ (char *) p->nick, NICK_MAX_LEN);
while(slot != NULL) {
struct player *lp = slot->p;
@@ -203,10 +205,16 @@ void event_connect_ok(struct player *p, uint8_t ok)
p->seq++;
+
+ /* TODO: change this event.
+ Map name is not neccesary any more, because map
+ must be loaded from server each time.
+ */
msg.type = MSGTYPE_CONNECT_OK;
msg.event.connect_ok.id = p->id;
msg.event.connect_ok.ok = ok;
- strncpy((char *) msg.event.connect_ok.mapname, (char *) map->name, MAP_NAME_MAX_LEN);
+ strncpy((char *) msg.event.connect_ok.mapname,
+ (char *) map->name, MAP_NAME_MAX_LEN);
msg_batch_push(&(p->msgbatch), &msg);
}
View
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011 Michael Nedokushev <grouzen.hexy@gmail.com>
+/* Copyright (c) 2011, 2012 Michael Nedokushev <grouzen.hexy@gmail.com>
* Copyright (c) 2011, 2012 Alexander Batischev <eual.jp@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
View
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011 Michael Nedokushev <grouzen.hexy@gmail.com>
+/* Copyright (c) 2011, 2012 Michael Nedokushev <grouzen.hexy@gmail.com>
* Copyright (c) 2011, 2012 Alexander Batischev <eual.jp@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
View
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011 Michael Nedokushev <grouzen.hexy@gmail.com>
+/* Copyright (c) 2011, 2012 Michael Nedokushev <grouzen.hexy@gmail.com>
* Copyright (c) 2011, 2012 Alexander Batischev <eual.jp@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy

0 comments on commit 0788870

Please sign in to comment.