50 cursor.gotoxy ( a, b );
73 if ( (d & (1 << s)) && ( s != olddir )) {
81 for ( s = 0; s < r; s++) {
136 for(
int i = 0; i < 4; i++ )
137 for (
int j = 0; j < 6; j++ ) {
140 if ( fld2 && fld2->
building == bld )
141 for (
int d = 0; d <
sidenum; d++ ) {
157 int MapNetwork :: instancesrunning = 0;
161 if ( checkInstances ) {
162 if ( instancesrunning )
163 displaymessage(
" fatal error at MapNetwork; there are other running instances ", 2 );
185 for (
int s = 0; s <
sidenum; s++ ) {
189 if ( bld && bld->
color == (*j)->color ) {
204 for (
int i = 0; i < 8; i++ )
263 if ( (fld->
bdt & tb).any() ) {
265 for (
int i = 0; i <
sidenum; i++ ) {
348 if ( b->
color/8 < 8 ) {
353 if ( gettable > 0 ) {
355 if ( toget > gettable )
526 for (
int player = 0; player < 8; player++ ) {
527 if ( targplayer != player )
531 for (
int resourcetype = 0; resourcetype < 3; resourcetype++ ) {
533 topay[ resourcetype ] = actmap->
tribute.
avail[ player ][ targplayer ].
resource( resourcetype ) + got[ resourcetype ];
536 for ( Player::BuildingList::iterator j = actmap->
player[player].
buildingList.begin(); j != actmap->
player[player].
buildingList.end() && topay[resourcetype] > got[resourcetype] ; j++ ) {
538 got[resourcetype] += pt.
puttribute ( *j, resourcetype, 0, targplayer, player, 1 );
545 i = topay[resourcetype];
546 got [resourcetype ] += i;
551 actmap->
tribute.
paid[ targplayer ][ player ].
resource( resourcetype ) += got[resourcetype];
555 if ( topay[0] || topay[1] || topay[2] || got[0] || got[1] || got[2]) {
556 Resources tp ( topay[0], topay[1], topay[2] );
566 if ( gotStr.empty() )
578 if ( got[0] || got[1] || got[2] ) {
582 new Message ( msg, actmap, 1 << player );
588 if ( got[0] || got[1] || got[2] )
594 new Message ( text, actmap, 1 << targplayer );
679 for (
int r = 0; r < 3; ++r ) {
684 s.
format (
"Global resource mismatch: %d %s available after replay, but %d available in actual map\n", replaymap-> bi_resource[player].resource(r),
resourceNames[r], currentMap->
bi_resource[player].
resource(r) );
695 s.
format (
"Building missing! \n");
699 if ( find ( cb.begin(), cb.end(), b1 ) == cb.end()) {
713 cb.insert ( cb.end(), cbl.begin(), cbl.end() );
724 s.
format (
"Vehicle missing! \n");
728 if ( v1->
typ != v2->
typ ) {
731 s.
format (
"Vehicles with NWID %d don't have matching type, probably production inconsistency. (%s <-> %s)\n", v1->
networkid, v1->
typ->
getName().c_str(), v2->
typ->
getName().c_str() );
735 for (
int r = 0; r < 3; ++r ) {
783 if ( !less->
getUnit( (*i)->networkid )) {
784 s.
format(
"\nType: %s at %d/%d, nwid: %d", (*i)->getName().c_str(), (*i)->getPosition().x, (*i)->getPosition().y, (*i)->networkid );
811 s.
format (
"Number of developed technologies differ !\n" );
819 s.
format (
"Different technologies developed !\n" );
830 s.
format (
"Building missing! \n");
834 bool mismatch =
false;
int getIdentification() const
virtual void checkbuilding(Building *b)
MapNetwork(GameMap *gamemap, int checkInstances=1)
void setaTemp(Uint8 atemp)
Various algorithms need to store some information in the fields they process.
void cleartemps(int b=-1, int value=0)
virtual void checkbuilding(Building *b)
map accessing and usage routines used by ASC and the mapeditor
Resources getResourceUsage()
returns the resource that the building consumes for its operation.
int getresource(int x, int y, int resource, int _player, int _scope)
int getResource(int amount, int resourcetype, bool queryonly, int scope=1, int player=-1)
int damage
Damage. 0 is no damage, when damage reaches 100 the container is destroyed.
virtual void start(int x, int y)
Resources getResourcePlus()
virtual int fieldavail(int x, int y)=0
int getresource(int x, int y, int resource, int _need, int _queryonly, int _player, int _scope)
MapCoordinate getFieldCoordinates(const BuildingType::LocalCoordinate &localCoordinates) const
returns the absolute map coordinate of the given part of the building
const GameMap * getParentMap() const
ASCString getName() const
returns the name of the player
ASCString toString() const
Resources getStorageCapacity() const
returns the local storage capacity for the given resource, which depends on the resource mode of the ...
int getOwner() const
returns the number of the player this vehicle/building belongs to
vector< int > developedTechnologies
ContainerBase * getContainer(int nwid)
A local coordinate referencing a single field that a building covers.
MapCoordinate3D getEntry() const
returns the position of the buildings entry
MapCoordinate3D getPosition() const
returns the units position
Interface for some basic classes from which all of ASC's dialogs are derived.
ASCString getName() const
a single field of the map
ASCString & format(const charT *pFormat,...)
int puttribute(Building *start, int resource, int _queryonly, int _forplayer, int _fromplayer, int _scope)
virtual void checkvehicle(Vehicle *v)
MapField * getEntryField() const
returns the field the buildings entry is standing on
int netcontrol
a bitmapped variable containing the status of the resource-net connection.
The ASCString class provides an abstract way to manipulate strings.
virtual int fieldavail(int x, int y)
const Production & getProduction() const
const char * getmessage(int id)
returns a pointer to the message id. The messages must have been loaded with loadmessages ...
virtual int globalsearch(void)=0
Handling the connection of buildings by pipelines, powerlines etc.
virtual void checkbuilding(Building *b)
virtual void start(int x, int y)
virtual void searchvehicle(int x, int y)
const int sidenum
the number of sides that a field has; is now fixed at 6;
virtual void searchbuilding(int x, int y)
VehicleList vehicleList
a list of all units
virtual int getResource(int amount, int resourcetype, bool queryonly, int scope=1, int player=-1)=0
Resources bi_resource[8]
in BI resource mode ( see _resourcemode , isResourceGlobal ) , this is where the globally available r...
TerrainBits getTerrainBitType(TerrainBitTypes tbt)
the properties of a terrain describing which units can move onto this field and which can't ...
void searchAllVehiclesNextToBuildings(int player)
void log(const Vehicle *attacker, const Vehicle *attackee)
sigc::signal< void > tributeTransferred
class GameMap::ResourceTribute tribute
Coordinate on the twodimensional map.
bool isResourceGlobal(int resource)
void displaymessage(const char *formatstring, int num,...)
displays a dialog box with a message
The interface for the buildingtype class.
int getnextdx(int dir, int y)
virtual void checkvehicle(Vehicle *v)
virtual void checkbuilding(Building *b)
virtual void checkvehicle(Vehicle *v)=0
virtual void checkbuilding(Building *b)=0
Vehicle * getUnit(int x, int y, int nwid)
virtual int searchfinished(void)
TerrainBits bdt
the terraintype properties. They determine which units can move over the field. This variable is reca...
virtual void searchfield(int x, int y, int dir)
#define cnet_stopenergyinput
BuildingList buildingList
a list of all units
Resources actstorage
the current storage of Resources
A Message to a player. It may either be send by another player or by the system.
Interface for all the dialog boxes used by the game and the mapeditor.
int color
The owner of the container.
virtual void checkbuilding(Building *b)
Research research
the status of the scientific research
virtual void start(int x, int y)
virtual void start(int x, int y)
int getResource(int amount, int resourcetype, bool queryonly, int scope=1, int player=-1)
Coordinate on the map including height.
#define cnet_stopenergyoutput
virtual void start(int x, int y)
virtual void checkbuilding(Building *b)
const char * resourceNames[3]
the names of the different resources. Redundent, as we already have Resources::name ...
The parent class of Vehicle and Building; The name Container originates from Battle Isle...
An actual building on the map, which references a BuildingType Buildings have an owner,.
MapCoordinate startposition
void setaTemp2(Uint8 atemp2)
the different players in ASC. There may be 8 players (0..7) and neutral units (8) ...
Resources are basically the currency of ASC.
GetResource(GameMap *gamemap, int scope=-1)
void transfer_all_outstanding_tribute(Player &player)
bool compareMapResources(GameMap *currentMap, GameMap *replaymap, int player, ASCString *log)
int networkid
a unique identification of the unit that is used everywhere in ASC (and not only the network protocol...
MapCoordinate3D getPosition() const
returns the position of the buildings entry
bool exist() const
does the player exist at all
Resources payStatusLastTurn[8][8]
for the messages that are send each turn it is necessary to record how much of the transfer happend d...
MapCoordinate3D getNeighbouringFieldCoordinate(const MapCoordinate3D &pos, int direc)
returns the coordinate of the field that is adjecent to the given field in the direction of direc ...
The map. THE central structure of ASC, which holds everything not globally available together...
virtual int searchfinished(void)=0
MapField * getField(int x, int y)
vector< Building * > BuildingContainer