Files
source/MPXmlTeams.hpp
T
Wanne 14750c6903 **********************************************************
** Big Maps Projects code (incl. Multiplayer v1.5 **
**********************************************************
- Merged Big Maps Project code from BMP+MP trunk (Revision: 3340)
o Complete SVN Revision history: https://81.169.133.124/source/ja2/branches/Wanne/JA2%201.13%20MP
- Before THIS merge, I made a branch of the existing 1.13 source
o SVN Branch: https://81.169.133.124/source/ja2/branches/JA2_rev.3336/src
- Removed old VS 6.0 and VS 2003 project and solutions files, because compilation is broken long time ago
- I will add VS 2010 projects and solution file in the next few days

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3341 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2010-02-28 18:38:52 +00:00

82 lines
1.6 KiB
C++

#ifndef MPXMLTEAMS_HPP
#define MPXMLTEAMS_HPP
#include "types.h"
#include "XML.h"
#include "expat.h"
#include <vector>
#define NUM_RANDOM_MERC_TEAMS 4
#define RANDOM_MERC_TEAM_SIZE 7
/* MPTeams.xml structure:
- name attribute is optional and not used anywhere yet
<mp_teams>
<team name="team1">
<id>42</id>
<id>23</id>
...
</team>
<team>
<id>97</id>
...
</team>
...
</mp_teams>
*/
class MultiplayerTeams
{
private:
struct MPTeam
{
std::string name;
std::vector<int> members;
};
public:
BOOLEAN ReadInMPTeams(STR fileName);
void HandleServerStarted();
MultiplayerTeams();
~MultiplayerTeams();
void SerializeProfiles(int* dest);
void SerializeProfiles(int* dest, int teamID);
private:
std::vector< MPTeam > teams;
std::vector<bool> teamsTaken;
bool initialized;
BOOLEAN ReadXMLFile(STR fileName);
void UseFallbackDataIfNecessary();
void TrashTeams();
static void XMLCALL teamsStartElementHandler(void *userData, const XML_Char *name, const XML_Char **atts);
static void XMLCALL teamsEndElementHandler(void *userData, const XML_Char *name);
static void XMLCALL teamsCharacterDataHandler(void *userData, const XML_Char *s, int len);
struct teamsParseData
{
PARSE_STAGE curElement;
CHAR8 szCharData[MAX_CHAR_DATA_LENGTH+1];
UINT32 currentDepth;
UINT32 maxReadDepth;
MultiplayerTeams *mpTeams;
};
static const int random_merc_teams[NUM_RANDOM_MERC_TEAMS][RANDOM_MERC_TEAM_SIZE];
};
// make global
extern MultiplayerTeams mpTeams;
#endif