|
// This file needs -*- c++ -*- mode
// ============================================================================
// Cell interface
//
// (c) 2003 Ken Reed
//
// This is free software. You can redistribute it and/or modify it under the
// terms of the GNU General Public License version 2 as published by the Free
// Software Foundation.
// ============================================================================
// If you try and put template classes into STL containers the MS compiler
// warns that there are problems using the debugger on them. Turn off this
// warning as we don't care about it.
#pragma once
#pragma warning(disable:4786)
#include "cell.h"
#include "point.h"
#include "socket.h"
#include <set>
#include <iostream>
const int cell_size (24);
const int half_cell_size (cell_size / 2);
const int quarter_cell_size (cell_size / 4);
const int p75_cell_size (cell_size - quarter_cell_size);
const int all_vectors (-1);
const int max_troops (100);
const int max_elevation (100);
const int growth_rate (10);
enum {Empty, Base};
class Cell {
public:
Cell();
int get_vector();
int which_side(Point click);
void battle(double elapsed);
void draw(HWND window, bool hidden, int client);
void update(double elapsed);
void set_vector(Point position);
void toggle_vector(Point position);
void set_march(Point position);
void clear_vector(int side);
void reset(bool exploring);
void merge(const Cell & cell);
Point get_centre();
bool changed;
bool explored;
bool march;
bool scanned;
bool vector[6];
double elevation;
double march_timer;
double troops;
double strength;
int i;
int j;
int march_vector;
int player;
int type;
POINT position;
std::set<Cell *> attackers;
private:
void draw_cell(HDC dc, bool hidden, int client);
Cell (const Cell & Cell); // No copying allowed
};
void read_cell (Socket & socket, Cell & cell);
void send_cell (Socket & socket, Cell & cell);
std::ostream & operator<<(std::ostream & s, Cell & c);
std::istream & operator>>(std::istream & s, Cell & c);
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.