stuff to test
This commit is contained in:
parent
8f41d89a3c
commit
78b9b2436c
3 changed files with 32 additions and 2 deletions
|
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include "util.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace game {
|
||||
void State::init()
|
||||
{
|
||||
|
|
@ -76,6 +78,30 @@ namespace game {
|
|||
void State::quitPlayer(int playerId)
|
||||
{
|
||||
(void) playerId;
|
||||
cout << playerId << " quit" << endl;
|
||||
}
|
||||
|
||||
void State::clear(int playerId)
|
||||
{
|
||||
cout << playerId << " clear" << endl;
|
||||
}
|
||||
|
||||
void State::setName(int playerId, std::string name)
|
||||
{
|
||||
// discard if not unique
|
||||
for (const Player *other : players) {
|
||||
if (name == other->name) {
|
||||
std::cout << "name '" << name << "' already given to player #" << other->id << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
playerForId(playerId)->name = name;
|
||||
}
|
||||
|
||||
void State::setSpeed(int playerId, double speed)
|
||||
{
|
||||
playerForId(playerId)->speed = speed;
|
||||
}
|
||||
|
||||
void State::advancePlayerShipSpawns(float dt)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <vector>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
|
@ -51,6 +52,9 @@ namespace game {
|
|||
// The upper layer (network/renderer) calling these three functions
|
||||
// should keep id's unique and give one (network) input an id.
|
||||
int addPlayer();
|
||||
void clear(int playerId);
|
||||
void setName(int playerId, std::string name);
|
||||
void setSpeed(int playerId, double speed);
|
||||
void quitPlayer(int playerId);
|
||||
void commandForPlayer(int playerId, Command *cmd);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue