亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cell.cpp

?? 通用網絡游戲開發框架
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// ============================================================================
// Cell implementation
//
// (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.
// ============================================================================

#include "stdafx.h"
#include "cell.h"
#include "brush.h"
#include "pen.h"
#include "universal.h"
#include "socket.h"

#include <fstream>
#include <assert.h>
#include <math.h>
#include <sstream>
#include <cmath>

using namespace std;

struct CellBuffer {
   int    sync;
   int    i, j, player, type;
   double troops, elevation, strength;
   POINT  position;
   bool   vector[6];
};

class spoint {                               // Signed version of POINT
public:                                      // that can be statically
   int x;                                    // initialised
   int y;
};

namespace {
   const int c = cell_size;                  // Abbreviations for data
   const int h = half_cell_size;             // initialisation
   const int q = quarter_cell_size;
   const int t = cell_size - q;

   const double deg_to_rad = 3.1415925 / 180;

   // The x coordinate for a movement vector that isn't straight up or down
   // is 3/8th of the cell size.

   const int m = q + (q / 2);

   POINT     hexagon[]  = {q,0, t,0, c,h, t,c, q,c, 0,h, q,0};
   spoint    offset[6]  = {m,q, 0,h, -m,q, -m,-q,  0,-h, m,-q}; 
   spoint    unitvec[6] = {1,1, 0,1, -1,1, -1,-1,  0,-1, 1,-1}; 

   COLORREF  colours[max_players] = {RGB(255, 50, 50),   RGB(255, 50, 255), 
                                     RGB(255, 255, 255), RGB(255, 255, 0),
                                     RGB(100, 255, 100), RGB(150, 150, 255)  
   }; 

   const int    num_points  (sizeof(hexagon) / sizeof(POINT));
}


// ============================================================================
// Reset a cell to its default state
// ============================================================================

void Cell::reset(bool exploring)
{
   changed     = false;
   elevation   = 0;
   explored    = ! exploring;
   march       = false;
   scanned     = false;
   player      = -1;
   troops      = 0;
   type        = Empty;
   strength    = 0;

   for (int i = 0; i < 6; i++) {
      vector[i] = false;
   }
}


// ============================================================================
// Construction
// ============================================================================

Cell::Cell()
{
   reset(true);
}


// ============================================================================
// Draw a circle
// ============================================================================

static void circle(HDC hdc, POINT center, int diameter)
{
   int x = center.x - (diameter / 2);
   int y = center.y - (diameter / 2);

   Ellipse(hdc, x, y, x + diameter, y + diameter);
}


// ============================================================================
// Draw a cell
// ============================================================================

void Cell::draw_cell(HDC hdc, bool hide_vectors, int client)
{
   POINT     points[num_points];
   COLORREF  cell_colour;

   // The cell background colour depends on its elevation. Sea-level is green
   // and the colour shifts to brown with increasing altitude. Shades of blue
   // are used for negative altitudes (sea).

   int    hue        (225);
   double adjustment (abs((double) hue * (elevation / max_elevation)));

   if (elevation < 0) {
      cell_colour = RGB(0, 0, hue - (adjustment * 0.7));
   }
   else {
      cell_colour = RGB(adjustment * 0.5, hue - (adjustment * 0.7), 0);
   }

   if (explored == false) {
      cell_colour = RGB(128, 128, 128);
   }

   Brush cell_brush(hdc, cell_colour);
   int   i;

   for (i = 0; i < num_points; i++) {
      points[i].x = hexagon[i].x + position.x;
      points[i].y = hexagon[i].y + position.y;
   }

   Polygon(hdc, points, num_points);

   if (explored == false) return;

   POINT centre = get_centre();
   COLORREF player_colour(colours[player]);
   Pen      troop_pen(hdc,   player_colour, 1);
   Brush    troop_brush(hdc, player_colour);
   int      circle_size(0);
   int      scale(1);

   // If there are troops in this cell draw a solid circle of a representative
   // size.

   if (troops > 0.0) {
      circle_size = (int) (((double) cell_size-8) * (troops / max_troops));
      circle_size |= 1;
      circle(hdc, centre, circle_size);
   }
   else {
      scale = 2;
   }

   // Draw movement vectors in the player's colour. If the cell is empty,
   // vectors are drawn half size. For readability, draw the bit of the
   // movement vector that is inside the troop circle in black.

   double theta(30);
   double radius(circle_size / 2);

   if ((player == client) || !hide_vectors || (troops > 0)) { 
      for (i = 0; i < 6; i++) {
         if (vector[i]) {
            int x = centre.x + (offset[i].x / scale);
            int y = centre.y + (offset[i].y / scale);

            Pen troop_pen(hdc, player_colour, 3);
            MoveToEx(hdc, centre.x, centre.y, 0);
            LineTo(hdc, x, y);
            
            if (circle_size > 2) {
               int xo = (int)(radius * cos(theta * deg_to_rad));
               int yo = (int)(radius * sin(theta * deg_to_rad));
               
               xo += centre.x; 
               yo += centre.y;
               
               Pen black_pen(hdc, RGB(0, 0, 0), 1);
               MoveToEx(hdc, centre.x, centre.y, 0);
               LineTo(hdc, xo, yo);
            }
         }
         theta += 60;
      }
   }

   HBRUSH null_brush = static_cast<HBRUSH>(GetStockObject(HOLLOW_BRUSH));
   SelectObject(hdc, null_brush);

   // Draw a circle to indicate the strength of this base

   if (type == Base) {
      Pen pen(hdc, RGB(0,0,0), 2);

      double size(cell_size - 3);
      size *= strength / 100.0;
      circle(hdc, centre, size);
   }
}


// ============================================================================
// Draw this cell
// ============================================================================

void Cell::draw(HWND window, bool hide_vectors, int client)
{
   HDC hdc (GetDC(window));
   assert(hdc != 0);

   HBRUSH old_brush = static_cast<HBRUSH>(GetCurrentObject(hdc, OBJ_BRUSH));
   HPEN   old_pen   = static_cast<HPEN>  (GetCurrentObject(hdc, OBJ_PEN));

   draw_cell(hdc, hide_vectors, client);

   SelectObject(hdc, old_brush);
   SelectObject(hdc, old_pen);
   ReleaseDC(window, hdc);
}



// ============================================================================
// Update this cell
// ============================================================================

void Cell::update(double elapsed)
{
   if ((type == Base) && (troops < max_troops)) {
      troops += (growth_rate * (strength / 100)) * elapsed;
      if (troops > max_troops) troops = max_troops;
      changed = true;
   }
}


// ============================================================================
// Put a cell into march mode
// ============================================================================

void Cell::set_march(Point position)
{
   clear_vector(all_vectors);
   int side (which_side(position));

   if (side == -1) {
      return;
   }

   march_vector = side;
   march        = true;;
   march_timer  = 0;
}


// ============================================================================
// Toggle a movement vector
// ============================================================================

void Cell::toggle_vector(Point position)
{
   march        = false;
   int side (which_side(position));

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本不卡1234视频| 91福利在线观看| 久久先锋影音av鲁色资源网| 99视频精品免费视频| 亚洲午夜一区二区| 中文字幕高清一区| 一区二区三区四区蜜桃| 久久免费看少妇高潮| 欧美丰满嫩嫩电影| 精品国产91乱码一区二区三区| 一本一道久久a久久精品综合蜜臀| 狠狠色综合日日| 日韩国产在线观看| 国产在线精品一区二区三区不卡 | 亚洲第一会所有码转帖| 韩国三级电影一区二区| 亚洲成人动漫av| 国产精品国产三级国产普通话蜜臀| 91精品国产免费| 石原莉奈在线亚洲二区| 一区二区不卡在线视频 午夜欧美不卡在| 中文字幕欧美日本乱码一线二线| 亚洲精品自拍动漫在线| 欧美电影在线免费观看| 91九色最新地址| 色老汉av一区二区三区| 成人激情动漫在线观看| 国产成人啪午夜精品网站男同| 免费高清视频精品| 视频在线观看一区二区三区| 欧美肥妇bbw| 日韩一区二区在线观看视频 | 国产欧美日韩中文久久| 日本一区二区三区国色天香 | 91精品婷婷国产综合久久性色| 久久久久久一级片| 2020日本不卡一区二区视频| 精品久久久久av影院| 久久综合色天天久久综合图片| 亚洲精品一区二区三区精华液 | 在线一区二区三区做爰视频网站| 亚洲成人先锋电影| 亚洲嫩草精品久久| 亚洲午夜在线观看视频在线| 亚洲一二三级电影| 蜜桃av一区二区三区电影| 麻豆精品国产传媒mv男同| 国模娜娜一区二区三区| 成人午夜视频网站| 大尺度一区二区| 精品粉嫩aⅴ一区二区三区四区| 久久亚洲一区二区三区四区| 欧美成人精品二区三区99精品| 日韩欧美综合一区| 国产精品美日韩| 亚洲超丰满肉感bbw| 欧美无人高清视频在线观看| 精品日韩欧美一区二区| 日韩三级免费观看| 国产精品久久久久aaaa樱花 | 在线看一区二区| 日韩免费观看高清完整版| 欧美成人国产一区二区| 亚洲视频免费观看| 欧美午夜精品一区二区三区| 7777精品伊人久久久大香线蕉最新版| 精品国产乱码久久久久久夜甘婷婷 | 久久麻豆一区二区| 亚洲欧美成aⅴ人在线观看| 日本不卡123| 国产69精品久久久久777| 在线亚洲一区观看| 色综合av在线| 欧美成人在线直播| 中文字幕二三区不卡| 免费观看在线综合| 色视频一区二区| 欧美激情资源网| 日本欧美久久久久免费播放网| 极品少妇xxxx精品少妇偷拍| 欧美在线免费观看亚洲| 国产精品丝袜一区| 国产美女娇喘av呻吟久久 | 精品夜夜嗨av一区二区三区| 国产另类ts人妖一区二区| 欧美午夜免费电影| 亚洲色图都市小说| 国产99精品国产| 久久99国产精品久久| 91在线视频播放地址| 久久综合九色综合97_久久久| 五月激情丁香一区二区三区| 99re在线精品| 国产精品久久久久毛片软件| 中文字幕亚洲精品在线观看 | 成人动漫中文字幕| 欧美日本在线播放| 亚洲国产精品视频| 欧美午夜影院一区| 亚洲欧美视频在线观看视频| 成人精品国产一区二区4080 | 蜜臀av性久久久久蜜臀aⅴ四虎| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 日本大胆欧美人术艺术动态| 欧美视频日韩视频在线观看| 亚洲美女视频在线观看| 色一区在线观看| 亚洲国产欧美另类丝袜| 91一区二区在线| 亚洲伊人伊色伊影伊综合网| 欧美日韩黄色一区二区| 91亚洲精品久久久蜜桃| 国产精品久久久久久户外露出| 成人免费观看男女羞羞视频| 国产精品人成在线观看免费| 色婷婷精品大在线视频| 人人精品人人爱| 亚洲欧美在线视频| 欧美一区二区福利在线| 99精品国产91久久久久久| 欧美丰满高潮xxxx喷水动漫 | 国产精品色哟哟网站| 亚洲成人免费视| 国产婷婷色一区二区三区四区 | 性做久久久久久免费观看| 精品久久久久久亚洲综合网| 色偷偷成人一区二区三区91 | 中文字幕av资源一区| 欧美日韩1区2区| 99久久免费视频.com| 亚洲成av人片| 国产91色综合久久免费分享| 亚洲自拍偷拍麻豆| 亚洲国产精品成人久久综合一区| 欧美日韩精品一区二区三区四区| 国产乱码字幕精品高清av | 91麻豆精品国产自产在线| 成人性视频免费网站| 五月婷婷综合网| 亚洲精品成人悠悠色影视| 欧美xxxxx牲另类人与| 色成年激情久久综合| 亚洲精品在线免费播放| 欧美日韩成人高清| 欧美日韩久久一区二区| 成人午夜在线视频| 激情久久五月天| 免费高清在线一区| 99久久er热在这里只有精品15 | 久久一日本道色综合| 67194成人在线观看| 在线观看av不卡| 成人午夜看片网址| 免费人成网站在线观看欧美高清| 欧美最新大片在线看 | 成人国产精品免费观看| 国产综合色产在线精品| 日本不卡视频一二三区| 91尤物视频在线观看| 精品一区二区在线看| 日本免费在线视频不卡一不卡二| 午夜精品免费在线| 五月天丁香久久| 免费成人美女在线观看| 日韩不卡手机在线v区| 视频精品一区二区| 男人的天堂久久精品| 亚洲女人****多毛耸耸8| av资源网一区| 色综合网站在线| 欧美一区二区三区白人| 欧美亚洲愉拍一区二区| 欧美少妇xxx| 欧美男男青年gay1069videost | 欧美三级欧美一级| 欧美日高清视频| 亚洲精品在线观| 国产精品乱子久久久久| 国产精品女人毛片| 一区在线播放视频| 亚洲综合免费观看高清完整版在线| 一区二区三区美女视频| 五月综合激情网| 国产在线精品一区二区不卡了 | 国产精品一级片| 国产成人亚洲综合a∨婷婷图片| 成人午夜电影网站| 亚洲免费观看高清完整版在线| 国产精品久久久一区麻豆最新章节| 一区二区三区久久| 丝袜a∨在线一区二区三区不卡| 午夜精品成人在线视频| 久久精品噜噜噜成人88aⅴ| 日韩制服丝袜av| 国产原创一区二区三区| 99久久99久久久精品齐齐| 欧美一级日韩一级| 亚洲人123区| 蜜桃av一区二区三区| 94色蜜桃网一区二区三区|