- 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:
@@ -215,7 +215,7 @@ enum eTrapType {
|
|||||||
TRAP_DART = 2,
|
TRAP_DART = 2,
|
||||||
TRAP_GAS = 3, // poisons all
|
TRAP_GAS = 3, // poisons all
|
||||||
TRAP_EXPLOSION = 4, // damages all => uses c_town.difficulty rather than trap_level to calculates damages (and even c_town.difficulty /13).
|
TRAP_EXPLOSION = 4, // damages all => uses c_town.difficulty rather than trap_level to calculates damages (and even c_town.difficulty /13).
|
||||||
TRAP_SLEEP_RAY = 5,
|
TRAP_SLEEP_RAY = 5, // TODO: Rename "Paralysis ray"
|
||||||
TRAP_FALSE_ALARM = 6,
|
TRAP_FALSE_ALARM = 6,
|
||||||
TRAP_DRAIN_XP = 7,
|
TRAP_DRAIN_XP = 7,
|
||||||
TRAP_ALERT = 8, // makes town hostile
|
TRAP_ALERT = 8, // makes town hostile
|
||||||
|
@@ -40,20 +40,6 @@
|
|||||||
#define NUM_FACE_G 80
|
#define NUM_FACE_G 80
|
||||||
#define NUM_DLOG_G 28
|
#define NUM_DLOG_G 28
|
||||||
|
|
||||||
|
|
||||||
#define DOOR_LIGHT can_enter = run_trap(7,&PSD[c_town.town_num][which],4220,0); break;
|
|
||||||
#define DOOR_HEAVY can_enter = run_trap(7,&PSD[c_town.town_num][which],4220,20); break;
|
|
||||||
#define DOOR_ALARM can_enter = run_trap(7,&PSD[c_town.town_num][which],4220,11); break;
|
|
||||||
#define DRESSER_LIGHT can_enter = run_trap(7,&PSD[c_town.town_num][which],4221,0); break;
|
|
||||||
#define DRESSER_HEAVY can_enter = run_trap(7,&PSD[c_town.town_num][which],4221,20); break;
|
|
||||||
#define DRESSER_ALARM can_enter = run_trap(7,&PSD[c_town.town_num][which],4221,11); break;
|
|
||||||
#define FLOOR_LIGHT can_enter = run_trap(7,&PSD[c_town.town_num][which],4222,0); break;
|
|
||||||
#define FLOOR_HEAVY can_enter = run_trap(7,&PSD[c_town.town_num][which],4222,20); break;
|
|
||||||
#define FLOOR_ALARM can_enter = run_trap(7,&PSD[c_town.town_num][which],4222,11); break;
|
|
||||||
#define CHEST_LIGHT can_enter = run_trap(7,&PSD[c_town.town_num][which],3450,0); break;
|
|
||||||
#define CHEST_HEAVY can_enter = run_trap(7,&PSD[c_town.town_num][which],3450,20); break;
|
|
||||||
#define CHEST_ALARM can_enter = run_trap(7,&PSD[c_town.town_num][which],3450,11); break;
|
|
||||||
|
|
||||||
#define CDGT cd_retrieve_text_edit_str
|
#define CDGT cd_retrieve_text_edit_str
|
||||||
#define CDGN cd_retrieve_text_edit_num
|
#define CDGN cd_retrieve_text_edit_num
|
||||||
#define CDST cd_set_text_edit_str
|
#define CDST cd_set_text_edit_str
|
||||||
|
@@ -811,17 +811,17 @@ void print_party_stats() {
|
|||||||
char store_string[255];
|
char store_string[255];
|
||||||
add_string_to_buf("PARTY STATS:");
|
add_string_to_buf("PARTY STATS:");
|
||||||
sprintf((char *) store_string, " Number of kills: %lld ", univ.party.total_m_killed);
|
sprintf((char *) store_string, " Number of kills: %lld ", univ.party.total_m_killed);
|
||||||
add_string_to_buf((char *) store_string);
|
add_string_to_buf(store_string);
|
||||||
if ((is_town()) || ((is_combat()) && (which_combat_type == 1))) {
|
if ((is_town()) || ((is_combat()) && (which_combat_type == 1))) {
|
||||||
sprintf((char *) store_string, " Kills in this town: %d ", univ.party.m_killed[univ.town.num]);
|
sprintf((char *) store_string, " Kills in this town: %d ", univ.party.m_killed[univ.town.num]);
|
||||||
add_string_to_buf((char *) store_string);
|
add_string_to_buf(store_string);
|
||||||
}
|
}
|
||||||
sprintf((char *) store_string, " Total experience: %lld ", univ.party.total_xp_gained);
|
sprintf((char *) store_string, " Total experience: %lld ", univ.party.total_xp_gained);
|
||||||
add_string_to_buf((char *) store_string);
|
add_string_to_buf(store_string);
|
||||||
sprintf((char *) store_string, " Total damage done: %lld ", univ.party.total_dam_done);
|
sprintf((char *) store_string, " Total damage done: %lld ", univ.party.total_dam_done);
|
||||||
add_string_to_buf((char *) store_string);
|
add_string_to_buf(store_string);
|
||||||
sprintf((char *) store_string, " Total damage taken: %lld ", univ.party.total_dam_taken);
|
sprintf((char *) store_string, " Total damage taken: %lld ", univ.party.total_dam_taken);
|
||||||
add_string_to_buf((char *) store_string);
|
add_string_to_buf(store_string);
|
||||||
print_buf();
|
print_buf();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -844,7 +844,7 @@ short do_look(location space)
|
|||||||
if ((space == pc_pos[i]) && (ADVEN[i].main_status == 1)
|
if ((space == pc_pos[i]) && (ADVEN[i].main_status == 1)
|
||||||
&& (is_lit == true) && (can_see(pc_pos[current_pc],space,0) < 5)) {
|
&& (is_lit == true) && (can_see(pc_pos[current_pc],space,0) < 5)) {
|
||||||
msg = " " + ADVEN[i].name;
|
msg = " " + ADVEN[i].name;
|
||||||
add_string_to_buf((char *) msg.c_str());
|
add_string_to_buf(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((overall_mode == MODE_LOOK_TOWN) || (overall_mode == MODE_LOOK_COMBAT)) {
|
if ((overall_mode == MODE_LOOK_TOWN) || (overall_mode == MODE_LOOK_COMBAT)) {
|
||||||
@@ -1284,13 +1284,13 @@ short print_terrain(location space)
|
|||||||
}
|
}
|
||||||
std::string msg = get_ter_name(which_terrain);
|
std::string msg = get_ter_name(which_terrain);
|
||||||
msg = " " + msg;
|
msg = " " + msg;
|
||||||
add_string_to_buf((char *) msg.c_str());
|
add_string_to_buf(msg);
|
||||||
|
|
||||||
return (short) which_terrain;
|
return (short) which_terrain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void add_string_to_buf(char *string)
|
void add_string_to_buf(std::string str)
|
||||||
{
|
{
|
||||||
if (in_startup_mode == true)
|
if (in_startup_mode == true)
|
||||||
return;
|
return;
|
||||||
@@ -1301,7 +1301,7 @@ void add_string_to_buf(char *string)
|
|||||||
print_buf();
|
print_buf();
|
||||||
through_sending();
|
through_sending();
|
||||||
}
|
}
|
||||||
sprintf((char *)text_buffer[buf_pointer].line, "%-49.49s", string);
|
sprintf((char *)text_buffer[buf_pointer].line, "%-49.49s", str.c_str());
|
||||||
// c2pstr((char *)text_buffer[buf_pointer].line);
|
// c2pstr((char *)text_buffer[buf_pointer].line);
|
||||||
if (buf_pointer == (TEXT_BUF_LEN - 1))
|
if (buf_pointer == (TEXT_BUF_LEN - 1))
|
||||||
buf_pointer = 0;
|
buf_pointer = 0;
|
||||||
|
@@ -33,7 +33,7 @@ void monst_damaged_mes(short which_m,short how_much,short how_much_spec);
|
|||||||
void monst_killed_mes(short which_m);
|
void monst_killed_mes(short which_m);
|
||||||
void print_nums(short a,short b,short c);
|
void print_nums(short a,short b,short c);
|
||||||
short print_terrain(location space);
|
short print_terrain(location space);
|
||||||
void add_string_to_buf(char *string);
|
void add_string_to_buf(std::string str);
|
||||||
void init_buf();
|
void init_buf();
|
||||||
void print_buf () ;
|
void print_buf () ;
|
||||||
void restart_printing();
|
void restart_printing();
|
||||||
|
@@ -550,7 +550,7 @@ void start_town_mode(short which_town, short entry_dir)
|
|||||||
|
|
||||||
add_string_to_buf("Now entering:");
|
add_string_to_buf("Now entering:");
|
||||||
sprintf ((char *) message, " %-30.30s ",univ.town->town_strs(0));
|
sprintf ((char *) message, " %-30.30s ",univ.town->town_strs(0));
|
||||||
add_string_to_buf((char *) message);
|
add_string_to_buf(message);
|
||||||
|
|
||||||
|
|
||||||
// clear entry space, and check exploration
|
// clear entry space, and check exploration
|
||||||
|
@@ -23,3 +23,7 @@ cPopulation& cPopulation::operator = (legacy::creature_list_type old){
|
|||||||
friendly = old.friendly;
|
friendly = old.friendly;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cCreature& cPopulation::operator[](size_t n){
|
||||||
|
return dudes[n];
|
||||||
|
}
|
||||||
|
@@ -32,7 +32,8 @@ public:
|
|||||||
short which_town;
|
short which_town;
|
||||||
short friendly;
|
short friendly;
|
||||||
|
|
||||||
cPopulation& operator = (legacy::creature_list_type old);
|
cPopulation& operator= (legacy::creature_list_type old);
|
||||||
|
cCreature& operator[](size_t n);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
@@ -184,6 +184,7 @@ public:
|
|||||||
|
|
||||||
class cCreature : public cMonster {
|
class cCreature : public cMonster {
|
||||||
public:
|
public:
|
||||||
|
using cMonster::operator=;
|
||||||
cMonster m_d; // TODO: Delete this member in favour of the inherited fields
|
cMonster m_d; // TODO: Delete this member in favour of the inherited fields
|
||||||
unsigned long id;
|
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)
|
m_num_t number; // TODO: This appears to be a duplicate of cMonster::m_num (ie it's used for the same thing)
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "classes.h"
|
#include "classes.h"
|
||||||
#include "oldstructs.h"
|
#include "oldstructs.h"
|
||||||
@@ -457,3 +457,8 @@ void cParty::readFrom(std::istream& file){
|
|||||||
for(int k = 0; k < 64; k++)
|
for(int k = 0; k < 64; k++)
|
||||||
bin >> setup[i][j][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];
|
||||||
|
}
|
||||||
|
@@ -112,14 +112,15 @@ public:
|
|||||||
bool add_to_journal(short event, short day);
|
bool add_to_journal(short event, short day);
|
||||||
bool record(short what, short where);
|
bool record(short what, short where);
|
||||||
bool start_timer(short time, short node, short type);
|
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<cEncNote>::iterator encIter;
|
||||||
typedef std::vector<cJournal>::iterator journalIter;
|
typedef std::vector<cJournal>::iterator journalIter;
|
||||||
typedef std::vector<cConvers>::iterator talkIter;
|
typedef std::vector<cConvers>::iterator talkIter;
|
||||||
typedef std::vector<cTimer>::iterator timerIter;
|
typedef std::vector<cTimer>::iterator timerIter;
|
||||||
typedef std::map<std::string,std::vector<int> >::iterator campIter;
|
typedef std::map<std::string,std::vector<int> >::iterator campIter;
|
||||||
void writeTo(std::ostream& file);
|
|
||||||
void readFrom(std::istream& file);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
@@ -39,7 +39,7 @@ public:
|
|||||||
unsigned char out_width,out_height,difficulty,intro_pic,default_ground;
|
unsigned char out_width,out_height,difficulty,intro_pic,default_ground;
|
||||||
unsigned char town_size[200];
|
unsigned char town_size[200];
|
||||||
unsigned char town_hidden[200];
|
unsigned char town_hidden[200];
|
||||||
short flag_a;
|
short flag_a; // TODO: Remove these flags
|
||||||
short intro_mess_pic,intro_mess_len;
|
short intro_mess_pic,intro_mess_len;
|
||||||
location where_start,out_sec_start,out_start;
|
location where_start,out_sec_start,out_start;
|
||||||
short which_town_start;
|
short which_town_start;
|
||||||
@@ -88,6 +88,8 @@ public:
|
|||||||
char spec_item_strs[50][256];
|
char spec_item_strs[50][256];
|
||||||
char spec_strs[100][256];
|
char spec_strs[100][256];
|
||||||
FSSpec scen_file; // transient
|
FSSpec scen_file; // transient
|
||||||
|
cOutdoors* outdoors;
|
||||||
|
cTown* towns;
|
||||||
|
|
||||||
char(& scen_strs(short i))[256];
|
char(& scen_strs(short i))[256];
|
||||||
cScenario& operator = (legacy::scenario_data_type& old);
|
cScenario& operator = (legacy::scenario_data_type& old);
|
||||||
|
Reference in New Issue
Block a user