UFO: Alien Invasion
Toggle main menu visibility
Loading...
Searching...
No Matches
e_event_results.cpp
Go to the documentation of this file.
1
4
5
/*
6
Copyright (C) 2002-2025 UFO: Alien Invasion.
7
8
This program is free software; you can redistribute it and/or
9
modify it under the terms of the GNU General Public License
10
as published by the Free Software Foundation; either version 2
11
of the License, or (at your option) any later version.
12
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
17
See the GNU General Public License for more details.
18
19
You should have received a copy of the GNU General Public License
20
along with this program; if not, write to the Free Software
21
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23
*/
24
25
#include "
../../../../client.h
"
26
#include "
../../../../cgame/cl_game.h
"
27
#include "
e_event_results.h
"
28
29
int
CL_ParseResultsTime
(
const
struct
eventRegister_s* self,
dbuffer
* msg,
eventTiming_t
* eventTiming)
30
{
31
return
eventTiming->
nextTime
+ 1400;
32
}
33
40
void
CL_ParseResults
(
const
eventRegister_t
* self,
dbuffer
* msg)
41
{
42
/* get number of teams */
43
const
int
num =
NET_ReadByte
(msg);
44
if
(num >
MAX_TEAMS
)
45
Com_Error
(
ERR_DROP
,
"Too many teams in result message"
);
46
47
Com_DPrintf
(
DEBUG_CLIENT
,
"Receiving results with %i teams.\n"
, num);
48
49
/* get winning team */
50
const
int
winner =
NET_ReadByte
(msg);
51
const
bool
nextmap =
NET_ReadByte
(msg);
52
53
if
(
cls
.team > num)
54
Com_Error
(
ERR_DROP
,
"Team number %d too high (only %d teams)"
,
cls
.team, num);
55
56
/* get spawn and alive count */
57
int
num_spawned[
MAX_TEAMS
];
58
int
num_alive[
MAX_TEAMS
];
59
OBJZERO
(num_spawned);
60
OBJZERO
(num_alive);
61
for
(
int
i
= 0;
i
< num;
i
++) {
62
num_spawned[
i
] =
NET_ReadByte
(msg);
63
num_alive[
i
] =
NET_ReadByte
(msg);
64
}
65
66
/* get kills */
67
/* the first dimension contains the attacker team, the second the victim team */
68
int
num_kills[
MAX_TEAMS
+ 1][
MAX_TEAMS
];
69
OBJZERO
(num_kills);
70
for
(
int
i
= 0;
i
<= num;
i
++)
71
for
(
int
j = 0; j < num; j++)
72
num_kills[
i
][j] =
NET_ReadByte
(msg);
73
74
/* get stuns */
75
int
num_stuns[
MAX_TEAMS
+ 1][
MAX_TEAMS
];
76
OBJZERO
(num_stuns);
77
for
(
int
i
= 0;
i
<= num;
i
++)
78
for
(
int
j = 0; j < num; j++)
79
num_stuns[
i
][j] =
NET_ReadByte
(msg);
80
81
GAME_HandleResults
(msg, winner, num_spawned, num_alive, num_kills, num_stuns, nextmap);
82
}
GAME_HandleResults
void GAME_HandleResults(dbuffer *msg, int winner, int *numSpawned, int *numAlive, int numKilled[][MAX_TEAMS], int numStunned[][MAX_TEAMS], bool nextmap)
After a mission was finished this function is called.
Definition
cl_game.cpp:1135
cl_game.h
Shared game type headers.
cls
client_static_t cls
Definition
cl_main.cpp:83
dbuffer
Definition
dbuffer.h:20
client.h
Primary header for client.
Com_DPrintf
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
Definition
common.cpp:440
Com_Error
void Com_Error(int code, const char *fmt,...)
Definition
common.cpp:459
ERR_DROP
#define ERR_DROP
Definition
common.h:211
MAX_TEAMS
#define MAX_TEAMS
Definition
defines.h:98
DEBUG_CLIENT
#define DEBUG_CLIENT
Definition
defines.h:59
CL_ParseResults
void CL_ParseResults(const eventRegister_t *self, dbuffer *msg)
Reads mission result data from server.
Definition
e_event_results.cpp:40
CL_ParseResultsTime
int CL_ParseResultsTime(const struct eventRegister_s *self, dbuffer *msg, eventTiming_t *eventTiming)
Definition
e_event_results.cpp:29
e_event_results.h
NET_ReadByte
int NET_ReadByte(dbuffer *buf)
Reads a byte from the netchannel.
Definition
netpack.cpp:234
i
QGL_EXTERN GLint i
Definition
r_gl.h:113
OBJZERO
#define OBJZERO(obj)
Definition
shared.h:178
eventRegister_t
Struct that defines one particular event with all its callbacks and data.
Definition
e_main.h:42
eventTiming_t
CL_ParseEvent timers and vars.
Definition
e_main.h:30
eventTiming_t::nextTime
int nextTime
Definition
e_main.h:31
src
client
battlescape
events
event
player
e_event_results.cpp
Generated on __DATE__ __TIME__ for UFO: Alien Invasion by
1.17.0