From 320d3750c508752337e95d9d2ff67f31d7675023 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 1 Mar 2012 09:11:20 +0100 Subject: Update Tasks directly in the tasklist, not just local copies. --- src/task_proto.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') 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; -- cgit v1.2.3