Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NetWorld
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LAIRD Timothy
NetWorld
Commits
48238969
Commit
48238969
authored
Apr 21, 2021
by
ewen.madec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
colored edges + executable => risk
parent
cb3f9a52
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
CMakeLists.txt
CMakeLists.txt
+3
-3
player.c
src/player.c
+3
-0
random-map.c
src/random-map.c
+5
-5
No files found.
CMakeLists.txt
View file @
48238969
...
...
@@ -18,11 +18,11 @@ include_directories(${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/src)
include_directories
(
${
PROJECT_SOURCE_DIR
}
/dpd/include
)
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...
#include_directories(${PROJECT_SOURCE_DIR}/raylib/src)
#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)
src/player.c
View file @
48238969
...
...
@@ -46,6 +46,9 @@ void Player_add_Node( Player * self, Node * node )
newNodes
[
i
]
=
self
->
nodes
[
i
];
}
node
->
color
=
self
->
color
;
for
(
int
i
=
0
;
i
<
node
->
card
;
i
++
){
node
->
edges
[
i
].
color
=
self
->
color
;
}
node
->
playerID
=
self
->
ID
;
newNodes
[
self
->
nodeCount
]
=
node
;
free
(
self
->
nodes
);
...
...
src/random-map.c
View file @
48238969
...
...
@@ -47,7 +47,7 @@ void Random_map(NetWorld *world)
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
)
{
continueLoop
=
true
;
...
...
@@ -60,6 +60,7 @@ void Random_map(NetWorld *world)
name
=
malloc
(
20
*
sizeof
(
char
));
sprintf
(
name
,
"name : %d"
,
i
);
Node_set
(
&
(
world
->
nodes
[
i
]),
(
Vector2
){
randomX
,
randomY
},
RED
,
name
);
free
(
name
);
}
else
{
...
...
@@ -69,6 +70,7 @@ void Random_map(NetWorld *world)
name
=
malloc
(
20
*
sizeof
(
char
));
sprintf
(
name
,
"name : %d"
,
i
);
Node_set
(
&
(
world
->
nodes
[
i
]),
(
Vector2
){
randomX
,
randomY
},
RED
,
name
);
free
(
name
);
printf
(
"%f
\n
"
,
randomX
);
printf
(
"%f
\n
"
,
randomY
);
}
...
...
@@ -83,10 +85,7 @@ void Random_map(NetWorld *world)
float
ym
=
0
.
5
*
(
world
->
nodes
[
i
].
position
.
y
+
world
->
nodes
[
j
].
position
.
y
);
Vector2
M
=
{
xm
,
ym
};
float
distNodeCenterOfij
=
dist
(
world
->
nodes
[
i
].
position
,
M
);
//printf("xm : %f\n", xm);
//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
]));
//printf("distNode %d%d : %f\n", i, j, distNode((world->nodes[i]), world->nodes[j]));
for
(
int
k
=
0
;
k
<
nbNode
;
k
++
)
{
//printf(" distNode center - Node k %f\n", dist(world->nodes[k].position, M));
...
...
@@ -102,4 +101,5 @@ void Random_map(NetWorld *world)
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment