Ci: check space and LF (#55)

This commit is contained in:
notify 2023-02-26 16:51:29 +08:00 committed by GitHub
parent 9ac89caa1f
commit a579cf2a59
36 changed files with 93 additions and 75 deletions

18
.github/workflows/check-white-space.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: Check Whitespace and New Line
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Check trailing space
run: if grep -rIn "[[:blank:]]$"; then exit 2; else echo OK; fi
- name: Check no new line at EOF
run: for f in $(grep -rIl ""); do if test $(tail -c 1 $f); then echo $f; fail=1; fi; done; if test $fail; then exit 1; fi

View File

@ -5,7 +5,7 @@
android:versionCode="1" android:versionCode="1"
android:versionName="1.0"> android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<supports-screens <supports-screens

View File

@ -307,10 +307,10 @@ local function mergeMoves(moves)
local ret = {} local ret = {}
local temp = {} local temp = {}
for _, move in ipairs(moves) do for _, move in ipairs(moves) do
local info = string.format("%q,%q,%q,%q,%s,%s", local info = string.format("%q,%q,%q,%q,%s,%s",
move.from, move.to, move.fromArea, move.toArea, move.from, move.to, move.fromArea, move.toArea,
move.specialName, move.fromSpecialName) move.specialName, move.fromSpecialName)
if temp[info] == nil then if temp[info] == nil then
temp[info] = { temp[info] = {
ids = {}, ids = {},
from = move.from, from = move.from,

View File

@ -508,7 +508,7 @@ Fk:loadTranslationTable{
["#LoseSkill"] = "%from 失去了技能“%arg”", ["#LoseSkill"] = "%from 失去了技能“%arg”",
-- moveCards (they are sent by notifyMoveCards) -- moveCards (they are sent by notifyMoveCards)
["$DrawCards"] = "%from 摸了 %arg 张牌 %card", ["$DrawCards"] = "%from 摸了 %arg 张牌 %card",
["$DiscardCards"] = "%from 弃置了 %arg 张牌 %card", ["$DiscardCards"] = "%from 弃置了 %arg 张牌 %card",

View File

@ -38,7 +38,7 @@ end
---@param pack Package ---@param pack Package
function Engine:loadPackage(pack) function Engine:loadPackage(pack)
assert(pack:isInstanceOf(Package)) assert(pack:isInstanceOf(Package))
if self.packages[pack.name] ~= nil then if self.packages[pack.name] ~= nil then
error(string.format("Duplicate package %s detected", pack.name)) error(string.format("Duplicate package %s detected", pack.name))
end end
self.packages[pack.name] = pack self.packages[pack.name] = pack

View File

@ -76,11 +76,11 @@ local function matchCard(matcher, card)
return false return false
end end
-- TODO: generalName -- TODO: generalName
if matcher.cardType and not table.contains(matcher.cardType, typetable[card.type]) then if matcher.cardType and not table.contains(matcher.cardType, typetable[card.type]) then
return false return false
end end
if matcher.id and not table.contains(matcher.id, card.id) then if matcher.id and not table.contains(matcher.id, card.id) then
return false return false
end end

View File

@ -109,7 +109,7 @@ end
---@param flag string ---@param flag string
function Player:setFlag(flag) function Player:setFlag(flag)
if flag == "." then if flag == "." then
self:clearFlags() self:clearFlags()
return return
end end
@ -302,7 +302,7 @@ function Player:getMaxCards()
end end
if max_fixed then baseValue = math.max(max_fixed, 0) end if max_fixed then baseValue = math.max(max_fixed, 0) end
for _, skill in ipairs(status_skills) do for _, skill in ipairs(status_skills) do
local c = skill:getCorrect(self) local c = skill:getCorrect(self)
baseValue = baseValue + c baseValue = baseValue + c
@ -349,7 +349,7 @@ function Player:distanceTo(other)
if correct == nil then correct = 0 end if correct == nil then correct = 0 end
ret = ret + correct ret = ret + correct
end end
if self.fixedDistance[other] then if self.fixedDistance[other] then
ret = self.fixedDistance[other] ret = self.fixedDistance[other]
end end

View File

@ -23,7 +23,7 @@ local function readCommonSpecToSkill(skill, spec)
skill.anim_type = spec.anim_type skill.anim_type = spec.anim_type
if spec.attached_equip then if spec.attached_equip then
assert(type(spec.attached_equip) == "string") assert(type(spec.attached_equip) == "string")
skill.attached_equip = spec.attached_equip skill.attached_equip = spec.attached_equip
end end
end end
@ -355,7 +355,7 @@ function fk.CreateTrickCard(spec)
if spec.suit then assert(type(spec.suit) == "number") end if spec.suit then assert(type(spec.suit) == "number") end
if spec.number then assert(type(spec.number) == "number") end if spec.number then assert(type(spec.number) == "number") end
local card = TrickCard:new(spec.name, spec.suit, spec.number) local card = TrickCard:new(spec.name, spec.suit, spec.number)
card.skill = spec.skill or defaultCardSkill card.skill = spec.skill or defaultCardSkill
return card return card
end end

View File

@ -138,7 +138,7 @@ fkp.functions.buildPrompt = function(base, src, dest, arg, arg2)
end end
fkp.functions.askForChoice = function(player, choices, reason) fkp.functions.askForChoice = function(player, choices, reason)
return player.room:askForChoice(player, choices, reason) return player.room:askForChoice(player, choices, reason)
end end
fkp.functions.askForPlayerChosen = function(player, targets, reason, prompt, optional, notify) fkp.functions.askForPlayerChosen = function(player, targets, reason, prompt, optional, notify)

View File

@ -7,7 +7,7 @@ local RandomAI = AI:subclass("RandomAI")
local function useActiveSkill(self, skill, card) local function useActiveSkill(self, skill, card)
local room = self.room local room = self.room
local player = self.player local player = self.player
local filter_func = skill.cardFilter local filter_func = skill.cardFilter
if card then if card then
filter_func = function() return false end filter_func = function() return false end
@ -111,7 +111,7 @@ local function useVSSkill(self, skill, pattern, cancelable, extra_data)
end end
max_try_time = max_try_time - 1 max_try_time = max_try_time - 1
end end
return nil return nil
end end
local random_cb = {} local random_cb = {}

View File

@ -55,7 +55,7 @@ function Room:initialize(_room)
self.room = _room self.room = _room
self.room.startGame = function(_self) self.room.startGame = function(_self)
Room.initialize(self, _room) -- clear old data Room.initialize(self, _room) -- clear old data
local main_co = coroutine.create(function() local main_co = coroutine.create(function()
self:run() self:run()
end) end)
@ -550,7 +550,7 @@ function Room:notifyMoveCards(players, card_moves, forceVisible)
or infosContainArea(move.moveInfo, Card.Processing) or infosContainArea(move.moveInfo, Card.Processing)
or move.toArea == Card.Processing or move.toArea == Card.Processing
-- TODO: PlayerSpecial -- TODO: PlayerSpecial
if not move.moveVisible then if not move.moveVisible then
for _, info in ipairs(move.moveInfo) do for _, info in ipairs(move.moveInfo) do
info.cardId = -1 info.cardId = -1
@ -1436,7 +1436,7 @@ function Room:doCardUseEffect(cardUseEvent)
if #realCardIds == 0 then if #realCardIds == 0 then
return return
end end
local target = TargetGroup:getRealTargets(cardUseEvent.tos)[1] local target = TargetGroup:getRealTargets(cardUseEvent.tos)[1]
if not self:getPlayerById(target).dead then if not self:getPlayerById(target).dead then
local findSameCard = false local findSameCard = false
@ -1543,7 +1543,7 @@ function Room:doCardEffect(cardEffectEvent)
end end
break break
end end
if not cardEffectEvent.toCard and (not (self:getPlayerById(cardEffectEvent.to):isAlive() and cardEffectEvent.to) or #self:deadPlayerFilter(TargetGroup:getRealTargets(cardEffectEvent.tos)) == 0) then if not cardEffectEvent.toCard and (not (self:getPlayerById(cardEffectEvent.to):isAlive() and cardEffectEvent.to) or #self:deadPlayerFilter(TargetGroup:getRealTargets(cardEffectEvent.tos)) == 0) then
break break
end end
@ -1691,7 +1691,7 @@ function Room:moveCards(...)
fromSpecialName = cardsMoveInfo.from and self:getPlayerById(cardsMoveInfo.from):getPileNameOfId(id), fromSpecialName = cardsMoveInfo.from and self:getPlayerById(cardsMoveInfo.from):getPileNameOfId(id),
}) })
end end
---@type CardsMoveStruct ---@type CardsMoveStruct
local cardsMoveStruct = { local cardsMoveStruct = {
moveInfo = infos, moveInfo = infos,
@ -1705,7 +1705,7 @@ function Room:moveCards(...)
specialName = cardsMoveInfo.specialName, specialName = cardsMoveInfo.specialName,
specialVisible = cardsMoveInfo.specialVisible, specialVisible = cardsMoveInfo.specialVisible,
} }
table.insert(cardsMoveStructs, cardsMoveStruct) table.insert(cardsMoveStructs, cardsMoveStruct)
end end
end end
@ -1766,7 +1766,7 @@ function Room:moveCards(...)
Fk:filterCard(info.cardId, self:getPlayerById(data.to)) Fk:filterCard(info.cardId, self:getPlayerById(data.to))
local currentCard = Fk:getCardById(info.cardId) local currentCard = Fk:getCardById(info.cardId)
if if
data.toArea == Player.Equip and data.toArea == Player.Equip and
currentCard.type == Card.TypeEquip and currentCard.type == Card.TypeEquip and
data.to ~= nil and data.to ~= nil and
@ -1855,7 +1855,7 @@ function Room:moveCardTo(card, to_place, target, reason, skill_name, special_nam
moveReason = reason, moveReason = reason,
skillName = skill_name, skillName = skill_name,
specialName = special_name, specialName = special_name,
moveVisible = visible, moveVisible = visible,
} }
end end
@ -2099,7 +2099,7 @@ function Room:enterDying(dyingStruct)
self.logic:trigger(fk.AskForPeaches, dyingPlayer, dyingStruct) self.logic:trigger(fk.AskForPeaches, dyingPlayer, dyingStruct)
self.logic:trigger(fk.AskForPeachesDone, dyingPlayer, dyingStruct) self.logic:trigger(fk.AskForPeachesDone, dyingPlayer, dyingStruct)
end end
if not dyingPlayer.dead then if not dyingPlayer.dead then
dyingPlayer.dying = false dyingPlayer.dying = false
self:broadcastProperty(dyingPlayer, "dying") self:broadcastProperty(dyingPlayer, "dying")
@ -2112,7 +2112,7 @@ function Room:killPlayer(deathStruct)
local victim = self:getPlayerById(deathStruct.who) local victim = self:getPlayerById(deathStruct.who)
victim.dead = true victim.dead = true
table.removeOne(self.alive_players, victim) table.removeOne(self.alive_players, victim)
local logic = self.logic local logic = self.logic
logic:trigger(fk.BeforeGameOverJudge, victim, deathStruct) logic:trigger(fk.BeforeGameOverJudge, victim, deathStruct)
@ -2132,7 +2132,7 @@ function Room:killPlayer(deathStruct)
} }
end end
self:sendLogEvent("Death", {to = victim.id}) self:sendLogEvent("Death", {to = victim.id})
self:broadcastProperty(victim, "role") self:broadcastProperty(victim, "role")
self:broadcastProperty(victim, "dead") self:broadcastProperty(victim, "dead")

View File

@ -310,7 +310,7 @@ function ServerPlayer:changePhase(from_phase, to_phase)
self.phase = to_phase self.phase = to_phase
room:notifyProperty(self, self, "phase") room:notifyProperty(self, self, "phase")
if #self.phases > 0 then if #self.phases > 0 then
table.remove(self.phases, 1) table.remove(self.phases, 1)
end end

2
packages/.gitignore vendored
View File

@ -4,4 +4,4 @@
!test/ !test/
!manuvering/ !manuvering/
!.gitignore !.gitignore
!init.sql !init.sql

View File

@ -77,7 +77,7 @@ GameRule = fk.CreateTriggerSkill{
move_to_notify.moveInfo = {} move_to_notify.moveInfo = {}
move_to_notify.moveReason = fk.ReasonDraw move_to_notify.moveReason = fk.ReasonDraw
for _, id in ipairs(cardIds) do for _, id in ipairs(cardIds) do
table.insert(move_to_notify.moveInfo, table.insert(move_to_notify.moveInfo,
{ cardId = id, fromArea = Card.DrawPile }) { cardId = id, fromArea = Card.DrawPile })
end end
room:notifyMoveCards(nil, {move_to_notify}) room:notifyMoveCards(nil, {move_to_notify})
@ -104,7 +104,7 @@ GameRule = fk.CreateTriggerSkill{
end end
room:sendLog{ type = "$AppendSeparator" } room:sendLog{ type = "$AppendSeparator" }
player:addMark("Global_TurnCount") player:addMark("Global_TurnCount")
if not player.faceup then if not player.faceup then
player:setFlag("-Global_FirstRound") player:setFlag("-Global_FirstRound")
@ -119,10 +119,10 @@ GameRule = fk.CreateTriggerSkill{
error("You should never proceed PhaseNone") error("You should never proceed PhaseNone")
end, end,
[Player.RoundStart] = function() [Player.RoundStart] = function()
end, end,
[Player.Start] = function() [Player.Start] = function()
end, end,
[Player.Judge] = function() [Player.Judge] = function()
local cards = player:getCardIds(Player.Judge) local cards = player:getCardIds(Player.Judge)
@ -173,10 +173,10 @@ GameRule = fk.CreateTriggerSkill{
end end
end, end,
[Player.Finish] = function() [Player.Finish] = function()
end, end,
[Player.NotActive] = function() [Player.NotActive] = function()
end, end,
}) })
end, end,

View File

@ -669,7 +669,7 @@ local keji = fk.CreateTriggerSkill{
can_refresh = function(self, event, target, player, data) can_refresh = function(self, event, target, player, data)
if not (target == player and player:hasSkill(self.name)) then if not (target == player and player:hasSkill(self.name)) then
return false return false
end end
if event == fk.CardResponding then if event == fk.CardResponding then
return data.card.name == "slash" return data.card.name == "slash"
elseif event == fk.EventPhaseStart then elseif event == fk.EventPhaseStart then

View File

@ -35,7 +35,7 @@ local slashSkill = fk.CreateActiveSkill{
on_effect = function(self, room, effect) on_effect = function(self, room, effect)
local to = effect.to local to = effect.to
local from = effect.from local from = effect.from
room:damage({ room:damage({
from = room:getPlayerById(from), from = room:getPlayerById(from),
to = room:getPlayerById(to), to = room:getPlayerById(to),
@ -146,7 +146,7 @@ local peachSkill = fk.CreateActiveSkill{
on_effect = function(self, room, effect) on_effect = function(self, room, effect)
local to = effect.to local to = effect.to
local from = effect.from local from = effect.from
room:recover({ room:recover({
who = room:getPlayerById(to), who = room:getPlayerById(to),
num = 1, num = 1,

View File

@ -17,7 +17,7 @@ GraphicsBox {
spacing: 10 spacing: 10
Text { Text {
text: root.custom_string text: root.custom_string
color: "#E4D5A0" color: "#E4D5A0"
} }

View File

@ -9,7 +9,7 @@ function createClientPages() {
mainWindow.generalsOverviewPage = generalsOverviewPage; mainWindow.generalsOverviewPage = generalsOverviewPage;
mainWindow.cardsOverviewPage = cardsOverviewPage; mainWindow.cardsOverviewPage = cardsOverviewPage;
} }
} }
var callbacks = {}; var callbacks = {};

View File

@ -8,7 +8,7 @@ Item {
property bool loaded: false property bool loaded: false
ListView { ListView {
width: Math.floor(root.width / 98) * 98 width: Math.floor(root.width / 98) * 98
height: parent.height height: parent.height
anchors.centerIn: parent anchors.centerIn: parent
@ -23,7 +23,7 @@ Item {
columns: root.width / 98 columns: root.width / 98
Repeater { Repeater {
model: JSON.parse(Backend.callLuaFunction("GetCards", [name])) model: JSON.parse(Backend.callLuaFunction("GetCards", [name]))
CardItem { CardItem {
autoBack: false autoBack: false
Component.onCompleted: { Component.onCompleted: {
let data = JSON.parse(Backend.callLuaFunction("GetCardData", [modelData])); let data = JSON.parse(Backend.callLuaFunction("GetCardData", [modelData]));

View File

@ -23,7 +23,7 @@ Item {
columns: root.width / 98 columns: root.width / 98
Repeater { Repeater {
model: JSON.parse(Backend.callLuaFunction("GetGenerals", [name])) model: JSON.parse(Backend.callLuaFunction("GetGenerals", [name]))
GeneralCardItem { GeneralCardItem {
autoBack: false autoBack: false
name: modelData name: modelData
onClicked: { onClicked: {

View File

@ -12,7 +12,7 @@ Item {
color: "#88888888" color: "#88888888"
radius: 2 radius: 2
} }
Column { Column {
spacing: 8 spacing: 8
ComboBox { ComboBox {

View File

@ -79,7 +79,7 @@ Item {
ListView { ListView {
id: packageList id: packageList
anchors.fill: parent anchors.fill: parent
contentHeight: packageDelegate.height * count contentHeight: packageDelegate.height * count
ScrollBar.vertical: ScrollBar {} ScrollBar.vertical: ScrollBar {}
header: RowLayout { header: RowLayout {

View File

@ -40,7 +40,7 @@ Item {
MediaPlayer { MediaPlayer {
id: bgm id: bgm
source: config.bgmFile source: config.bgmFile
// loops: MediaPlayer.Infinite // loops: MediaPlayer.Infinite
onPlaybackStateChanged: { onPlaybackStateChanged: {
if (playbackState == MediaPlayer.StoppedState && roomScene.isStarted) if (playbackState == MediaPlayer.StoppedState && roomScene.isStarted)
@ -104,7 +104,7 @@ Item {
if (popupBox.item != null) { if (popupBox.item != null) {
popupBox.item.finished(); popupBox.item.finished();
} }
} }
} }
}, },
@ -412,7 +412,7 @@ Item {
dragMargin: 0 dragMargin: 0
scale: mainWindow.scale scale: mainWindow.scale
transformOrigin: Item.TopLeft transformOrigin: Item.TopLeft
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent

View File

@ -351,7 +351,7 @@ Item {
duration: 100 duration: 100
} }
} }
function tremble() { function tremble() {
trembleAnimation.start() trembleAnimation.start()
} }

View File

@ -72,7 +72,7 @@ function doOkButton() {
} }
)); ));
return; return;
} }
replyToServer("1"); replyToServer("1");
} }
@ -91,7 +91,7 @@ function doCancelButton() {
replyToServer("__cancel"); replyToServer("__cancel");
return; return;
} }
replyToServer("__cancel"); replyToServer("__cancel");
} }
@ -486,7 +486,7 @@ callbacks["ArrangeSeats"] = function(jsonData) {
dashboardModel.seatNumber = order.indexOf(Self.id) + 1; dashboardModel.seatNumber = order.indexOf(Self.id) + 1;
dashboardModel.general = ""; dashboardModel.general = "";
roomScene.dashboardModelChanged(); roomScene.dashboardModelChanged();
// make Self to the first of list, then reorder photomodel // make Self to the first of list, then reorder photomodel
let selfIndex = order.indexOf(Self.id); let selfIndex = order.indexOf(Self.id);
let after = order.splice(selfIndex); let after = order.splice(selfIndex);
@ -497,7 +497,7 @@ callbacks["ArrangeSeats"] = function(jsonData) {
let item = photoModel.get(i); let item = photoModel.get(i);
item.index = photoOrder.indexOf(item.id); item.index = photoOrder.indexOf(item.id);
} }
arrangePhotos(); arrangePhotos();
} }
@ -516,14 +516,14 @@ callbacks["MoveFocus"] = function(jsonData) {
let data = JSON.parse(jsonData); let data = JSON.parse(jsonData);
let focuses = data[0]; let focuses = data[0];
let command = data[1]; let command = data[1];
let item, model; let item, model;
for (let i = 0; i < playerNum - 1; i++) { for (let i = 0; i < playerNum - 1; i++) {
model = photoModel.get(i); model = photoModel.get(i);
if (focuses.indexOf(model.id) != -1) { if (focuses.indexOf(model.id) != -1) {
item = photos.itemAt(i); item = photos.itemAt(i);
item.progressBar.visible = true; item.progressBar.visible = true;
item.progressTip = Backend.translate(command) item.progressTip = Backend.translate(command)
+ Backend.translate(" thinking..."); + Backend.translate(" thinking...");
if (command === "PlayCard") { if (command === "PlayCard") {

View File

@ -15,7 +15,7 @@ Item {
color: "#88888888" color: "#88888888"
radius: 2 radius: 2
} }
Column { Column {
spacing: 8 spacing: 8
TextField { TextField {

View File

@ -26,7 +26,7 @@ ListView {
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
} }
} }
delegate: Toast { delegate: Toast {
Component.onCompleted: { Component.onCompleted: {
show(text, duration); show(text, duration);

View File

@ -90,16 +90,16 @@ Item {
property bool stateVisible: false property bool stateVisible: false
states: [ states: [
State { State {
when: globalPopupDim.stateVisible when: globalPopupDim.stateVisible
PropertyChanges { target: globalPopupDim; opacity: 0.5 } PropertyChanges { target: globalPopupDim; opacity: 0.5 }
}, },
State { State {
when: !globalPopupDim.stateVisible when: !globalPopupDim.stateVisible
PropertyChanges { target: globalPopupDim; opacity: 0.0 } PropertyChanges { target: globalPopupDim; opacity: 0.0 }
} }
] ]
transitions: Transition { transitions: Transition {
NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad } NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad }
} }
@ -109,7 +109,7 @@ Item {
id: globalPopup id: globalPopup
property string source: "" property string source: ""
modal: true modal: true
dim: false // cannot animate the dim dim: false // cannot animate the dim
focus: true focus: true
opacity: mainWindow.busy ? 0 : 1 opacity: mainWindow.busy ? 0 : 1
closePolicy: Popup.CloseOnEscape closePolicy: Popup.CloseOnEscape

View File

@ -7,14 +7,14 @@ class ClientPlayer : public Player {
Q_OBJECT Q_OBJECT
Q_PROPERTY(int id READ getId CONSTANT) Q_PROPERTY(int id READ getId CONSTANT)
Q_PROPERTY(QString screenName Q_PROPERTY(QString screenName
READ getScreenName READ getScreenName
WRITE setScreenName WRITE setScreenName
NOTIFY screenNameChanged NOTIFY screenNameChanged
) )
Q_PROPERTY(QString avatar Q_PROPERTY(QString avatar
READ getAvatar READ getAvatar
WRITE setAvatar WRITE setAvatar
NOTIFY avatarChanged NOTIFY avatarChanged
) )

View File

@ -182,14 +182,14 @@ int main(int argc, char *argv[])
QTranslator translator; QTranslator translator;
Q_UNUSED(translator.load("zh_CN.qm")); Q_UNUSED(translator.load("zh_CN.qm"));
QCoreApplication::installTranslator(&translator); QCoreApplication::installTranslator(&translator);
QmlBackend backend; QmlBackend backend;
backend.setEngine(engine); backend.setEngine(engine);
#ifndef Q_OS_WASM #ifndef Q_OS_WASM
Pacman = new PackMan; Pacman = new PackMan;
#endif #endif
engine->rootContext()->setContextProperty("Backend", &backend); engine->rootContext()->setContextProperty("Backend", &backend);
engine->rootContext()->setContextProperty("Pacman", Pacman); engine->rootContext()->setContextProperty("Pacman", Pacman);

View File

@ -61,7 +61,7 @@ public:
LuaFunction startGame; LuaFunction startGame;
QString fetchRequest(); QString fetchRequest();
void pushRequest(const QString &req); void pushRequest(const QString &req);
bool hasRequest() const; bool hasRequest() const;
signals: signals:

View File

@ -35,7 +35,7 @@ public:
signals: signals:
void disconnected(); void disconnected();
private: private:
ClientSocket *socket; // socket for communicating with client ClientSocket *socket; // socket for communicating with client
Router *router; Router *router;

View File

@ -5,7 +5,7 @@ class Shell: public QThread {
Q_OBJECT Q_OBJECT
public: public:
Shell(); Shell();
enum Color { enum Color {
Black, Black,
Red, Red,

View File

@ -47,7 +47,7 @@ static int GetMicroSecond(lua_State *L) {
long microsecond = tv.tv_sec * 1000000 + tv.tv_usec; long microsecond = tv.tv_sec * 1000000 + tv.tv_usec;
lua_pushnumber(L, microsecond); lua_pushnumber(L, microsecond);
return 1; return 1;
} }
%} %}
void qDebug(const char *msg, ...); void qDebug(const char *msg, ...);

View File

@ -48,7 +48,7 @@ public:
const QString &command, const QString &command,
const QString &jsonData const QString &jsonData
); );
void gameOver(); void gameOver();
LuaFunction startGame; LuaFunction startGame;
@ -91,7 +91,7 @@ void Room::roomStart() {
} }
lua_pop(L, 1); lua_pop(L, 1);
} }
%} %}
%nodefaultctor ServerPlayer; %nodefaultctor ServerPlayer;

View File

@ -234,7 +234,7 @@ void QmlBackend::playSound(const QString &name, int index) {
i++; i++;
} }
index = i == 0 ? 0 : (QRandomGenerator::global()->generate()) % i + 1; index = i == 0 ? 0 : (QRandomGenerator::global()->generate()) % i + 1;
} }
if (index != 0) if (index != 0)
fname = fname + QString::number(index) + ".mp3"; fname = fname + QString::number(index) + ".mp3";
@ -242,7 +242,7 @@ void QmlBackend::playSound(const QString &name, int index) {
fname = fname + ".mp3"; fname = fname + ".mp3";
if (!QFile::exists(fname)) return; if (!QFile::exists(fname)) return;
auto player = new QMediaPlayer; auto player = new QMediaPlayer;
auto output = new QAudioOutput; auto output = new QAudioOutput;
player->setAudioOutput(output); player->setAudioOutput(output);