aboutsummaryrefslogtreecommitdiff
path: root/muswd.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2022-06-03 20:36:54 +0000
committerrodri <rgl@antares-labs.eu>2022-06-03 20:36:54 +0000
commitb8379bd4d9bd65ae85c7d08554dc6ded0d9e1b7d (patch)
tree858c3766fa69a0841ad0061565eac36ff33ede34 /muswd.c
parent2e058861a4dc6622083d9f603020c2428df92861 (diff)
downloadmusw-b8379bd4d9bd65ae85c7d08554dc6ded0d9e1b7d.tar.gz
musw-b8379bd4d9bd65ae85c7d08554dc6ded0d9e1b7d.tar.bz2
musw-b8379bd4d9bd65ae85c7d08554dc6ded0d9e1b7d.zip
got rid of GameState.
Diffstat (limited to 'muswd.c')
-rw-r--r--muswd.c20
1 files changed, 1 insertions, 19 deletions
diff --git a/muswd.c b/muswd.c
index 88d1bb7..339a4ef 100644
--- a/muswd.c
+++ b/muswd.c
@@ -91,8 +91,7 @@ broadcaststate(void)
Party *p;
for(p = theparty.next; p != &theparty; p = p->next){
- n = pack(buf, sizeof buf, "PPdPdP",
- p->state.p,
+ n = pack(buf, sizeof buf, "PdPdP",
p->u->ships[0].p, p->u->ships[0].θ,
p->u->ships[1].p, p->u->ships[1].θ,
p->u->star.p);
@@ -112,13 +111,6 @@ broadcaststate(void)
}
void
-resetsim(Party *p)
-{
- memset(&p->state, 0, sizeof p->state);
- p->state.p = Pt2(0,100,1);
-}
-
-void
threadsim(void *)
{
uvlong then, now;
@@ -136,7 +128,6 @@ threadsim(void *)
if(lobby->getcouple(lobby, couple) != -1){
newparty(couple);
- resetsim(theparty.prev);
theparty.prev->u->reset(theparty.prev->u);
}
@@ -146,19 +137,12 @@ threadsim(void *)
for(p = theparty.next; p != &theparty; p = p->next){
p->u->timeacc += frametime/1e9;
- p->state.timeacc += frametime/1e9;
while(p->u->timeacc >= Δt){
p->u->step(p->u, Δt);
p->u->timeacc -= Δt;
p->u->t += Δt;
}
-
- while(p->state.timeacc >= Δt){
- integrate(&p->state, p->state.t, Δt);
- p->state.timeacc -= Δt;
- p->state.t += Δt;
- }
}
broadcaststate();
@@ -193,8 +177,6 @@ fprintstates(int fd)
Ship *s;
for(p = theparty.next; p != &theparty; p = p->next, i++){
- fprint(fd, "%lud p %v v %v\n",
- i, p->state.p, p->state.v);
for(s = &p->u->ships[0]; s-p->u->ships < nelem(p->u->ships); s++){
fprint(fd, "%lud s%lld k%d p %v v %v θ %g ω %g m %g f %d\n",
i, s-p->u->ships, s->kind, s->p, s->v, s->θ, s->ω, s->mass, s->fuel);