Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 4
- c
- 1337 150 300 10
- 1488 -1
- b
- 1488 200 700 0
- 1337 322 0 -1
- b
- 322 300 500 10
- 1488 0 -1 633
- c
- 633 300 150 30
- 322 -1
- stop
- for (i = 0; i < num; i++) {
- char el_type[6];
- printf("type:");
- fscanf(fp, "%s", el_type);
- if (0 == strcmp(el_type, "stop"))
- break;
- node *curr_node;
- int pos_x, pos_y, mass;
- int body_name, conn_left_name, conn_right_name, conn_top_name, conn_bot_name;
- if (0 == strcmp(el_type, "block") || 0 == strcmp(el_type, "b")) {
- printf("name pos_x pos_y mass:");
- fscanf(fp, "%d%d%d%d", &body_name, &pos_x, &pos_y, &mass);
- printf("connection: L R T B:");
- fscanf(fp, "%d%d%d%d", &conn_left_name, &conn_right_name, &conn_top_name, &conn_bot_name);
- list->append_back(body_name);
- curr_node = list->get_by_id(body_name);
- curr_node->set_list_param('b', body_name, i, pos_x, pos_y, mass);
- printf("block:%d[x:%d y:%d m:%d CL:%d CR:%d CT:%d CB:%d] has been added.\n\n", body_name, pos_x, pos_y, mass, conn_left_name, conn_right_name, conn_top_name, conn_bot_name);
- }
- if (0 == strcmp(el_type, "cargo") || 0 == strcmp(el_type, "c")) {
- printf("name pos_x pos_y mass:");
- fscanf(fp, "%d%d%d%d", &body_name, &pos_x, &pos_y, &mass);
- printf("connection: T B:");
- fscanf(fp, "%d%d", &conn_top_name, &conn_bot_name);
- list->append_back(body_name);
- curr_node = list->get_by_id(body_name);
- curr_node->set_list_param('c', body_name, i, pos_x, pos_y, mass);
- printf("cargo:%d[x:%d y:%d m:%d CT:%d CB:%d] has beed added.\n\n", body_name, pos_x, pos_y, mass, conn_top_name, conn_bot_name);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement