Files
oboe/osx/classes/outdoors.h
Celtic Minstrel 4b96f579b7 Embark on an epic journey to make both the game and the two editors load the entire scenario into memory.
Some other tweaks and fixes got pulled in along the way.
Details:
- Improved const-correctness
- The scenario is now part of the universe, so now there's no global scenario object in the game or the PC editor. (Of course, the scenario editor has no universe, so it still has a global scenario object.)
- Towns and outdoors now store a reference to the scenario; the party, current town, and current outdoors store a reference to the universe. Altogether this means that the data module has no need for global scenario or universe objects.
- The fileio routines now take a scenario or universe reference as a parameter, so they don't need the global scenario or universe objects either.
- cCurOut now has an arrow operator for accessing the current outdoor section, instead of a 2x2 subset of the outdoors; this replaces using i_w_c to index the 2x2 subset. (And it's much less verbose!)
- cCurTown no longer stores a pointer to the town record, since it can simply access it through the universe instance which it stores a reference to.
- Tweaked how the monster roster menu works (it now caches up to 60 monsters)
- The operator= functions that convert from legacy to new scenario/save format are now ordinary functions rather than operators.
- The bizarre use of assigning a cCreature to itself to populate certain fields has been nuked.
- When at the corner of an outdoor sector, the scenario editor now shows the cornermost terrain in the diagonally adjacent sector.
- There was a missing check to prevent horses entering dangerous terrain (eg, swamp) while in town.
- Fix cancelling load party dialog causing a party to appear
2014-12-22 00:20:37 -05:00

80 lines
1.9 KiB
C++

/*
* outdoors.h
* BoE
*
* Created by Celtic Minstrel on 22/04/09.
*
*/
#ifndef BOE_DATA_OUTDOORS_H
#define BOE_DATA_OUTDOORS_H
#include <string>
#include <iosfwd>
#include <array>
#include "location.h"
#include "special.h"
#include "simpletypes.h"
#include "monster.h"
namespace legacy {
struct out_wandering_type;
struct outdoor_record_type;
struct outdoor_creature_type;
};
class cScenario;
class cOutdoors {
cScenario& scenario;
public:
class cWandering { // formerly out_wandering_type
public:
m_num_t monst[7];
m_num_t friendly[3];
short spec_on_meet,spec_on_win,spec_on_flee,cant_flee;
short end_spec1,end_spec2;
bool isNull();
void append(legacy::out_wandering_type old);
void writeTo(std::ostream& file, std::string prefix = "") const;
void readFrom(std::istream& sin);
cWandering();
};
class cCreature { // formerly outdoor_creature_type
public:
bool exists;
short direction;
cWandering what_monst;
location which_sector,m_loc,home_sector; // home_sector is the sector it was spawned in
void append(legacy::outdoor_creature_type old);
};
short x,y; // Used while loading legacy scenarios.
ter_num_t terrain[48][48];
location special_locs[18];
unsigned short special_id[18];
location exit_locs[8];
char exit_dests[8];
location sign_locs[8];
cWandering wandering[4],special_enc[4];
location wandering_locs[4];
rectangle info_rect[8];
unsigned char strlens[180];
cSpecial specials[60];
//char strs[120][256];
std::string out_name;
// Using std::array here so we can have .size()
// This'll make the transition smoother once it becomes a vector.
std::array<std::string,8> rect_names;
std::string comment;
std::array<std::string,90> spec_strs;
std::array<std::string,8> sign_strs;
bool special_spot[48][48];
explicit cOutdoors(cScenario& scenario, bool init_strings = false);
void append(legacy::outdoor_record_type& old, const cScenario& scenario);
};
#endif