summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2012-03-01 09:11:20 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2012-03-01 09:11:20 +0100
commit320d3750c508752337e95d9d2ff67f31d7675023 (patch)
tree72e01b6aad01757b0ad4e64d80a063be34d460e9 /src
parent8d35024bf4d2298c22298493f9a8398f83366ccc (diff)
Update Tasks directly in the tasklist, not just local copies.
Diffstat (limited to 'src')
-rw-r--r--src/task_proto.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/task_proto.cc b/src/task_proto.cc
index 39232dd..10cfe35 100644
--- a/src/task_proto.cc
+++ b/src/task_proto.cc
@@ -98,7 +98,7 @@ int callback_lws_task(struct libwebsocket_context * context,
std::string init_str;
TaskList::iterator it;
for(it = tasklist.begin(); it != tasklist.end(); it++) {
- task_t t = *it;
+ task_t &t = *it;
sprintf(buf, "add %d %s %s %d %d;",
t.id, t.title.c_str(), t.desc.c_str(), t.x, t.y);
@@ -180,8 +180,8 @@ int callback_lws_task(struct libwebsocket_context * context,
case cmd::add: {
printf("Handling add cmd:\n");
- task_t t =create_task(m.add.title, m.add.desc,
- m.add.x, m.add.y);
+ task_t t = create_task(m.add.title, m.add.desc,
+ m.add.x, m.add.y);
tasklist.push_back(t);
buf_len = sprintf(buf, "add %d %s %s %d %d;",
t.id, t.title.c_str(), t.desc.c_str(),
@@ -197,7 +197,7 @@ int callback_lws_task(struct libwebsocket_context * context,
bool id_found = false;
TaskList::iterator it;
for(it = tasklist.begin(); it != tasklist.end(); it++) {
- task_t t = *it;
+ task_t &t = *it;
if(t.id == m.del.id) {
id_found = true;
tasklist.erase(it);
@@ -224,7 +224,7 @@ int callback_lws_task(struct libwebsocket_context * context,
int x = m.move.x / 300 * 300;
for(it = tasklist.begin(); it != tasklist.end(); it++) {
- task_t t = *it;
+ task_t &t = *it;
if(t.id == m.move.id) {
id_found = true;
t.x = x;