moved almost all hardcoded constants to "define.dat"
[k8-i-v-a-n.git] / src / game / worldmap.h
blobec2c22fbfe3e721a0da13c25d73c7b4d7c45f204
1 /*
3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
6 * Public License
8 * See LICENSING which should be included
9 * along with this file for more details
12 #ifndef __WORLDMAP_H__
13 #define __WORLDMAP_H__
15 #include "ivancommon.h"
17 #include <vector>
19 #include "area.h"
22 class wsquare;
23 class continent;
24 class owterrain;
26 typedef std::vector<character *> charactervector;
29 typedef owterrain *(*PlaceSpawner) ();
32 struct WorldMapPlace {
33 owterrain *terra;
34 int type;
35 int dungeon;
36 PlaceSpawner spawner;
37 truth allowSpawn;
41 class worldmap : public area {
42 public:
43 worldmap (int, int);
44 worldmap ();
45 virtual ~worldmap ();
47 void Generate ();
48 void Save (outputfile &) const;
49 void Load (inputfile &);
50 wsquare *GetWSquare (v2 Pos) const { return Map[Pos.X][Pos.Y]; }
51 wsquare *GetWSquare (int x, int y) const { return Map[x][y]; }
52 void GenerateClimate ();
53 int WhatTerrainIsMostCommonAroundCurrentTerritorySquareIncludingTheSquareItself (int, int);
54 void CalculateContinents ();
55 void SmoothAltitude ();
56 void SmoothClimate ();
57 void RandomizeAltitude ();
58 continent *GetContinentUnder (v2) const;
59 continent *GetContinent (int) const;
60 void RemoveEmptyContinents ();
61 int GetAltitude (v2);
62 charactervector &GetPlayerGroup ();
63 character *GetPlayerGroupMember (int);
64 virtual void Draw (truth) const;
65 void CalculateLuminances ();
66 void CalculateNeighbourBitmapPoses ();
67 wsquare *GetNeighbourWSquare (v2, int) const;
68 v2 GetEntryPos (ccharacter *, int) const;
69 void RevealEnvironment (v2, int);
70 void SafeSmooth (int, int);
71 void FastSmooth (int, int);
72 wsquare ***GetMap () const { return Map; }
73 void UpdateLOS ();
75 static void RegisterPlace (owterrain *, cint ttype, cint didx, PlaceSpawner aspawner, truth aAllowSpawn=true);
77 protected:
78 wsquare ***Map;
79 std::vector<continent *> Continent;
80 uChar **TypeBuffer;
81 uChar **OldTypeBuffer;
82 short **AltitudeBuffer;
83 short **OldAltitudeBuffer;
84 uChar **ContinentBuffer;
85 charactervector PlayerGroup;
87 std::vector<v2> PlacePosition;
88 std::vector<truth> PlaceRevealed;
89 std::vector<continent *> PlaceContinent;
91 static std::vector<WorldMapPlace> Places;
94 outputfile &operator << (outputfile &, const worldmap *);
95 inputfile &operator >> (inputfile &, worldmap *&);
98 #endif