- Made add_string_to_buf accept a string rather than a char*, and began to take advantage of this.

- Added an operator[] to cParty; I intend to get rid of the ADVEN macro eventually in favour of accessing PCs with the operator
- Added using cMonster::operator= to cCreature, because this will be needed once I rearrange these two structures.
- Added an operator= to the cPopulation type, so that the "monst.dudes[...]" redundancy can be avoide.
- Added outdoors and towns members to the scenario class for future use (they will old all the outdoor sections and towns, respectively, from the current scenario)

git-svn-id: http://openexile.googlecode.com/svn/trunk@81 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
2009-05-30 03:36:41 +00:00
parent 5c91bc4062
commit d2d88311db
11 changed files with 31 additions and 31 deletions

View File

@@ -23,3 +23,7 @@ cPopulation& cPopulation::operator = (legacy::creature_list_type old){
friendly = old.friendly;
return *this;
}
cCreature& cPopulation::operator[](size_t n){
return dudes[n];
}

View File

@@ -32,7 +32,8 @@ public:
short which_town;
short friendly;
cPopulation& operator = (legacy::creature_list_type old);
cPopulation& operator= (legacy::creature_list_type old);
cCreature& operator[](size_t n);
};
#endif

View File

@@ -184,6 +184,7 @@ public:
class cCreature : public cMonster {
public:
using cMonster::operator=;
cMonster m_d; // TODO: Delete this member in favour of the inherited fields
unsigned long id;
m_num_t number; // TODO: This appears to be a duplicate of cMonster::m_num (ie it's used for the same thing)

View File

@@ -10,7 +10,7 @@
#include <vector>
#include <map>
#include <sstream>
#include <stdexcept>
#include "classes.h"
#include "oldstructs.h"
@@ -457,3 +457,8 @@ void cParty::readFrom(std::istream& file){
for(int k = 0; k < 64; k++)
bin >> setup[i][j][k];
}
cPlayer& cParty::operator[](unsigned short n){
if(n >= 6) throw std::out_of_range("Attempt to access a player that doesn't exist.");
return adven[n];
}

View File

@@ -112,14 +112,15 @@ public:
bool add_to_journal(short event, short day);
bool record(short what, short where);
bool start_timer(short time, short node, short type);
cPlayer& operator[](unsigned short n);
void writeTo(std::ostream& file);
void readFrom(std::istream& file);
typedef std::vector<cEncNote>::iterator encIter;
typedef std::vector<cJournal>::iterator journalIter;
typedef std::vector<cConvers>::iterator talkIter;
typedef std::vector<cTimer>::iterator timerIter;
typedef std::map<std::string,std::vector<int> >::iterator campIter;
void writeTo(std::ostream& file);
void readFrom(std::istream& file);
};
#endif

View File

@@ -39,7 +39,7 @@ public:
unsigned char out_width,out_height,difficulty,intro_pic,default_ground;
unsigned char town_size[200];
unsigned char town_hidden[200];
short flag_a;
short flag_a; // TODO: Remove these flags
short intro_mess_pic,intro_mess_len;
location where_start,out_sec_start,out_start;
short which_town_start;
@@ -88,6 +88,8 @@ public:
char spec_item_strs[50][256];
char spec_strs[100][256];
FSSpec scen_file; // transient
cOutdoors* outdoors;
cTown* towns;
char(& scen_strs(short i))[256];
cScenario& operator = (legacy::scenario_data_type& old);