Commit 48238969 authored by ewen.madec's avatar ewen.madec

colored edges + executable => risk

parent cb3f9a52
...@@ -18,11 +18,11 @@ include_directories(${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/src) ...@@ -18,11 +18,11 @@ include_directories(${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/src)
include_directories( ${PROJECT_SOURCE_DIR}/dpd/include ) include_directories( ${PROJECT_SOURCE_DIR}/dpd/include )
link_directories( ${PROJECT_SOURCE_DIR}/dpd ) link_directories( ${PROJECT_SOURCE_DIR}/dpd )
add_executable(nw-viewer src/main-viewer.c src/networld.c src/controlpanel.c src/entity.c src/player.c src/random-map.c src/graphical-aspect.c src/window-manager.c src/menu-button.c src/main-menu.c) add_executable(risk src/main-viewer.c src/networld.c src/controlpanel.c src/entity.c src/player.c src/random-map.c src/graphical-aspect.c src/window-manager.c src/menu-button.c src/main-menu.c)
target_link_libraries(nw-viewer raylib pthread dl rt X11 m) target_link_libraries(risk raylib pthread dl rt X11 m)
#without cmake package... #without cmake package...
#include_directories(${PROJECT_SOURCE_DIR}/raylib/src) #include_directories(${PROJECT_SOURCE_DIR}/raylib/src)
#link_directories(${PROJECT_SOURCE_DIR}/raylib) #link_directories(${PROJECT_SOURCE_DIR}/raylib)
#target_link_libraries(nw-viewer raylib GL m pthread dl rt X11) #target_link_libraries(risk raylib GL m pthread dl rt X11)
...@@ -46,6 +46,9 @@ void Player_add_Node( Player * self, Node * node ) ...@@ -46,6 +46,9 @@ void Player_add_Node( Player * self, Node * node )
newNodes[i] = self->nodes[i]; newNodes[i] = self->nodes[i];
} }
node->color = self->color; node->color = self->color;
for (int i = 0 ; i < node->card ; i++){
node->edges[i].color = self->color;
}
node->playerID = self->ID; node->playerID = self->ID;
newNodes[self->nodeCount] = node; newNodes[self->nodeCount] = node;
free(self->nodes); free(self->nodes);
......
...@@ -47,7 +47,7 @@ void Random_map(NetWorld *world) ...@@ -47,7 +47,7 @@ void Random_map(NetWorld *world)
for (int j = 0; j < i; j++) for (int j = 0; j < i; j++)
{ {
printf("positionComparee %d %f\n", j, dist(world->nodes[j].position, newPosition)); //printf("positionComparee %d %f\n", j, dist(world->nodes[j].position, newPosition));
if (dist(world->nodes[j].position, newPosition) < 8.0) if (dist(world->nodes[j].position, newPosition) < 8.0)
{ {
continueLoop = true; continueLoop = true;
...@@ -60,6 +60,7 @@ void Random_map(NetWorld *world) ...@@ -60,6 +60,7 @@ void Random_map(NetWorld *world)
name = malloc(20*sizeof(char)); name = malloc(20*sizeof(char));
sprintf(name, "name : %d", i); sprintf(name, "name : %d", i);
Node_set(&(world->nodes[i]), (Vector2){randomX, randomY}, RED, name); Node_set(&(world->nodes[i]), (Vector2){randomX, randomY}, RED, name);
free(name);
} }
else else
{ {
...@@ -69,6 +70,7 @@ void Random_map(NetWorld *world) ...@@ -69,6 +70,7 @@ void Random_map(NetWorld *world)
name = malloc(20*sizeof(char)); name = malloc(20*sizeof(char));
sprintf(name, "name : %d", i); sprintf(name, "name : %d", i);
Node_set(&(world->nodes[i]), (Vector2){randomX, randomY}, RED, name); Node_set(&(world->nodes[i]), (Vector2){randomX, randomY}, RED, name);
free(name);
printf("%f\n", randomX); printf("%f\n", randomX);
printf("%f\n", randomY); printf("%f\n", randomY);
} }
...@@ -83,10 +85,7 @@ void Random_map(NetWorld *world) ...@@ -83,10 +85,7 @@ void Random_map(NetWorld *world)
float ym = 0.5 * (world->nodes[i].position.y + world->nodes[j].position.y); float ym = 0.5 * (world->nodes[i].position.y + world->nodes[j].position.y);
Vector2 M = {xm, ym}; Vector2 M = {xm, ym};
float distNodeCenterOfij = dist(world->nodes[i].position, M); float distNodeCenterOfij = dist(world->nodes[i].position, M);
//printf("xm : %f\n", xm); //printf("distNode %d%d : %f\n", i, j, distNode((world->nodes[i]), world->nodes[j]));
//printf("ym : %f\n", ym);
//printf("distNodeCenterOfij : %f\n", distNodeCenterOfij);
printf("distNode %d%d : %f\n", i, j, distNode((world->nodes[i]), world->nodes[j]));
for (int k = 0; k < nbNode; k++) for (int k = 0; k < nbNode; k++)
{ {
//printf(" distNode center - Node k %f\n", dist(world->nodes[k].position, M)); //printf(" distNode center - Node k %f\n", dist(world->nodes[k].position, M));
...@@ -102,4 +101,5 @@ void Random_map(NetWorld *world) ...@@ -102,4 +101,5 @@ void Random_map(NetWorld *world)
} }
} }
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment