1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
#ifndef _RESOURCE_MAP_ANALYZER_H
#define _RESOURCE_MAP_ANALYZER_H
#include "System/float3.h"
#include <vector>
class CResource;
struct UnitDef;
class CResourceMapAnalyzer {
public:
CResourceMapAnalyzer(int resourceId);
~CResourceMapAnalyzer();
float3 GetNearestSpot(float3 fromPos, int team, const UnitDef* extractor = NULL) const;
float3 GetNearestSpot(int builderUnitId, const UnitDef* extractor = NULL) const;
float GetAverageIncome() const;
/**
* Returns positions indicating where to place resource extractors on the map.
* Only the x and z values give the location of the spots, while the y values
* represents the actual amount of resource an extractor placed there can make.
* You should only compare the y values to each other, and not try to estimate
* effective output from spots.
*/
const std::vector<float3>& GetSpots() const;
private:
void Init();
void GetResourcePoints();
void SaveResourceMap();
bool LoadResourceMap();
std::string GetCacheFileName() const;
int resourceId;
float extractorRadius;
int numSpotsFound;
std::vector<float3> vectoredSpots;
float averageIncome;
float3 bufferSpot;
bool stopMe;
int maxSpots;
int mapHeight;
int mapWidth;
int totalCells;
int squareRadius;
int doubleSquareRadius;
int totalResources;
int maxResource;
int tempResources;
int coordX;
int coordZ;
int minIncomeForSpot;
int xtractorRadius;
int doubleRadius;
unsigned char* rexArrayA;
unsigned char* rexArrayB;
unsigned char* rexArrayC;
int* tempAverage;
};
#endif // _RESOURCE_MAP_ANALYZER_H
|