MCPcopy Create free account
hub / github.com/assaultcube/AC / senddemo

Function senddemo

source/src/server.cpp:1120–1150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1118}
1119
1120void senddemo(int cn, int num)
1121{
1122 client *cl = cn>=0 ? clients[cn] : NULL;
1123 if(num < 1) num = sg->demosequence;
1124 demo_s *d = NULL;
1125 loopi(MAXDEMOS) if(demos[i].sequence == num) d = demos + i;
1126 if(d)
1127 {
1128 bool alreadywaiting = false, alreadyserved = false;
1129 loopv(d->clients_waiting) if(d->clients_waiting[i] == cl->clientsequence) alreadywaiting = true;
1130 loopv(d->clients_served) if(d->clients_served[i] == cl->clientsequence) alreadyserved = true;
1131 if(alreadyserved)
1132 {
1133 sendservmsg("\f3Sorry, you have already downloaded this demo.", cl->clientnum);
1134 }
1135 else if(!alreadywaiting)
1136 {
1137 d->clients_waiting.add(cl->clientsequence);
1138 if(!d->done)
1139 {
1140 defformatstring(msg)("scheduled download of demo #%d \"%s\"\n...download will begin, once the demo is finished recording", num, d->info);
1141 sendservmsg(msg, cn);
1142 }
1143 }
1144 }
1145 else
1146 {
1147 defformatstring(msg)("demo #%d not available", num);
1148 sendservmsg(msg, cn);
1149 }
1150}
1151
1152void checkdemotransmissions()
1153{

Callers 1

processFunction · 0.85

Calls 4

sendservmsgFunction · 0.85
loopiFunction · 0.70
loopvFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected