UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
memory.cpp
Go to the documentation of this file.
1 
6 #include <SDL_opengl.h>
7 #include <SDL_main.h>
8 #include <SDL_thread.h>
9 #include "../common/common.h"
10 #include "../shared/shared.h"
11 #include "../server/server.h"
12 #include "../client/client.h"
13 #include "../client/renderer/r_state.h" /* r_state */
14 #include "../client/ui/ui_main.h"
15 #include "../client/ui/ui_behaviour.h"
16 #include "../client/cgame/campaign/cp_campaign.h"
17 #include "../client/cgame/campaign/cp_geoscape.h"
18 #include "../client/cgame/campaign/cp_hospital.h"
19 #include "../client/cgame/campaign/cp_missions.h"
20 #include "../client/cgame/campaign/cp_nation.h"
21 #include "../client/cgame/campaign/cp_overlay.h"
22 #include "../client/cgame/campaign/cp_ufo.h"
23 #include "../client/cgame/campaign/cp_time.h"
24 #include "../client/battlescape/cl_battlescape.h"
25 #include "../client/cgame/campaign/cp_alien_interest.h"
26 
27 #define STRUCTFORMAT "%24s"
28 #define SIZEFORMAT "%12s"
29 #define TYPESIZE(type) printf(STRUCTFORMAT ": " SIZEFORMAT " KB\n", #type, MEMORY_HumanReadable(sizeof(type)));
30 
31 #if defined _WIN32
32 # define UFO_SIZE_LENGTH_T "%03Iu"
33 #else
34 #ifdef __cplusplus
35 #if __WORDSIZE == 64
36 # define UFO_SIZE_LENGTH_T "%03lu"
37 #else
38 # define UFO_SIZE_LENGTH_T "%03u"
39 #endif
40 #else
41 # define UFO_SIZE_LENGTH_T "%03zu"
42 #endif
43 #endif
44 
45 static const char* MEMORY_HumanReadable (size_t size)
46 {
47  static char buf[256];
48 
49  const size_t kb = size / 1024 % 1024;
50  const size_t b = size % 1024;
51  const size_t mb = size / 1024 / 1024;
52 
53  snprintf(buf, sizeof(buf) - 1, UFO_SIZE_T "." UFO_SIZE_LENGTH_T "." UFO_SIZE_LENGTH_T, mb, kb, b);
54  buf[sizeof(buf) - 1] = '\0';
55  return buf;
56 }
57 
58 #ifdef main
59 #undef main
60 #endif
61 
62 int main (int argc, char **argv)
63 {
64  printf(STRUCTFORMAT " " SIZEFORMAT "\n\n", "struct", "size");
65 
81  TYPESIZE(ccs_t);
89  TYPESIZE(csi_t);
100  TYPESIZE(le_t);
108  TYPESIZE(MapTile);
112  TYPESIZE(model_t);
115  TYPESIZE(ptl_t);
123  TYPESIZE(tnode_t);
128 
129  return EXIT_SUCCESS;
130 }
int main(int argc, char **argv)
Definition: memory.cpp:62
Nation definition.
Definition: cp_nation.h:44
This is the structure that should be used for data that is needed for tactical missions only...
This is a cvar definition. Cvars can be user modified and used in our menus e.g.
Definition: cvar.h:71
#define STRUCTFORMAT
Definition: memory.cpp:27
Data for line tracing (?)
Definition: typedefs.h:69
template for creating a base
Definition: cp_base.h:130
mission definition
Definition: cp_missions.h:85
voidpf void * buf
Definition: ioapi.h:42
lighting structure which contains static and dynamic lighting info for entities
Definition: r_lighting.h:29
A base with all it's data.
Definition: cp_base.h:84
Stores the data of a map tile, mostly the BSP stuff.
Definition: typedefs.h:85
Struct that is only valid for one map. It's deleted on every map load.
Definition: server.h:106
inventory definition with all its containers
Definition: inv_shared.h:525
GLsizei size
Definition: r_gl.h:152
The csi structure is the client-server-information structure which contains all the static data neede...
Definition: q_shared.h:515
static const char * MEMORY_HumanReadable(size_t size)
Definition: memory.cpp:45
This is the technology parsed from research.ufo.
Definition: cp_research.h:137
Definition: grid.h:83
client campaign structure
Definition: cp_campaign.h:228
Atomic structure used to define most of the UI.
Definition: ui_nodes.h:80
a local entity
available mails for a tech - mail and mail_pre in script files
Definition: cp_event.h:38
The definition of a "components" entry (i.e. an assembly of several items) parsed from a ufo-file...
Definition: cp_component.h:35
Not cleared on a map change (static data)
Definition: client.h:54
#define UFO_SIZE_LENGTH_T
Definition: memory.cpp:41
node behaviour, how a node work
Definition: ui_behaviour.h:39
#define UFO_SIZE_T
Definition: ufotypes.h:89
brush model
To avoid linearly searching through lists of entities during environment testing, the world is carved...
Definition: server.h:57
#define SIZEFORMAT
Definition: memory.cpp:28
projectile used during fight between two or more aircraft
Definition: cp_airfight.h:43
An aircraft with all it's data.
Definition: cp_aircraft.h:114
Pathfinding routing structure and tile layout.
Definition: typedefs.h:196
#define TYPESIZE(type)
Definition: memory.cpp:29
static mesh models (none-animated) can have a server side flag set to be clipped for pathfinding ...
Definition: server.h:47
local models
plane_t structure
Definition: typedefs.h:20
Describes a character with all its attributes.
Definition: chr_shared.h:369