fph / bastet Goto Github PK
View Code? Open in Web Editor NEWEvil falling block game. http://fph.altervista.org/prog/bastet.html
License: GNU General Public License v3.0
Evil falling block game. http://fph.altervista.org/prog/bastet.html
License: GNU General Public License v3.0
There is something wrong with this line of code
`void Ui::MessageDialog(const std::string &message){
RedrawStatic();
Dot d=BoundingRect(message);
BorderedWindow w(d.y,d.x);
wattrset((WINDOW *)w,COLOR_PAIR(20));
mvwprintw(w,0,0,message.c_str());//format string vulnerability,when you input your name such as 123%253c%11$n
w.RedrawBorder();
wrefresh(w);
PrepareUiGetch();
int ch;
do{
ch=getch();
}
while(ch!=' ' && ch!=13); //13=return key!=KEY_ENTER, it seems
}`
mvwprintw is not safe。
You should restrict user input to prevent format string vulnerability.
Building bastet 0.43 fails on OS X 10.9 Mavericks. With this version of OS X, Apple has switched the default C++ library from libstdc++ to libc++, which does not include experimental pre-standardization C++11 features such as the ones you're using in your code; it only supports the final C++11 standard.
---> Building bastet
DEBUG: Executing org.macports.build (bastet)
DEBUG: Environment:
CC_PRINT_OPTIONS='YES'
CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/.CC_PRINT_OPTIONS'
CPATH='/opt/local/include'
LIBRARY_PATH='/opt/local/lib'
MACOSX_DEPLOYMENT_TARGET='10.9'
DEBUG: Assembled command: 'cd "/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43" && /usr/bin/make -w all CXX=/usr/bin/clang++ CXXFLAGS="-Os -arch x86_64" LDFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64" PREFIX=/opt/local'
DEBUG: Executing command line: cd "/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43" && /usr/bin/make -w all CXX=/usr/bin/clang++ CXXFLAGS="-Os -arch x86_64" LDFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64" PREFIX=/opt/local
make: Entering directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43'
Makefile:14: depend: No such file or directory
/usr/bin/clang++ -MM Ui.cpp main.cpp Block.cpp Well.cpp BlockPosition.cpp Config.cpp BlockChooser.cpp BastetBlockChooser.cpp > depend
In file included from Ui.cpp:22:
./BastetBlockChooser.hpp:26:10: fatal error: 'tr1/unordered_set' file not found
#include <tr1/unordered_set>
^
1 error generated.
In file included from main.cpp:21:
./BastetBlockChooser.hpp:26:10: fatal error: 'tr1/unordered_set' file not found
#include <tr1/unordered_set>
^
1 error generated.
In file included from BastetBlockChooser.cpp:19:
./BastetBlockChooser.hpp:26:10: fatal error: 'tr1/unordered_set' file not found
#include <tr1/unordered_set>
^
1 error generated.
make: *** [depend] Error 1
make: Leaving directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43'
If you do not have access to a Mac, you should be able to reproduce this on any other system that has libc++ available.
The floating red block down there should actually be falling down due to gravity actually existing: https://gamedevelopment.tutsplus.com/tutorials/implementing-tetris-clearing-lines--gamedev-1197
Hello, bastet 0.43.1 fails to build for me on OS X:
/usr/bin/clang++ -Os -arch x86_64 -DNDEBUG -Wall -c -o Ui.o Ui.cpp
In file included from Ui.cpp:19:
In file included from ./Ui.hpp:22:
./Well.hpp:69:17: error: friend declaration specifying a default argument must be a definition
friend long Evaluate(const Well *w, int extralines=0); //for BastetBlockChooser
^
1 error generated.
Hi - any chance we could get a new minor release with the latest changes (especially with the fix of #6 included). I'm currently working on a package for Void and would rather use an official release than having it patched. Thanks.
Missing directory and file:
g++ -MM Ui.cpp Block.cpp Well.cpp BlockPosition.cpp Config.cpp BlockChooser.cpp BastetBlockChooser.cpp main.cpp Test.cpp> depend BlockPosition.cpp:23:10: fatal error: boost/foreach.hpp: No such file or directory 23 | #include "boost/foreach.hpp" | ^~~~~~~~~~~~~~~~~~~ compilation terminated. Makefile:20: depend: No such file or directory make: *** [Makefile:18: depend] Error 1
I'm sorry but I cannot find how to edit the config file. The manpage mentions a .bastetrc
file but I have no syntax reference and would like to know if I can permanently configure my own keybindings.
Is there a way to customize keys and then retain this preference?
If not, can this be added? A simple implementation idea would just be to not regenerate ~/.bastetrc
if there is already one.
Thanks!
Currently, Bastet automatically generates the .bastetrc
and .bastetscores
files in $HOME
. This pollutes the home directory, and doesn't follow the XDG Base Directory Specs.
The specs state that program configuration should be localised to a subdirectory of $XDG_CONFIG_HOME
, which defaults to $HOME/.config
. In Bastet's case, I think it would make sense to move $HOME/.bastetrc
to $XDG_CONFIG_HOME/bastet/bastetrc
.
Similarly, user-specific data should be stored in a subdirectory of $XDG_DATA_HOME
, which defaults to $HOME/.local/share
. In Bastet's case, I think it would make sense to move $HOME/.bastetscores
to $XDG_CONFIG_HOME/bastet/scores
or something similar.
With recent compiler (latest clang, e.g. from Xcode 9 on macOS) and latest boost (1.65), the compilation fails because:
./BastetBlockChooser.hpp:26:10: fatal error: 'boost/tr1/tr1/unordered_set' file not found
#include <boost/tr1/tr1/unordered_set>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is available as system header under the name #include <unordered_set>
I've just installed bastet via Homebrew on macOS (brew install bastet
) and whenever I want to start a new game (normal or harder version) the game crashes with a segmentation fault (Segmentation fault: 11
).
bastet: 0.43.2
boost: 1.68.0
macOS: 10.13.6
Edit: I've attached a core dump to ease debugging: bastet_2018-12-18-160559.crash
bastet 0.43 assumes the single-threaded library boost_program_options is available, but it is possible to compile boost with only multi-threaded support, in which case only the library boost_program_options-mt will be available; this is the case in MacPorts for example, resulting in e.g. this build failure on Mac OS X 10.5:
---> Building bastet
DEBUG: Executing org.macports.build (bastet)
DEBUG: Environment: CPATH='/opt/local/include' CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/.CC_PRINT_OPTIONS' LIBRARY_PATH='/opt/local/lib' CC_PRINT_OPTIONS='YES' MACOSX_DEPLOYMENT_TARGET='10.5'
DEBUG: Assembled command: 'cd "/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43" && /usr/bin/make -w all CXX=/usr/bin/g++-4.2 CXXFLAGS="-Os -arch i386" LDFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch i386" PREFIX=/opt/local'
DEBUG: Executing command line: cd "/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43" && /usr/bin/make -w all CXX=/usr/bin/g++-4.2 CXXFLAGS="-Os -arch i386" LDFLAGS="-L/opt/local/lib -Wl,-headerpad_max_install_names -arch i386" PREFIX=/opt/local
make: Entering directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43'
Makefile:14: depend: No such file or directory
/usr/bin/g++-4.2 -MM Ui.cpp main.cpp Block.cpp Well.cpp BlockPosition.cpp Config.cpp BlockChooser.cpp BastetBlockChooser.cpp > depend
make: Leaving directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43'
make: Entering directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43'
/usr/bin/g++-4.2 -Os -arch i386 -c -o Ui.o Ui.cpp
/usr/bin/g++-4.2 -Os -arch i386 -c -o main.o main.cpp
/usr/bin/g++-4.2 -Os -arch i386 -c -o Block.o Block.cpp
/usr/bin/g++-4.2 -Os -arch i386 -c -o Well.o Well.cpp
/usr/bin/g++-4.2 -Os -arch i386 -c -o BlockPosition.o BlockPosition.cpp
/usr/bin/g++-4.2 -Os -arch i386 -c -o Config.o Config.cpp
/usr/bin/g++-4.2 -Os -arch i386 -c -o BlockChooser.o BlockChooser.cpp
/usr/bin/g++-4.2 -Os -arch i386 -c -o BastetBlockChooser.o BastetBlockChooser.cpp
/usr/bin/g++-4.2 -ggdb -o bastet Ui.o main.o Block.o Well.o BlockPosition.o Config.o BlockChooser.o BastetBlockChooser.o -L/opt/local/lib -Wl,-headerpad_max_install_names -arch i386 -lboost_program_options
ld: library not found for -lboost_program_options
collect2: ld returned 1 exit status
make: *** [bastet] Error 1
make: Leaving directory `/opt/local/var/macports/build/_Users_rschmidt_macports_dports_games_bastet/bastet/work/bastet-0.43'
Usually detecting whether to use the single-threaded or multi-threaded boost libraries is something you would do in your configure script; since bastet does not have a configure script, I'm not sure what you should do. I suppose you could at least offer a Makefile variable for controlling the boost library suffix, but ideally you would detect it automatically and use the best-available library.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.