Changeset c9f6a1c in network-game


Ignore:
Timestamp:
Dec 23, 2013, 8:05:55 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
3e44a59
Parents:
8ce793b
Message:

New GameSummary class for storing game results

Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • common/Game.cpp

    r8ce793b rc9f6a1c  
    7373}
    7474
    75 int Game::getRedScore() {
     75unsigned int Game::getRedScore() {
    7676   return this->redScore;
    7777}
    7878
    79 int Game::getBlueScore() {
     79unsigned int Game::getBlueScore() {
    8080   return this->blueScore;
    8181}
     
    8989}
    9090
    91 void Game::setRedScore(int score) {
     91void Game::setRedScore(unsigned int score) {
    9292   this->redScore = score;
    9393}
    9494
    95 void Game::setBlueScore(int score) {
     95void Game::setBlueScore(unsigned int score) {
    9696   this->blueScore = score;
    9797}
  • common/Game.h

    r8ce793b rc9f6a1c  
    2424   map<unsigned int, Projectile> projectiles;
    2525   WorldMap* worldMap;
    26    int blueScore;
    27    int redScore;
     26   unsigned int blueScore;
     27   unsigned int redScore;
    2828   unsigned int unusedProjectileId;
    2929
     
    3636   string getName();
    3737   int getNumPlayers();
    38    int getBlueScore();
    39    int getRedScore();
     38   unsigned int getBlueScore();
     39   unsigned int getRedScore();
    4040   WorldMap* getMap();
    4141
    4242   void setId(unsigned int id);
    43    void setBlueScore(int score);
    44    void setRedScore(int score);
     43   void setBlueScore(unsigned int score);
     44   void setRedScore(unsigned int score);
    4545
    4646   map<unsigned int, Player*>& getPlayers();
  • server/makefile

    r8ce793b rc9f6a1c  
    11CC = g++
    2 LIB_FLAGS = -lssl -lmysqlclient -lcrypt -lrt
     2#LIB_FLAGS = -lssl -lmysqlclient -lcrypt -lrt
     3LIB_FLAGS = -lmysqlclient -lcrypt -lrt
    34FLAGS = $(LIB_FLAGS)
    45COMMON_PATH = ../common
    5 DEPENDENCIES = Common.o MessageContainer.o MessageProcessor.o Player.o WorldMap.o DataAccess.o Projectile.o Game.o
     6DEPENDENCIES = Common.o MessageContainer.o MessageProcessor.o Player.o WorldMap.o DataAccess.o Projectile.o Game.o GameSummary.o
    67
    78server : server.cpp $(DEPENDENCIES)
     
    2930        $(CC) -c -o $@ $?
    3031
     32GameSummary.o : $(COMMON_PATH)/GameSummary.cpp
     33        $(CC) -c -o $@ $?
     34
    3135%.o : %.cpp
    3236        $(CC) -c -o $@ $?
  • server/server.cpp

    r8ce793b rc9f6a1c  
    3636#include "../common/Projectile.h"
    3737#include "../common/Game.h"
     38#include "../common/GameSummary.h"
    3839
    3940#include "DataAccess.h"
     
    377378
    378379                        serverMsg.type = MSG_TYPE_FINISH_GAME;
     380
     381                        // I should create an instance of the GameSummary object here and just serialize it into this message
    379382                        memcpy(serverMsg.buffer+4, &winningTeam, 4);
    380383                        memcpy(serverMsg.buffer+4, &scoreBlue, 4);
Note: See TracChangeset for help on using the changeset viewer.