Added include guards to all class headers.
Removed unnecessary or potentially harmful compiler flags. Added alignment attribute to all old struct members. Removed some unused variables. Made some switch statements handle all or more cases. Removed using declarations in favor of fully qualified names. Fixed a couple of assignments in conditionals that should have been comparisons. Eliminated linker warnings by restoring default linking of standard libraries. Fixed some comparisons between signed and unsigned integers. Note: No testing has been done, in particular of old file I/O. This should be checked for regression caused by alteration of old struct definitions. git-svn-id: http://openexile.googlecode.com/svn/trunk@63 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "classes.h"
|
||||
#include "oldstructs.h"
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CREATLIST_H
|
||||
#define CREATLIST_H
|
||||
|
||||
namespace legacy {
|
||||
struct creature_list_type;
|
||||
struct creature_data_type;
|
||||
@@ -31,3 +34,5 @@ public:
|
||||
|
||||
cPopulation& operator = (legacy::creature_list_type old);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "classes.h"
|
||||
#include "boe.consts.h"
|
||||
@@ -316,7 +316,7 @@ cItemRec& cItemRec::operator = (legacy::item_record_type& old){
|
||||
special_class = old.special_class;
|
||||
item_loc.x = old.item_loc.x;
|
||||
item_loc.y = old.item_loc.y;
|
||||
full_name = string(old.full_name);
|
||||
full_name = std::string(old.full_name);
|
||||
name = old.name;
|
||||
treas_class = old.treas_class;
|
||||
item_properties = old.item_properties;
|
||||
@@ -325,37 +325,37 @@ cItemRec& cItemRec::operator = (legacy::item_record_type& old){
|
||||
return *this;
|
||||
}
|
||||
|
||||
void cItemRec::writeTo(ostream& file, string prefix){
|
||||
file << prefix << "VARIETY " << variety << endl;
|
||||
file << prefix << "LEVEL " << item_level << endl;
|
||||
file << prefix << "AWKWARD " << awkward << endl;
|
||||
file << prefix << "BONUS " << bonus << endl;
|
||||
file << prefix << "PROT " << protection << endl;
|
||||
file << prefix << "CHARGES " << charges << endl;
|
||||
file << prefix << "WEAPON " << type << endl;
|
||||
file << prefix << "USE " << magic_use_type << endl;
|
||||
file << prefix << "ICON " << graphic_num << endl;
|
||||
file << prefix << "ABILITY " << ability << endl;
|
||||
file << prefix << "ABILSTR " << ability_strength << endl;
|
||||
file << prefix << "TYPE " << type_flag << endl;
|
||||
file << prefix << "ISSPEC " << is_special << endl;
|
||||
file << prefix << "VALUE " << value << endl;
|
||||
file << prefix << "WEIGHT " << weight << endl;
|
||||
file << prefix << "SPEC " << special_class << endl;
|
||||
file << prefix << "AT " << item_loc.x << ' ' << item_loc.y << endl;
|
||||
file << prefix << "FULLNAME " << full_name << endl;
|
||||
file << prefix << "NAME " << name << endl;
|
||||
file << prefix << "TREASURE " << treas_class << endl;
|
||||
if(is_ident()) file << prefix << "IDENTIFIED" << endl;
|
||||
if(is_property()) file << prefix << "PROPERTY" << endl;
|
||||
if(is_magic()) file << prefix << "MAGIC" << endl;
|
||||
if(is_contained()) file << prefix << "CONTAINED" << endl;
|
||||
if(is_cursed()) file << prefix << "CURSED" << endl;
|
||||
if(is_concealed()) file << prefix << "CONCEALED" << endl;
|
||||
if(is_enchanted()) file << prefix << "ENCHANTED" << endl;
|
||||
void cItemRec::writeTo(std::ostream& file, std::string prefix){
|
||||
file << prefix << "VARIETY " << variety << std::endl;
|
||||
file << prefix << "LEVEL " << item_level << std::endl;
|
||||
file << prefix << "AWKWARD " << awkward << std::endl;
|
||||
file << prefix << "BONUS " << bonus << std::endl;
|
||||
file << prefix << "PROT " << protection << std::endl;
|
||||
file << prefix << "CHARGES " << charges << std::endl;
|
||||
file << prefix << "WEAPON " << type << std::endl;
|
||||
file << prefix << "USE " << magic_use_type << std::endl;
|
||||
file << prefix << "ICON " << graphic_num << std::endl;
|
||||
file << prefix << "ABILITY " << ability << std::endl;
|
||||
file << prefix << "ABILSTR " << ability_strength << std::endl;
|
||||
file << prefix << "TYPE " << type_flag << std::endl;
|
||||
file << prefix << "ISSPEC " << is_special << std::endl;
|
||||
file << prefix << "VALUE " << value << std::endl;
|
||||
file << prefix << "WEIGHT " << weight << std::endl;
|
||||
file << prefix << "SPEC " << special_class << std::endl;
|
||||
file << prefix << "AT " << item_loc.x << ' ' << item_loc.y << std::endl;
|
||||
file << prefix << "FULLNAME " << full_name << std::endl;
|
||||
file << prefix << "NAME " << name << std::endl;
|
||||
file << prefix << "TREASURE " << treas_class << std::endl;
|
||||
if(is_ident()) file << prefix << "IDENTIFIED" << std::endl;
|
||||
if(is_property()) file << prefix << "PROPERTY" << std::endl;
|
||||
if(is_magic()) file << prefix << "MAGIC" << std::endl;
|
||||
if(is_contained()) file << prefix << "CONTAINED" << std::endl;
|
||||
if(is_cursed()) file << prefix << "CURSED" << std::endl;
|
||||
if(is_concealed()) file << prefix << "CONCEALED" << std::endl;
|
||||
if(is_enchanted()) file << prefix << "ENCHANTED" << std::endl;
|
||||
}
|
||||
|
||||
void cItemRec::readAttrFrom(string cur, istream& sin){
|
||||
void cItemRec::readAttrFrom(std::string cur, std::istream& sin){
|
||||
if(cur == "VARIETY") sin >> variety;
|
||||
else if(cur == "LEVEL") sin >> item_level;
|
||||
else if(cur == "AWKWARD") sin >> awkward;
|
||||
@@ -390,19 +390,19 @@ void cItemRec::readAttrFrom(string cur, istream& sin){
|
||||
else if(cur == "ENCHANTED") set_enchanted(true);
|
||||
}
|
||||
|
||||
ostream& operator << (ostream& out, eWeapType& e){
|
||||
std::ostream& operator << (std::ostream& out, eWeapType& e){
|
||||
return out << (int) e;
|
||||
}
|
||||
|
||||
ostream& operator << (ostream& out, eItemType& e){
|
||||
std::ostream& operator << (std::ostream& out, eItemType& e){
|
||||
return out << (int) e;
|
||||
}
|
||||
|
||||
ostream& operator << (ostream& out, eItemAbil& e){
|
||||
std::ostream& operator << (std::ostream& out, eItemAbil& e){
|
||||
return out << (int) e;
|
||||
}
|
||||
|
||||
istream& operator >> (istream& in, eWeapType& e){
|
||||
std::istream& operator >> (std::istream& in, eWeapType& e){
|
||||
int i;
|
||||
in >> i;
|
||||
if(i > 0 && i < 4)
|
||||
@@ -411,7 +411,7 @@ istream& operator >> (istream& in, eWeapType& e){
|
||||
return in;
|
||||
}
|
||||
|
||||
istream& operator >> (istream& in, eItemType& e){
|
||||
std::istream& operator >> (std::istream& in, eItemType& e){
|
||||
int i;
|
||||
in >> i;
|
||||
if(i > 0 && i < 28)
|
||||
@@ -420,7 +420,7 @@ istream& operator >> (istream& in, eItemType& e){
|
||||
return in;
|
||||
}
|
||||
|
||||
istream& operator >> (istream& in, eItemAbil& e){
|
||||
std::istream& operator >> (std::istream& in, eItemAbil& e){
|
||||
int i;
|
||||
in >> i;
|
||||
if((i > 0 && i < 15) || (i > 29 && i < 63) ||
|
||||
|
||||
@@ -6,7 +6,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ITEM_H
|
||||
#define ITEM_H
|
||||
|
||||
#include "location.h"
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
namespace legacy { struct item_record_type; };
|
||||
|
||||
@@ -201,8 +206,8 @@ public:
|
||||
unsigned char weight;
|
||||
unsigned char special_class;
|
||||
location item_loc;
|
||||
string full_name;
|
||||
string name;
|
||||
std::string full_name;
|
||||
std::string name;
|
||||
unsigned char treas_class;
|
||||
unsigned char item_properties;
|
||||
private:
|
||||
@@ -230,16 +235,16 @@ public:
|
||||
cItemRec();
|
||||
cItemRec(long preset);
|
||||
cItemRec& operator = (legacy::item_record_type& old);
|
||||
void writeTo(ostream& file, string prefix = "");
|
||||
void readAttrFrom(string cur, istream& sin);
|
||||
void writeTo(std::ostream& file, std::string prefix = "");
|
||||
void readAttrFrom(std::string cur, std::istream& sin);
|
||||
};
|
||||
|
||||
ostream& operator << (ostream& out, eWeapType& e);
|
||||
ostream& operator << (ostream& out, eItemType& e);
|
||||
ostream& operator << (ostream& out, eItemAbil& e);
|
||||
istream& operator >> (istream& in, eWeapType& e);
|
||||
istream& operator >> (istream& in, eItemType& e);
|
||||
istream& operator >> (istream& in, eItemAbil& e);
|
||||
std::ostream& operator << (std::ostream& out, eWeapType& e);
|
||||
std::ostream& operator << (std::ostream& out, eItemType& e);
|
||||
std::ostream& operator << (std::ostream& out, eItemAbil& e);
|
||||
std::istream& operator >> (std::istream& in, eWeapType& e);
|
||||
std::istream& operator >> (std::istream& in, eItemType& e);
|
||||
std::istream& operator >> (std::istream& in, eItemAbil& e);
|
||||
|
||||
/*
|
||||
typedef struct {
|
||||
@@ -254,3 +259,5 @@ istream& operator >> (istream& in, eItemAbil& e);
|
||||
unsigned char magic_use_type, ability_strength, treas_class, real_abil;
|
||||
} short_item_record_type;
|
||||
*/
|
||||
|
||||
#endif
|
||||
@@ -6,7 +6,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef LOCATION_H
|
||||
#define LOCATION_H
|
||||
|
||||
struct rectangle;
|
||||
|
||||
@@ -43,3 +44,5 @@ location loc();
|
||||
rectangle rect();
|
||||
rectangle rect(location tl, location br);
|
||||
rectangle rect(char top, char left, char bottom, char right);
|
||||
|
||||
#endif
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "classes.h"
|
||||
#include "oldstructs.h"
|
||||
@@ -58,7 +58,7 @@ cMonster& cMonster::operator = (legacy::monster_record_type& old){
|
||||
res2 = old.res2;
|
||||
res3 = old.res3;
|
||||
picture_num = old.picture_num;
|
||||
if(picture_num = 122) picture_num = 119;
|
||||
if(picture_num == 122) picture_num = 119;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MONSTER_H
|
||||
#define MONSTER_H
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
namespace legacy {
|
||||
struct monster_record_type;
|
||||
struct creature_data_type;
|
||||
@@ -109,7 +115,7 @@ class cMonster {
|
||||
public:
|
||||
unsigned short m_num;
|
||||
unsigned char level;
|
||||
string m_name;
|
||||
std::string m_name;
|
||||
short health,m_health,mp,max_mp;
|
||||
unsigned char armor,skill;
|
||||
short a[3];
|
||||
@@ -125,7 +131,7 @@ public:
|
||||
short picture_num;
|
||||
|
||||
cMonster& operator = (legacy::monster_record_type& old);
|
||||
void writeTo(ostream& file, string prefix);
|
||||
void writeTo(std::ostream& file, std::string prefix);
|
||||
};
|
||||
|
||||
class cCreature {
|
||||
@@ -152,3 +158,5 @@ public:
|
||||
cCreature& operator = (legacy::creature_data_type old);
|
||||
cCreature& operator = (legacy::creature_start_type old);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "classes.h"
|
||||
#include "oldstructs.h"
|
||||
@@ -49,8 +49,8 @@ cOutdoors& cOutdoors::operator = (legacy::outdoor_record_type& old){
|
||||
// special_enc[i].monst[j] = old.special_enc[i].monst[j];
|
||||
// }
|
||||
// for(j = 0; j < 3; j++){
|
||||
// wandering[i].friendly[j] = old.wandering[i].friendly[j];
|
||||
// special_enc[i].friendly[j] = old.special_enc[i].friendly[j];
|
||||
// wandering[i].fristd::endly[j] = old.wandering[i].fristd::endly[j];
|
||||
// special_enc[i].fristd::endly[j] = old.special_enc[i].fristd::endly[j];
|
||||
// }
|
||||
// wandering[i].spec_on_meet = old.wandering[i].spec_on_meet;
|
||||
// special_enc[i].spec_on_meet = old.special_enc[i].spec_on_meet;
|
||||
@@ -145,29 +145,29 @@ cOutdoors::cCreature& cOutdoors::cCreature::operator = (legacy::outdoor_creature
|
||||
return *this;
|
||||
}
|
||||
|
||||
void cOutdoors::writeTo(ostream& file){
|
||||
void cOutdoors::writeTo(std::ostream& file){
|
||||
// for(int i = 0; i < 48; i++){
|
||||
// file << expl[i][0];
|
||||
// for(int j = 1; j < 48; j++){
|
||||
// file << '\t' << expl[i][j];
|
||||
// }
|
||||
// file << endl;
|
||||
// file << std::endl;
|
||||
// }
|
||||
}
|
||||
|
||||
void cOutdoors::cWandering::writeTo(ostream& file, string prefix){
|
||||
void cOutdoors::cWandering::writeTo(std::ostream& file, std::string prefix){
|
||||
for(int i = 0; i < 7; i++)
|
||||
file << prefix << "HOSTILE " << i << ' ' << monst[i] << endl;
|
||||
file << prefix << "HOSTILE " << i << ' ' << monst[i] << std::endl;
|
||||
for(int i = 0; i < 3; i++)
|
||||
file << prefix << "FRIEND " << i << ' ' << friendly[i] << endl;
|
||||
file << prefix << "MEET " << spec_on_meet << endl;
|
||||
file << prefix << "WIN " << spec_on_win << endl;
|
||||
file << prefix << "FLEE " << spec_on_flee << endl;
|
||||
file << prefix << "FLAGS " << cant_flee << endl;
|
||||
file << prefix << "SDF " << end_spec1 << ' ' << end_spec2 << endl;
|
||||
file << prefix << "FRIEND " << i << ' ' << friendly[i] << std::endl;
|
||||
file << prefix << "MEET " << spec_on_meet << std::endl;
|
||||
file << prefix << "WIN " << spec_on_win << std::endl;
|
||||
file << prefix << "FLEE " << spec_on_flee << std::endl;
|
||||
file << prefix << "FLAGS " << cant_flee << std::endl;
|
||||
file << prefix << "SDF " << end_spec1 << ' ' << end_spec2 << std::endl;
|
||||
}
|
||||
|
||||
void cOutdoors::cWandering::readAttrFrom(string cur, istream& sin){
|
||||
void cOutdoors::cWandering::readAttrFrom(std::string cur, std::istream& sin){
|
||||
if(cur == "HOSTILE"){
|
||||
int i;
|
||||
sin >> i;
|
||||
|
||||
@@ -6,7 +6,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef OUTDOORS_H
|
||||
#define OUTDOORS_H
|
||||
|
||||
#include "location.h"
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
namespace legacy {
|
||||
struct out_wandering_type;
|
||||
@@ -24,8 +29,8 @@ public:
|
||||
short end_spec1,end_spec2;
|
||||
|
||||
cWandering& operator = (legacy::out_wandering_type old);
|
||||
void writeTo(ostream& file, string prefix = "");
|
||||
void readAttrFrom(string cur, istream& sin);
|
||||
void writeTo(std::ostream& file, std::string prefix = "");
|
||||
void readAttrFrom(std::string cur, std::istream& sin);
|
||||
};
|
||||
class cCreature { // formerly outdoor_creature_type
|
||||
public:
|
||||
@@ -58,5 +63,7 @@ public:
|
||||
|
||||
cOutdoors();
|
||||
cOutdoors& operator = (legacy::outdoor_record_type& old);
|
||||
void writeTo(ostream& file);
|
||||
void writeTo(std::ostream& file);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "classes.h"
|
||||
#include "oldstructs.h"
|
||||
@@ -153,7 +153,7 @@ void cParty::add_pc(cPlayer new_pc){
|
||||
}
|
||||
|
||||
bool cParty::has_talk_save(short who, short str1, short str2){
|
||||
for (int j = 0; j < talk_save.size(); j++)
|
||||
for (unsigned int j = 0; j < talk_save.size(); j++)
|
||||
if ((talk_save[j].personality == who) && (talk_save[j].str_num1 == str1) && (talk_save[j].str_num2 == str2))
|
||||
return true;
|
||||
return false;
|
||||
@@ -198,27 +198,28 @@ bool cParty::start_timer(short time, short node, short type){
|
||||
t.global_or_town = type;
|
||||
t.node_to_call = node;
|
||||
party_event_timers.push_back(t);
|
||||
return(true);
|
||||
}
|
||||
|
||||
void cParty::writeTo(ostream& file){
|
||||
file << "AGE " << age << endl;
|
||||
file << "GOLD " << gold << endl;
|
||||
file << "FOOD " << food << endl;
|
||||
void cParty::writeTo(std::ostream& file){
|
||||
file << "AGE " << age << std::endl;
|
||||
file << "GOLD " << gold << std::endl;
|
||||
file << "FOOD " << food << std::endl;
|
||||
for(int i = 0; i < 310; i++)
|
||||
for(int j = 0; j < 50; j++)
|
||||
if(stuff_done[i][j] > 0)
|
||||
file << "SDF " << i << ' ' << j << ' ' << stuff_done[i][j] << endl;
|
||||
file << "SDF " << i << ' ' << j << ' ' << stuff_done[i][j] << std::endl;
|
||||
for(int i = 0; i < 200; i++)
|
||||
if(item_taken[i][0] > 0 || item_taken[i][1] > 0 || item_taken[i][2] > 0 || item_taken[i][3] > 0 ||
|
||||
item_taken[i][4] > 0 || item_taken[i][5] > 0 || item_taken[i][6] > 0 || item_taken[i][7] > 0)
|
||||
file << "ITEMTAKEN " << i << ' ' << item_taken[i][0] << ' ' << item_taken[i][1] << ' '
|
||||
<< item_taken[i][2] << ' ' << item_taken[i][3] << ' ' << item_taken[i][4] << ' ' << item_taken[i][5]
|
||||
<< ' ' << item_taken[i][6] << ' ' << item_taken[i][7] << endl;
|
||||
file << "LIGHT " << light_level << endl;
|
||||
file << "OUTCORNER " << outdoor_corner.x << ' ' << outdoor_corner.y << endl;
|
||||
file << "INWHICHCORNER " << i_w_c.x << ' ' << i_w_c.y << endl;
|
||||
file << "SECTOR " << p_loc.x << ' ' << p_loc.y << endl;
|
||||
file << "LOCINSECTOR " << loc_in_sec.x << ' ' << loc_in_sec.y << endl;
|
||||
<< ' ' << item_taken[i][6] << ' ' << item_taken[i][7] << std::endl;
|
||||
file << "LIGHT " << light_level << std::endl;
|
||||
file << "OUTCORNER " << outdoor_corner.x << ' ' << outdoor_corner.y << std::endl;
|
||||
file << "INWHICHCORNER " << i_w_c.x << ' ' << i_w_c.y << std::endl;
|
||||
file << "SECTOR " << p_loc.x << ' ' << p_loc.y << std::endl;
|
||||
file << "LOCINSECTOR " << loc_in_sec.x << ' ' << loc_in_sec.y << std::endl;
|
||||
// TODO: Delegate this to the cVehicle class
|
||||
for(int i = 0; i < 30; i++){
|
||||
if(!boats[i].exists) continue;
|
||||
@@ -226,7 +227,7 @@ void cParty::writeTo(ostream& file){
|
||||
file << boats[i].loc.x << ' ' << boats[i].loc.y << ' ';
|
||||
file << boats[i].loc_in_sec.x << ' ' << boats[i].loc_in_sec.y << ' ';
|
||||
file << boats[i].sector.x << ' ' << boats[i].sector.y << ' ';
|
||||
file << boats[i].which_town << ' ' << (short)boats[i].property << endl;
|
||||
file << boats[i].which_town << ' ' << (short)boats[i].property << std::endl;
|
||||
}
|
||||
for(int i = 0; i < 30; i++){
|
||||
if(!horses[i].exists) continue;
|
||||
@@ -234,77 +235,77 @@ void cParty::writeTo(ostream& file){
|
||||
file << horses[i].loc.x << ' ' << horses[i].loc.y << ' ';
|
||||
file << horses[i].loc_in_sec.x << ' ' << horses[i].loc_in_sec.y << ' ';
|
||||
file << horses[i].sector.x << ' ' << horses[i].sector.y << ' ';
|
||||
file << horses[i].which_town << ' ' << (short)horses[i].property << endl;
|
||||
file << horses[i].which_town << ' ' << (short)horses[i].property << std::endl;
|
||||
}
|
||||
file << "IN " << in_boat << ' ' << in_horse << endl;
|
||||
file << "IN " << in_boat << ' ' << in_horse << std::endl;
|
||||
for(int i = 0; i < 5; i++)
|
||||
for(int j = 0; j < 50; j++)
|
||||
if(magic_store_items[i][j].variety > ITEM_TYPE_NO_ITEM){
|
||||
ostringstream sout;
|
||||
std::ostringstream sout;
|
||||
sout << "MAGICSTORE " << i << ' ' << j << ' ';
|
||||
magic_store_items[i][j].writeTo(file, sout.str());
|
||||
}
|
||||
for(int i = 0; i < 256; i++)
|
||||
if(m_seen[i])
|
||||
file << "ROSTER " << i << endl;
|
||||
file << "ROSTER " << i << std::endl;
|
||||
for(int i = 0; i < 10; i++)
|
||||
if(out_c[i].exists){
|
||||
file << "ENCOUNTER " << i << " DIRECTION " << out_c[i].direction << endl;
|
||||
file << "ENCOUNTER " << i << " SECTOR " << out_c[i].which_sector.x << ' ' << out_c[i].which_sector.y << endl;
|
||||
file << "ENCOUNTER " << i << " LOCINSECTOR " << out_c[i].m_loc.x << ' ' << out_c[i].m_loc.y << endl;
|
||||
file << "ENCOUNTER " << i << " HOME " << out_c[i].home_sector.x << ' ' << out_c[i].home_sector.y << endl;
|
||||
ostringstream sout;
|
||||
file << "ENCOUNTER " << i << " DIRECTION " << out_c[i].direction << std::endl;
|
||||
file << "ENCOUNTER " << i << " SECTOR " << out_c[i].which_sector.x << ' ' << out_c[i].which_sector.y << std::endl;
|
||||
file << "ENCOUNTER " << i << " LOCINSECTOR " << out_c[i].m_loc.x << ' ' << out_c[i].m_loc.y << std::endl;
|
||||
file << "ENCOUNTER " << i << " HOME " << out_c[i].home_sector.x << ' ' << out_c[i].home_sector.y << std::endl;
|
||||
std::ostringstream sout;
|
||||
sout << "ENCOUNTER " << i << ' ';
|
||||
out_c[i].what_monst.writeTo(file,sout.str());
|
||||
}
|
||||
for(int i = 0; i < 4; i++)
|
||||
if(imprisoned_monst[i] > 0)
|
||||
file << "SOULCRYSTAL " << i << ' ' << imprisoned_monst[i] << endl;
|
||||
file << "DIRECTION " << direction << endl;
|
||||
file << "WHICHSLOT " << at_which_save_slot << endl;
|
||||
file << "SOULCRYSTAL " << i << ' ' << imprisoned_monst[i] << std::endl;
|
||||
file << "DIRECTION " << direction << std::endl;
|
||||
file << "WHICHSLOT " << at_which_save_slot << std::endl;
|
||||
for(int i = 0; i < 20; i++)
|
||||
if(alchemy[i])
|
||||
file << "ALCHEMY " << i << endl;
|
||||
file << "ALCHEMY " << i << std::endl;
|
||||
for(int i = 0; i < 200; i++)
|
||||
if(can_find_town[i])
|
||||
file << "TOWN " << i << endl;
|
||||
file << "TOWN " << i << std::endl;
|
||||
for(int i = 0; i < 100; i++)
|
||||
if(key_times[i])
|
||||
file << "EVENT " << i << ' ' << key_times[i] << endl;
|
||||
file << "EVENT " << i << ' ' << key_times[i] << std::endl;
|
||||
for(int i = 0; i < 50; i++)
|
||||
if(spec_items[i])
|
||||
file << "ITEM " << i << endl;
|
||||
file << "ITEM " << i << std::endl;
|
||||
for(int i = 0; i < 120; i++)
|
||||
if(help_received[i])
|
||||
file << "HELP " << i << endl;
|
||||
file << "HELP " << i << std::endl;
|
||||
for(int i = 0; i < 200; i++)
|
||||
if(m_killed[i] > 0)
|
||||
file << "TOWNSLAUGHTER " << i << ' ' << m_killed[i] << endl;
|
||||
file << "KILLS " << total_m_killed << endl;
|
||||
file << "DAMAGE " << total_dam_done << endl;
|
||||
file << "WOUNDS " << total_dam_taken << endl;
|
||||
file << "EXPERIENCE " << total_xp_gained << endl;
|
||||
file << "SCENARIO " << scen_name << endl;
|
||||
file << "WON " << scen_won << endl;
|
||||
file << "PLAYED " << scen_played << endl;
|
||||
file << "TOWNSLAUGHTER " << i << ' ' << m_killed[i] << std::endl;
|
||||
file << "KILLS " << total_m_killed << std::endl;
|
||||
file << "DAMAGE " << total_dam_done << std::endl;
|
||||
file << "WOUNDS " << total_dam_taken << std::endl;
|
||||
file << "EXPERIENCE " << total_xp_gained << std::endl;
|
||||
file << "SCENARIO " << scen_name << std::endl;
|
||||
file << "WON " << scen_won << std::endl;
|
||||
file << "PLAYED " << scen_played << std::endl;
|
||||
for(campIter iter = campaign_flags.begin(); iter != campaign_flags.end(); iter++){
|
||||
for(int i = 0; i < iter->second.size(); i++)
|
||||
for(unsigned int i = 0; i < iter->second.size(); i++)
|
||||
if(iter->second[i] > 0)
|
||||
file << "CAMPAIGN \"" << iter->first << "\" " << i << ' ' << iter->second[i] << endl;
|
||||
file << "CAMPAIGN \"" << iter->first << "\" " << i << ' ' << iter->second[i] << std::endl;
|
||||
}
|
||||
for(int i = 0; i < 250; i++)
|
||||
for(unsigned int i = 0; i < 250; i++)
|
||||
if(graphicUsed[i])
|
||||
file << "GRAPHIC " << i << endl;
|
||||
for(int i = 0; i < party_event_timers.size(); i++)
|
||||
file << "GRAPHIC " << i << std::endl;
|
||||
for(unsigned int i = 0; i < party_event_timers.size(); i++)
|
||||
file << "TIMER " << i << ' ' << party_event_timers[i].time << ' ' << party_event_timers[i].global_or_town
|
||||
<< ' ' << party_event_timers[i].node_to_call << endl;
|
||||
<< ' ' << party_event_timers[i].node_to_call << std::endl;
|
||||
file << '\f';
|
||||
for(int i = 0; i < 4; i++){
|
||||
for(int j = 0; j < 64; j++){
|
||||
file << setup[i][j][0];
|
||||
for(int k = 1; k < 64; k++)
|
||||
file << '\t' << setup[i][j][k];
|
||||
file << endl;
|
||||
file << std::endl;
|
||||
}
|
||||
file << '\f';
|
||||
}
|
||||
@@ -314,10 +315,10 @@ void cParty::writeTo(ostream& file){
|
||||
// TODO: summons
|
||||
}
|
||||
|
||||
void cParty::readFrom(istream& file){
|
||||
void cParty::readFrom(std::istream& file){
|
||||
// TODO: Error-check input
|
||||
istringstream bin, sin;
|
||||
string cur;
|
||||
std::istringstream bin, sin;
|
||||
std::string cur;
|
||||
getline(file, cur, '\f');
|
||||
bin.str(cur);
|
||||
while(bin) { // continue as long as no error, such as eof, occurs
|
||||
@@ -430,7 +431,8 @@ void cParty::readFrom(istream& file){
|
||||
else if(cur == "PLAYED")
|
||||
sin >> scen_played;
|
||||
else if(cur == "CAMPAIGN"){
|
||||
int i,j;
|
||||
unsigned int i;
|
||||
int j;
|
||||
if(sin.peek() == '"'){
|
||||
sin.get();
|
||||
getline(sin, cur, '"');
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PARTY_H
|
||||
#define PARTY_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
using namespace std;
|
||||
|
||||
namespace legacy {
|
||||
struct party_record_type;
|
||||
@@ -28,7 +30,7 @@ public:
|
||||
short personality;
|
||||
short town_num;
|
||||
short str_num1, str_num2;
|
||||
string who_said, in_town, the_str1, the_str2, in_scen; // the actual strings; not always saved, like maps
|
||||
std::string who_said, in_town, the_str1, the_str2, in_scen; // the actual strings; not always saved, like maps
|
||||
|
||||
cConvers& operator = (legacy::talk_save_type old);
|
||||
};
|
||||
@@ -36,12 +38,12 @@ public:
|
||||
public:
|
||||
unsigned short str_num;
|
||||
unsigned short day;
|
||||
string the_str, in_scen; // the actual strings; not always saved, like maps
|
||||
std::string the_str, in_scen; // the actual strings; not always saved, like maps
|
||||
};
|
||||
class cEncNote {
|
||||
public:
|
||||
unsigned short str_num, where;
|
||||
string the_str1, the_str2, in_scen; // the actual strings; not always saved, like maps
|
||||
std::string the_str1, the_str2, in_scen; // the actual strings; not always saved, like maps
|
||||
};
|
||||
class cTimer {
|
||||
public:
|
||||
@@ -69,22 +71,22 @@ public:
|
||||
cItemRec magic_store_items[5][10];
|
||||
short imprisoned_monst[4]; // Soul Crystal?
|
||||
char m_seen[256];
|
||||
vector<cJournal> journal;
|
||||
vector<cEncNote> special_notes;
|
||||
vector<cConvers> talk_save;
|
||||
std::vector<cJournal> journal;
|
||||
std::vector<cEncNote> special_notes;
|
||||
std::vector<cConvers> talk_save;
|
||||
short direction;
|
||||
short at_which_save_slot;
|
||||
char alchemy[20];
|
||||
bool can_find_town[200];
|
||||
short key_times[100];
|
||||
vector<cTimer> party_event_timers;
|
||||
std::vector<cTimer> party_event_timers;
|
||||
//short global_or_town[30];
|
||||
//short node_to_call[30];
|
||||
char spec_items[50];
|
||||
char help_received[120];
|
||||
short m_killed[200]; // monsters killed per town, I think
|
||||
long long total_m_killed, total_dam_done, total_xp_gained, total_dam_taken;
|
||||
string scen_name;
|
||||
std::string scen_name;
|
||||
|
||||
cPlayer adven[6];
|
||||
|
||||
@@ -95,7 +97,7 @@ public:
|
||||
cMonster summons; // an array of monsters which can be summoned by the parties items yet don't originate from this scenario
|
||||
bool graphicUsed[250]; // whether each custom graphics slot on the party's sheet is actually used; needed to place new custom graphics on the sheet.
|
||||
unsigned short scen_won, scen_played; // numbers of scenarios won and played respectively by this party
|
||||
map<string,vector<int> > campaign_flags;
|
||||
std::map<std::string,std::vector<int> > campaign_flags;
|
||||
|
||||
cParty& operator = (legacy::party_record_type& old);
|
||||
void append(legacy::big_tr_type& old);
|
||||
@@ -111,11 +113,13 @@ public:
|
||||
bool record(short what, short where);
|
||||
bool start_timer(short time, short node, short type);
|
||||
|
||||
typedef vector<cEncNote>::iterator encIter;
|
||||
typedef vector<cJournal>::iterator journalIter;
|
||||
typedef vector<cConvers>::iterator talkIter;
|
||||
typedef vector<cTimer>::iterator timerIter;
|
||||
typedef map<string,vector<int> >::iterator campIter;
|
||||
void writeTo(ostream& file);
|
||||
void readFrom(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
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "classes.h"
|
||||
#include "oldstructs.h"
|
||||
@@ -246,49 +246,49 @@ void operator -= (eMainStatus& stat, eMainStatus othr){
|
||||
stat = (eMainStatus) (-10 + stat);
|
||||
}
|
||||
|
||||
void cPlayer::writeTo(ostream& file){
|
||||
file << "STATUS -1 " << main_status << endl;
|
||||
file << "NAME " << name << endl;
|
||||
file << "SKILL -2 " << max_health << endl;
|
||||
file << "SKILL -1 " << max_sp << endl;
|
||||
void cPlayer::writeTo(std::ostream& file){
|
||||
file << "STATUS -1 " << main_status << std::endl;
|
||||
file << "NAME " << name << std::endl;
|
||||
file << "SKILL -2 " << max_health << std::endl;
|
||||
file << "SKILL -1 " << max_sp << std::endl;
|
||||
for(int i = 0; i < 30; i++)
|
||||
if(skills[i] > 0)
|
||||
file << "SKILL " << i << ' ' << skills[i] << endl;
|
||||
file << "HEALTH " << cur_health << endl;
|
||||
file << "MANA " << cur_sp << endl;
|
||||
file << "EXPERIENCE " << experience << endl;
|
||||
file << "SKILLPTS " << skill_pts << endl;
|
||||
file << "LEVEL " << level << endl;
|
||||
file << "SKILL " << i << ' ' << skills[i] << std::endl;
|
||||
file << "HEALTH " << cur_health << std::endl;
|
||||
file << "MANA " << cur_sp << std::endl;
|
||||
file << "EXPERIENCE " << experience << std::endl;
|
||||
file << "SKILLPTS " << skill_pts << std::endl;
|
||||
file << "LEVEL " << level << std::endl;
|
||||
for(int i = 0; i < 15; i++)
|
||||
if(status[i] != 0)
|
||||
file << "STATUS " << i << ' ' << status[i] << endl;
|
||||
file << "STATUS " << i << ' ' << status[i] << std::endl;
|
||||
for(int i; i < 24; i++)
|
||||
if(items[i].variety > ITEM_TYPE_NO_ITEM){
|
||||
ostringstream sout;
|
||||
std::ostringstream sout;
|
||||
sout << "ITEM " << i << ' ';
|
||||
items[i].writeTo(file, sout.str());
|
||||
}
|
||||
for(int i = 0; i < 24; i++)
|
||||
if(equip[i])
|
||||
file << "EQUIP " << i << endl;
|
||||
file << "EQUIP " << i << std::endl;
|
||||
for(int i = 0; i < 62; i++)
|
||||
if(mage_spells[i])
|
||||
file << "MAGE " << i << endl;
|
||||
file << "MAGE " << i << std::endl;
|
||||
for(int i = 0; i < 62; i++)
|
||||
if(priest_spells[i])
|
||||
file << "PRIEST " << i << endl;
|
||||
file << "PRIEST " << i << std::endl;
|
||||
for(int i = 0; i < 62; i++)
|
||||
if(traits[i])
|
||||
file << "TRAIT " << i << endl;
|
||||
file << "ICON " << which_graphic << endl;
|
||||
file << "RACE " << race << endl;
|
||||
file << "DIRECTION " << direction << endl;
|
||||
file << "POISON " << weap_poisoned << endl;
|
||||
file << "TRAIT " << i << std::endl;
|
||||
file << "ICON " << which_graphic << std::endl;
|
||||
file << "RACE " << race << std::endl;
|
||||
file << "DIRECTION " << direction << std::endl;
|
||||
file << "POISON " << weap_poisoned << std::endl;
|
||||
}
|
||||
|
||||
void cPlayer::readFrom(istream& file){
|
||||
istringstream bin, sin;
|
||||
string cur;
|
||||
void cPlayer::readFrom(std::istream& file){
|
||||
std::istringstream bin, sin;
|
||||
std::string cur;
|
||||
getline(file, cur, '\f');
|
||||
bin.str(cur);
|
||||
while(bin) { // continue as long as no error, such as eof, occurs
|
||||
@@ -360,11 +360,11 @@ void cPlayer::readFrom(istream& file){
|
||||
}
|
||||
}
|
||||
|
||||
ostream& operator << (ostream& out, eMainStatus& e){
|
||||
std::ostream& operator << (std::ostream& out, eMainStatus& e){
|
||||
return out << (int) e;
|
||||
}
|
||||
|
||||
istream& operator >> (istream& in, eMainStatus& e){
|
||||
std::istream& operator >> (std::istream& in, eMainStatus& e){
|
||||
int i;
|
||||
in >> i;
|
||||
if(i > 0 && i < 18 && i !=8 && i != 9)
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PC_H
|
||||
#define PC_H
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
namespace legacy { struct pc_record_type; };
|
||||
|
||||
@@ -33,7 +38,7 @@ enum eMainStatus {
|
||||
class cPlayer {
|
||||
public:
|
||||
eMainStatus main_status;
|
||||
string name;
|
||||
std::string name;
|
||||
short skills[30];
|
||||
unsigned short max_health;
|
||||
short cur_health;
|
||||
@@ -60,11 +65,13 @@ public:
|
||||
cPlayer();
|
||||
cPlayer(long key,short slot);
|
||||
short get_tnl();
|
||||
void writeTo(ostream& file);
|
||||
void readFrom(istream& file);
|
||||
void writeTo(std::ostream& file);
|
||||
void readFrom(std::istream& file);
|
||||
};
|
||||
|
||||
void operator += (eMainStatus& stat, eMainStatus othr);
|
||||
void operator -= (eMainStatus& stat, eMainStatus othr);
|
||||
ostream& operator << (ostream& out, eMainStatus& e);
|
||||
istream& operator >> (istream& in, eMainStatus& e);
|
||||
std::ostream& operator << (std::ostream& out, eMainStatus& e);
|
||||
std::istream& operator >> (std::istream& in, eMainStatus& e);
|
||||
|
||||
#endif
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "classes.h"
|
||||
#include "oldstructs.h"
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef REGTOWN_H
|
||||
#define REGTOWN_H
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace legacy {
|
||||
struct big_tr_type;
|
||||
struct ave_tr_type;
|
||||
@@ -28,7 +33,7 @@ public:
|
||||
short max_monst();
|
||||
|
||||
cBigTown();
|
||||
void writeTo(ostream& file);
|
||||
void writeTo(std::ostream& file);
|
||||
};
|
||||
|
||||
class cMedTown : public cTown { // formerly ave_tr_type
|
||||
@@ -47,7 +52,7 @@ public:
|
||||
short max_monst();
|
||||
|
||||
cMedTown();
|
||||
void writeTo(ostream& file);
|
||||
void writeTo(std::ostream& file);
|
||||
};
|
||||
|
||||
class cTinyTown : public cTown { // formerly tiny_tr_type
|
||||
@@ -66,5 +71,7 @@ public:
|
||||
short max_monst();
|
||||
|
||||
cTinyTown();
|
||||
void writeTo(ostream& file);
|
||||
void writeTo(std::ostream& file);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "classes.h"
|
||||
#include "oldstructs.h"
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SCENARIO_H
|
||||
#define SCENARIO_H
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace legacy{
|
||||
struct scenario_data_type;
|
||||
struct item_storage_shortcut_type;
|
||||
@@ -87,5 +92,7 @@ public:
|
||||
char(& scen_strs(short i))[256];
|
||||
cScenario& operator = (legacy::scenario_data_type& old);
|
||||
void append(legacy::scen_item_data_type& old);
|
||||
void writeTo(ostream& file);
|
||||
void writeTo(std::ostream& file);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "classes.h"
|
||||
#include "oldstructs.h"
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SPECIAL_H
|
||||
#define SPECIAL_H
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace legacy { struct special_node_type; };
|
||||
|
||||
class cSpecial {
|
||||
@@ -24,5 +29,7 @@ public:
|
||||
|
||||
cSpecial();
|
||||
cSpecial& operator = (legacy::special_node_type& old);
|
||||
void writeTo(ostream& file);
|
||||
void writeTo(std::ostream& file);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "classes.h"
|
||||
#include "oldstructs.h"
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TALKING_H
|
||||
#define TALKING_H
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace legacy {
|
||||
struct talking_record_type;
|
||||
struct talking_node_type;
|
||||
@@ -24,5 +29,7 @@ public:
|
||||
cNode talk_nodes[60];
|
||||
|
||||
cSpeech& operator = (legacy::talking_record_type& old);
|
||||
void writeTo(ostream& file);
|
||||
void writeTo(std::ostream& file);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "classes.h"
|
||||
#include "oldstructs.h"
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TERRAIN_H
|
||||
#define TERRAIN_H
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
namespace legacy { struct terrain_type_type; };
|
||||
|
||||
/* Terrains Specials Properties : scenario.ter_types[i].special */ //complete
|
||||
@@ -99,7 +105,7 @@ enum eTrimType {
|
||||
|
||||
class cTerrain {
|
||||
public:
|
||||
string name;
|
||||
std::string name;
|
||||
short picture;
|
||||
unsigned char blockage;
|
||||
unsigned short flag1;
|
||||
@@ -123,5 +129,7 @@ public:
|
||||
unsigned short i; // for temporary use in porting
|
||||
|
||||
cTerrain& operator = (legacy::terrain_type_type& old);
|
||||
void writeTo(ostream& file);
|
||||
void writeTo(std::ostream& file);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "classes.h"
|
||||
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TMPLTOWN_H
|
||||
#define TMPLTOWN_H
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class cTemplTown {
|
||||
public:
|
||||
class cCityBlock { // formerly city_block_type
|
||||
@@ -24,7 +29,7 @@ public:
|
||||
};
|
||||
cCityBlock blocks[15];
|
||||
cTerRect ter_rects[10];
|
||||
void writeTo(ostream& file);
|
||||
void writeTo(std::ostream& file);
|
||||
};
|
||||
|
||||
class cBigTemplTown : public cBigTown, cTemplTown {
|
||||
@@ -40,7 +45,7 @@ public:
|
||||
unsigned char& lighting(size_t i, size_t r);
|
||||
short max_dim();
|
||||
short max_monst();
|
||||
void writeTo(ostream& file);
|
||||
void writeTo(std::ostream& file);
|
||||
};
|
||||
|
||||
class cMedTemplTown : public cMedTown, cTemplTown {
|
||||
@@ -56,7 +61,7 @@ public:
|
||||
unsigned char& lighting(size_t i, size_t r);
|
||||
short max_dim();
|
||||
short max_monst();
|
||||
void writeTo(ostream& file);
|
||||
void writeTo(std::ostream& file);
|
||||
};
|
||||
|
||||
class cTinyTemplTown : public cTinyTown, cTemplTown {
|
||||
@@ -95,3 +100,5 @@ public:
|
||||
// city_block_type city_block[15];
|
||||
// city_ter_rect_type city_ter_rect[10];
|
||||
//};
|
||||
|
||||
#endif
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "classes.h"
|
||||
#include "oldstructs.h"
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TOWN_H
|
||||
#define TOWN_H
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
namespace legacy {
|
||||
struct town_record_type;
|
||||
struct big_tr_type;
|
||||
@@ -68,7 +74,7 @@ public:
|
||||
rectangle in_town_rect;
|
||||
cItem preset_items[64];
|
||||
short max_num_monst;
|
||||
vector<cField> preset_fields;
|
||||
std::vector<cField> preset_fields;
|
||||
short spec_on_entry,spec_on_entry_if_dead;
|
||||
short timer_spec_times[8];
|
||||
short timer_specs[8];
|
||||
@@ -99,5 +105,7 @@ public:
|
||||
cTown();
|
||||
cTown(short size);
|
||||
cTown& operator = (legacy::town_record_type& old);
|
||||
void writeTo(ostream& file);
|
||||
void writeTo(std::ostream& file);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "classes.h"
|
||||
#include "oldstructs.h"
|
||||
@@ -667,13 +667,13 @@ unsigned short(& cCurOut::operator [] (size_t i))[96]{
|
||||
return out[i];
|
||||
}
|
||||
|
||||
void cCurOut::writeTo(ostream& file){
|
||||
void cCurOut::writeTo(std::ostream& file){
|
||||
// for(int i = 0; i < 96; i++){
|
||||
// file << expl[i][0];
|
||||
// for(int j = 1; j < 96; j++){
|
||||
// file << '\t' << expl[i][j];
|
||||
// }
|
||||
// file << endl;
|
||||
// file << std::endl;
|
||||
// }
|
||||
// file << '\f';
|
||||
// for(int i = 9; i < 96; i++){
|
||||
@@ -681,7 +681,7 @@ void cCurOut::writeTo(ostream& file){
|
||||
// for(int j = 1; j < 96; j++){
|
||||
// file << '\t' << out[i][j];
|
||||
// }
|
||||
// file << endl;
|
||||
// file << std::endl;
|
||||
// }
|
||||
// file << '\f';
|
||||
for(int i = 0; i < 96; i++){
|
||||
@@ -689,28 +689,28 @@ void cCurOut::writeTo(ostream& file){
|
||||
for(int j = 1; j < 96; j++){
|
||||
file << '\t' << out_e[i][j];
|
||||
}
|
||||
file << endl;
|
||||
file << std::endl;
|
||||
}
|
||||
// file << "OUTDOORS 0 0" << endl;
|
||||
// file << "OUTDOORS 0 0" << std::endl;
|
||||
// outdoors[0][0].writeTo(file);
|
||||
// file << "OUTDOORS 0 1" << endl;
|
||||
// file << "OUTDOORS 0 1" << std::endl;
|
||||
// outdoors[0][1].writeTo(file);
|
||||
// file << "OUTDOORS 1 0" << endl;
|
||||
// file << "OUTDOORS 1 0" << std::endl;
|
||||
// outdoors[1][0].writeTo(file);
|
||||
// file << "OUTDOORS 1 1" << endl;
|
||||
// file << "OUTDOORS 1 1" << std::endl;
|
||||
// outdoors[1][1].writeTo(file);
|
||||
// file << endl;
|
||||
// file << std::endl;
|
||||
}
|
||||
|
||||
void cCurTown::writeTo(ostream& file){
|
||||
file << "TOWN " << num << endl;
|
||||
file << "DIFFICULTY " << difficulty << endl;
|
||||
if(hostile) file << "HOSTILE" << endl;
|
||||
file << "INBOAT " << in_boat << endl;
|
||||
file << "AT " << p_loc.x << ' ' << p_loc.y << endl;
|
||||
void cCurTown::writeTo(std::ostream& file){
|
||||
file << "TOWN " << num << std::endl;
|
||||
file << "DIFFICULTY " << difficulty << std::endl;
|
||||
if(hostile) file << "HOSTILE" << std::endl;
|
||||
file << "INBOAT " << in_boat << std::endl;
|
||||
file << "AT " << p_loc.x << ' ' << p_loc.y << std::endl;
|
||||
for(int i; i < 115; i++)
|
||||
if(items[i].variety > ITEM_TYPE_NO_ITEM){
|
||||
ostringstream sout;
|
||||
std::ostringstream sout;
|
||||
sout << "ITEM " << i << ' ';
|
||||
items[i].writeTo(file, sout.str());
|
||||
}
|
||||
@@ -719,22 +719,22 @@ void cCurTown::writeTo(ostream& file){
|
||||
file << fields[i][0];
|
||||
for(int j = 1; j < 64; j++)
|
||||
file << '\t' << fields[i][j];
|
||||
file << endl;
|
||||
file << std::endl;
|
||||
}
|
||||
file << '\f' << record->max_dim() << endl;
|
||||
file << '\f' << record->max_dim() << std::endl;
|
||||
for(int i = 0; i < record->max_dim(); i++){
|
||||
file << record->terrain(i,0);
|
||||
for(int j = 1; j < record->max_dim(); j++)
|
||||
file << '\t' << record->terrain(i,j);
|
||||
file << endl;
|
||||
file << std::endl;
|
||||
}
|
||||
file << '\f';
|
||||
// TODO: Write population
|
||||
}
|
||||
|
||||
void cCurTown::readFrom(istream& file){
|
||||
istringstream bin, sin;
|
||||
string cur;
|
||||
void cCurTown::readFrom(std::istream& file){
|
||||
std::istringstream bin, sin;
|
||||
std::string cur;
|
||||
getline(file, cur, '\f');
|
||||
bin.str(cur);
|
||||
while(bin){
|
||||
@@ -785,7 +785,7 @@ void cCurTown::readFrom(istream& file){
|
||||
}
|
||||
|
||||
|
||||
void cCurOut::readFrom(istream& file){
|
||||
void cCurOut::readFrom(std::istream& file){
|
||||
for(int i = 0; i < 96; i++)
|
||||
for(int j = 1; j < 96; j++)
|
||||
file >> out_e[i][j];
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef UNIVERSE_H
|
||||
#define UNIVERSE_H
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace legacy {
|
||||
struct out_info_type;
|
||||
struct current_town_type;
|
||||
@@ -102,8 +107,8 @@ public:
|
||||
bool set_bones(char x, char y, bool b);
|
||||
bool set_rubble(char x, char y, bool b);
|
||||
// bool set_trim(char x, char y, char t, bool b);
|
||||
void writeTo(ostream& file);
|
||||
void readFrom(istream& file);
|
||||
void writeTo(std::ostream& file);
|
||||
void readFrom(std::istream& file);
|
||||
};
|
||||
|
||||
class cCurOut {
|
||||
@@ -119,8 +124,8 @@ public:
|
||||
void append(legacy::out_info_type& old);
|
||||
|
||||
unsigned short(& operator [] (size_t i))[96];
|
||||
void writeTo(ostream& file);
|
||||
void readFrom(istream& file);
|
||||
void writeTo(std::ostream& file);
|
||||
void readFrom(std::istream& file);
|
||||
};
|
||||
|
||||
class cUniverse{
|
||||
@@ -135,3 +140,5 @@ public:
|
||||
void append(legacy::stored_town_maps_type& old);
|
||||
void append(legacy::stored_outdoor_maps_type& old);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "classes.h"
|
||||
#include "oldstructs.h"
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef VEHICLE_H
|
||||
#define VEHICLE_H
|
||||
|
||||
#include <iostream>
|
||||
#include "location.h"
|
||||
|
||||
namespace legacy {
|
||||
@@ -27,7 +31,7 @@ public:
|
||||
cVehicle();
|
||||
cVehicle& operator = (legacy::horse_record_type& old);
|
||||
cVehicle& operator = (legacy::boat_record_type& old);
|
||||
void writeTo(ostream& file);
|
||||
void writeTo(std::ostream& file);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -42,3 +46,5 @@ typedef struct {
|
||||
bool exists,property;
|
||||
} boat_record_type;
|
||||
*/
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user