1
0
Fork 0

Added HTTPS links wherever they are supported.

This commit is contained in:
Alexander Harkness 2015-12-19 14:30:32 +00:00
parent a99c82323e
commit 8b851d5048
22 changed files with 1742 additions and 1785 deletions

1616
Doxyfile

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ You'll need the basic C++ build tools:
* gcc (or clang or another C compiler)
* g++ (or clang++ or another C++ compiler)
* make
You'll also need CMake to generate the makefile to build from.
**Windows:**
@ -101,10 +101,10 @@ Where to Get Started
Issues that should be easy to get started with are tagged as [easy](https://github.com/cuberite/cuberite/issues?q=is%3Aopen+is%3Aissue+label%3Aeasy) in GitHub issues. Other good places to get started are:
* Cleaning up some of the compiler warnings. (Check [Travis CI](http://travis-ci.org/cuberite/cuberite) for a list of them.) With clang, there are over 10000 lines of warnings to clean up.
* Cleaning up some of the compiler warnings. (Check [Travis CI](https://travis-ci.org/cuberite/cuberite) for a list of them.) With clang, there are over 10000 lines of warnings to clean up.
* Writing some plugins: They are written in lua, with excellent API documentation available via [APIDump](http://api-docs.cuberite.org). The [Core](https://github.com/cuberite/Core) plugin should also help quite a bit here.
Special Things
---------------------
* Make yourself familiar with the community. Visit the forums: http://forum.mc-server.org
* Ask questions as much as you like, we're here to help :smiley:
* Ask questions as much as you like, we're here to help :smiley:

View File

@ -1,9 +1,9 @@
Cuberite [![Build Status](http://img.shields.io/travis/cuberite/cuberite/master.svg?style=flat)](https://travis-ci.org/cuberite/cuberite) [![Coverity Scan Build Status](https://img.shields.io/coverity/scan/1930.svg)](https://scan.coverity.com/projects/1930)
Cuberite [![Build Status](https://img.shields.io/travis/cuberite/cuberite/master.svg?style=flat)](https://travis-ci.org/cuberite/cuberite) [![Coverity Scan Build Status](https://img.shields.io/coverity/scan/1930.svg)](https://scan.coverity.com/projects/1930)
========
Cuberite is a Minecraft-compatible multiplayer game server that is written in C++ and designed to be efficient with memory and CPU, as well as having a flexible Lua Plugin API. Cuberite is compatible with the vanilla Minecraft client.
Cuberite can run on Windows, *nix and Android operating systems. This includes Android phones and tablets as well as Raspberry Pis.
Cuberite can run on Windows, *nix and Android operating systems. This includes Android phones and tablets as well as Raspberry Pis.
We currently support Release 1.7 and 1.8 (not beta) Minecraft protocol versions.
@ -17,7 +17,7 @@ There are several ways to obtain Cuberite.
#### Binaries
- The easiest method is downloading for Windows or Linux from the [Project site](http://cuberite.org/).
- You can use the EasyInstall script for Linux, which automatically downloads the correct binary. The script is described below.
- You can also obtain a binary from the [buildserver archive](http://builds.cuberite.org).
- You can also obtain a binary from the [buildserver archive](https://builds.cuberite.org).
##### The EasyInstall script
This Linux script will download the correct binary from the project site.
@ -28,7 +28,7 @@ This Linux script will download the correct binary from the project site.
- You can compile automatically for Linux with the `compile.sh` script. The script is described below.
- You can also compile manually. See [COMPILING.md](https://github.com/cuberite/cuberite/blob/master/COMPILING.md).
Compiling may provide better performance performance (1.5-3x as fast) and it supports more operating systems.
Compiling may provide better performance performance (1.5-3x as fast) and it supports more operating systems.
##### The compile.sh script
This script downloads the source code and compiles it. The script is smart enough to notify you of missing dependencies and instructing you on how to install them. The script doesn't work for Windows.
@ -52,5 +52,4 @@ For other stuff, including plugins and discussion, check out the [forums](http:/
[Support Us on Bountysource](https://bountysource.com/teams/cuberite)
Travis CI: [![travis build status shield](http://img.shields.io/travis/cuberite/cuberite.svg)](https://travis-ci.org/cuberite/cuberite)
Travis CI: [![travis build status shield](https://img.shields.io/travis/cuberite/cuberite.svg)](https://travis-ci.org/cuberite/cuberite)

View File

@ -6,9 +6,9 @@
# This covers GCC bug 40518, http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40518
# This covers GCC bug 40518, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40518
# "Erasing an empty string causes a global value write / race condition warning in helgrind"
# Original suppression authored by Jonathan Wakely: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40518#c20
# Original suppression authored by Jonathan Wakely: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40518#c20
# Modified by Mattes to match the mangled function name used on Ubuntu
{
@ -16,7 +16,3 @@
Helgrind:Race
fun:_ZNSs9_M_mutateEjjj
}

View File

@ -53,9 +53,9 @@
<ul class="menu bottom_links">
<li><a href="http://cuberite.org" target="_blank">Cuberite</a></li>
<li><a href="http://forum.mc-server.org" target="_blank">Forums</a></li>
<li><a href="http://builds.cuberite.org" target="_blank">Buildserver</a></li>
<li><a href="https://builds.cuberite.org" target="_blank">Buildserver</a></li>
<li><a href="http://api-docs.cuberite.org" target="_blank">API Documentation</a></li>
<li><a href="http://book.cuberite.org/" target="_blank">User's Manual</a></li>
<li><a href="https://book.cuberite.org/" target="_blank">User's Manual</a></li>
</ul>
</div>
</div>

View File

@ -25,7 +25,7 @@ function GetDefaultPage()
local SubTitle = "Current Game"
local Content = ""
Content = Content .. "<h4>Plugins:</h4><ul>"
PM:ForEachPlugin(
function (a_CBPlugin)
@ -34,16 +34,16 @@ function GetDefaultPage()
end
end
)
Content = Content .. "</ul>"
Content = Content .. "<h4>Players:</h4><ul>"
cRoot:Get():ForEachPlayer(
function(a_CBPlayer)
Content = Content .. "<li>" .. a_CBPlayer:GetName() .. "</li>"
end
)
Content = Content .. "</ul><br>";
return Content, SubTitle
@ -69,17 +69,17 @@ function ShowPage(WebAdmin, TemplateRequest)
if (PageContent == "") then
PageContent, SubTitle = GetDefaultPage()
end
local reqParamsClass = ""
for key,value in pairs(TemplateRequest.Request.Params) do
reqParamsClass = reqParamsClass .. " param-" .. string.lower(string.gsub(key, "[^a-zA-Z0-9]+", "-") .. "-" .. string.gsub(value, "[^a-zA-Z0-9]+", "-"))
end
if (string.gsub(reqParamsClass, "%s", "") == "") then
reqParamsClass = " no-param"
end
Output([[
<!-- Copyright Justin S and MCServer Team, licensed under CC-BY-SA 3.0 -->
<html>
@ -140,7 +140,7 @@ function ShowPage(WebAdmin, TemplateRequest)
local TabNames = value:GetTabNames()
if (GetTableSize(TabNames) > 0) then
Output("<div><a class='usercp_nav_item usercp_nav_pmfolder' style='text-decoration:none;'><b>"..PluginWebTitle.."</b></a></div>\n");
for webname,prettyname in pairs(TabNames) do
Output("<div><a href='" .. BaseURL .. PluginWebTitle .. "/" .. webname .. "' class='usercp_nav_item usercp_nav_sub_pmfolder'>" .. prettyname .. "</a></div>\n")
end
@ -149,7 +149,7 @@ function ShowPage(WebAdmin, TemplateRequest)
end
end
Output([[
</td>
</tr>
@ -179,9 +179,9 @@ function ShowPage(WebAdmin, TemplateRequest)
<ul class="menu bottom_links">
<li><a href="http://cuberite.org" target="_blank">Cuberite</a></li>
<li><a href="http://forum.mc-server.org" target="_blank">Forums</a></li>
<li><a href="http://builds.cuberite.org" target="_blank">Buildserver</a></li>
<li><a href="https://builds.cuberite.org" target="_blank">Buildserver</a></li>
<li><a href="http://api-docs.cuberite.org" target="_blank">API Documentation</a></li>
<li><a href="http://book.cuberite.org/" target="_blank">User's Manual</a></li>
<li><a href="https://book.cuberite.org/" target="_blank">User's Manual</a></li>
</ul>
</div>
</div>
@ -195,6 +195,6 @@ function ShowPage(WebAdmin, TemplateRequest)
</body>
</html>
]])
return table.concat(SiteContent)
end

View File

@ -34,7 +34,7 @@ all: BlockZapper
# CXX_OPTIONS ... options for the C++ code compiler
# LNK_OPTIONS ... options for the linker
# LNK_LIBS ... libraries to link in
# -- according to http://stackoverflow.com/questions/6183899/undefined-reference-to-dlopen, libs must come after all sources
# -- according to https://stackoverflow.com/questions/6183899/undefined-reference-to-dlopen, libs must come after all sources
# BUILDDIR ... folder where the intermediate object files are built
LNK_LIBS = -lstdc++ -ldl -lz
@ -139,7 +139,7 @@ SHAREDOBJECTS := $(patsubst %.cpp,$(BUILDDIR)%.o,$(SHAREDOBJECTS))
BlockZapper : $(OBJECTS) $(SHAREDOBJECTS)
$(CC) $(LNK_OPTIONS) $(OBJECTS) $(SHAREDOBJECTS) $(LNK_LIBS) -o BlockZapper
clean :
clean :
rm -rf $(BUILDDIR) BlockZapper
@ -156,7 +156,7 @@ clean :
# -MM ... generate a list of includes
$(BUILDDIR)%.o: %.c
@mkdir -p $(dir $@)
@mkdir -p $(dir $@)
$(CC) $(CC_OPTIONS) -x c -c $(INCLUDE) $< -o $@
@$(CC) $(CC_OPTIONS) -x c -MM $(INCLUDE) $< > $(patsubst %.o,%.d,$@)
@mv -f $(patsubst %.o,%.d,$@) $(patsubst %.o,%.d,$@).tmp

View File

@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 2.6)
project (MCADefrag)
# Without this, the MSVC variable isn't defined for MSVC builds ( http://www.cmake.org/pipermail/cmake/2011-November/047130.html )
# Without this, the MSVC variable isn't defined for MSVC builds ( https://www.cmake.org/pipermail/cmake/2011-November/047130.html )
enable_language(CXX C)
include(../../SetFlags.cmake)
@ -106,4 +106,3 @@ add_executable(MCADefrag
)
target_link_libraries(MCADefrag zlib)

File diff suppressed because it is too large Load Diff

View File

@ -141,7 +141,7 @@ generates a grid of alternating biomes.</p>
<h3>Voronoi diagram</h3>
<p>Those two generators were more of a technicality, we need to make something more interesting if we're
going for a natural look. The Voronoi generator is the first step towards such a change. Recall that a
<a href="http://en.wikipedia.org/wiki/Voronoi_diagram">Voronoi diagram</a> is a construct that creates a
<a href="https://en.wikipedia.org/wiki/Voronoi_diagram">Voronoi diagram</a> is a construct that creates a
set of areas where each point in an area is closer to the appropriate seed of the area than the seeds of any
other area:</p>
<img src="img/voronoi.png" />

View File

@ -3,11 +3,11 @@
PLATFORM=$(uname -m)
echo "Identifying platform: $PLATFORM"
case $PLATFORM in
"i686") DOWNLOADURL="http://builds.cuberite.org/job/Cuberite%20Linux%20x86%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz" ;;
"x86_64") DOWNLOADURL="http://builds.cuberite.org/job/Cuberite%20Linux%20x64%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz" ;;
case $PLATFORM in
"i686") DOWNLOADURL="https://builds.cuberite.org/job/Cuberite%20Linux%20x86%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz" ;;
"x86_64") DOWNLOADURL="https://builds.cuberite.org/job/Cuberite%20Linux%20x64%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz" ;;
# Assume that all arm devices are a raspi for now.
arm*) DOWNLOADURL="http://builds.cuberite.org/job/Cuberite%20Linux%20raspi-armhf%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz"
arm*) DOWNLOADURL="https://builds.cuberite.org/job/Cuberite%20Linux%20raspi-armhf%20Master/lastSuccessfulBuild/artifact/Cuberite.tar.gz"
esac
echo "Downloading precompiled binaries."

View File

@ -7,7 +7,7 @@
inline unsigned int GetTime()
{
// NB: For caveats, please see http://stackoverflow.com/a/14505248
// NB: For caveats, please see https://stackoverflow.com/a/14505248
return static_cast<unsigned int>(std::chrono::seconds(time(0)).count());
}

View File

@ -19,7 +19,7 @@
class cBlockFarmlandHandler :
public cBlockHandler
{
public:
cBlockFarmlandHandler(BLOCKTYPE a_BlockType) :
cBlockHandler(a_BlockType)
@ -104,7 +104,7 @@ public:
}
// Search for water in a close proximity:
// Ref.: http://www.minecraftwiki.net/wiki/Farmland#Hydrated_Farmland_Tiles
// Ref.: http://minecraft.gamepedia.com/Farmland#Hydrated_Farmland_Tiles
// TODO: Rewrite this to use the chunk and its neighbors directly
cBlockArea Area;
int BlockX = a_RelX + a_Chunk.GetPosX() * cChunkDef::Width;
@ -139,7 +139,3 @@ public:
);
}
} ;

View File

@ -16,10 +16,10 @@ Checks that all source files (*.cpp, *.h) use the basic style requirements of th
- (TODO) Hex numbers with even digit length
- (TODO) Hex numbers in lowercase
- (TODO) Not using "* "-style doxy comment continuation lines
Violations that cannot be checked easily:
- Spaces around "+" (there are things like "a++", "++a", "a += 1", "X+", "stack +1" and ascii-drawn tables)
Reports all violations on stdout in a form that is readable by Visual Studio's parser, so that dblclicking
the line brings the editor directly to the violation.
@ -114,38 +114,38 @@ local g_ViolationPatterns =
-- Check against indenting using spaces:
{"^\t* +", "Indenting with a space"},
-- Check against alignment using tabs:
{"[^%s]\t+[^%s]", "Aligning with a tab"},
-- Check against trailing whitespace:
{"[^%s]%s+\n", "Trailing whitespace"},
-- Check that all "//"-style comments have at least two spaces in front (unless alone on line):
{"[^%s] //", "Needs at least two spaces in front of a \"//\"-style comment"},
-- Check that all "//"-style comments have at least one spaces after:
{"%s//[^%s/*<]", "Needs a space after a \"//\"-style comment"},
-- Check that doxy-comments are used only in the double-asterisk form:
{"/// ", "Use doxycomments in the form /** Comment */"},
-- Check that /* */ comments have whitespace around the insides:
{"%*%*/", "Wrong comment termination, use */"},
{"/%*[^%s*/\"]", "Needs a space after /*"}, -- Need to take care of the special "//*/" comment ends
{"/%*%*[^%s*<]", "Needs a space after /**"},
{"[^%s/*]%*/", "Needs a space before */"},
-- Check against MS XML doxycomments:
{"/%*%* <", "Remove the MS XML markers from comment"},
-- Check that all commas have spaces after them and not in front of them:
{" ,", "Extra space before a \",\""},
{",[^%s\"%%\']", "Needs a space after a \",\""}, -- Report all except >> "," << needed for splitting and >>,%s<< needed for formatting
-- Check that opening braces are not at the end of a code line:
{"[^%s].-{\n?$", "Brace should be on a separate line"},
-- Space after keywords:
{"[^_]if%(", "Needs a space after \"if\""},
{"%sfor%(", "Needs a space after \"for\""},
@ -153,16 +153,16 @@ local g_ViolationPatterns =
{"%sswitch%(", "Needs a space after \"switch\""},
{"%scatch%(", "Needs a space after \"catch\""},
{"%stemplate<", "Needs a space after \"template\""},
-- No space after keyword's parenthesis:
{"[^%a#]if %( ", "Remove the space after \"(\""},
{"for %( ", "Remove the space after \"(\""},
{"while %( ", "Remove the space after \"(\""},
{"catch %( ", "Remove the space after \"(\""},
-- No space before a closing parenthesis:
{" %)", "Remove the space before \")\""},
-- Check spaces around "+":
{"^[a-zA-Z0-9]+%+[a-zA-Z0-9]+", "Add space around +"},
{"[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%+[a-zA-Z0-9]+", "Add space around +"},
@ -173,7 +173,7 @@ local g_ViolationPatterns =
{"^[a-zA-Z0-9]+%+ [a-zA-Z0-9]+", "Add space before +"},
{"[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%+ [a-zA-Z0-9]+", "Add space before +"},
--]]
-- Cannot check spaces around "-", because the minus is sometimes used as a hyphen between-words
-- Check spaces around "*":
@ -191,7 +191,7 @@ local g_ViolationPatterns =
{"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%&[a-zA-Z0-9]+", "Add space around &"},
{"^[a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"},
{"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"},
-- Check spaces around "==", "<=" and ">=":
{"==[a-zA-Z0-9]+", "Add space after =="},
{"[a-zA-Z0-9]+==", "Add space before =="},
@ -212,7 +212,7 @@ local g_ViolationPatterns =
--- Processes one file
local function ProcessFile(a_FileName)
assert(type(a_FileName) == "string")
-- Read the whole file:
local f, err = io.open(a_FileName, "r")
if (f == nil) then
@ -222,7 +222,7 @@ local function ProcessFile(a_FileName)
end
local all = f:read("*all")
f:close()
-- Check that the last line is empty - otherwise processing won't work properly:
local lastChar = string.byte(all, string.len(all))
if ((lastChar ~= 13) and (lastChar ~= 10)) then
@ -231,9 +231,9 @@ local function ProcessFile(a_FileName)
ReportViolation(a_FileName, numLines, 1, 1, "Missing empty line at file end")
return
end
-- Process each line separately:
-- Ref.: http://stackoverflow.com/questions/10416869/iterate-over-possibly-empty-lines-in-a-way-that-matches-the-expectations-of-exis
-- Ref.: https://stackoverflow.com/questions/10416869/iterate-over-possibly-empty-lines-in-a-way-that-matches-the-expectations-of-exis
local lineCounter = 1
local lastIndentLevel = 0
local isLastLineControl = false
@ -244,7 +244,7 @@ local function ProcessFile(a_FileName)
for _, pat in ipairs(g_ViolationPatterns) do
ReportViolationIfFound(a_Line, a_FileName, lineCounter, pat[1], pat[2])
end
-- Check that divider comments are well formed - 80 slashes plus optional indent:
local dividerStart, dividerEnd = a_Line:find("/////*")
if (dividerStart) then
@ -260,7 +260,7 @@ local function ProcessFile(a_FileName)
end
end
end
-- Check the indent level change from the last line, if it's too much, report:
local indentStart, indentEnd = a_Line:find("\t+")
local indentLevel = 0
@ -273,7 +273,7 @@ local function ProcessFile(a_FileName)
end
lastIndentLevel = indentLevel
end
-- Check that control statements have braces on separate lines after them:
-- Note that if statements can be broken into multiple lines, in which case this test is not taken
if (isLastLineControl) then
@ -304,12 +304,12 @@ end
--- Processes one item - a file or a folder
local function ProcessItem(a_ItemName)
assert(type(a_ItemName) == "string")
-- Skip files / folders that should be ignored
if (g_ShouldIgnoreFile[a_ItemName]) then
return
end
local ext = a_ItemName:match("%.([^/%.]-)$")
if (g_ShouldProcessExt[ext]) then
ProcessFile(a_ItemName)
@ -340,7 +340,7 @@ local CmdLineHandlers =
table.insert(ToProcess, fnam)
return a_Idx + 2 -- skip the filename in param parsing
end,
-- "-g" checks files reported by git as being committed.
["-g"] = function (a_Args, a_Idx)
local f = io.popen("git diff --cached --name-only --diff-filter=ACMR")
@ -348,7 +348,7 @@ local CmdLineHandlers =
table.insert(ToProcess, fnam)
end
end,
-- "-h" prints help and exits
["-h"] = function (a_Args, a_Idx)
print([[
@ -368,7 +368,7 @@ Only .cpp and .h files are ever checked.
]])
os.exit(0)
end,
-- "-l listfile" loads the list of files to check from the specified listfile
["-l"] = function (a_Args, a_Idx)
local listFile = a_Args[a_Idx + 1]
@ -380,7 +380,7 @@ Only .cpp and .h files are ever checked.
end
return a_Idx + 2 -- Skip the listfile in param parsing
end,
-- "--" reads the list of files from stdin
["--"] = function (a_Args, a_Idx)
for fnam in io.lines() do
@ -425,7 +425,7 @@ for _, fnam in ipairs(ToProcess) do
if (fnam:sub(1, 2) == "./") then
fnam = fnam:sub(3)
end
ProcessItem(fnam)
end
@ -440,7 +440,3 @@ if (g_NumViolations > 0) then
else
os.exit(0)
end

View File

@ -67,10 +67,10 @@ public:
/** Generates the array of templated size into a_Values, based on given min coords. */
virtual void GetInts(int a_MinX, int a_MinZ, Values & a_Values) = 0;
};
// Code adapted from http://stackoverflow.com/questions/7858817/unpacking-a-tuple-to-call-a-matching-function-pointer
// Code adapted from https://stackoverflow.com/questions/7858817/unpacking-a-tuple-to-call-a-matching-function-pointer
template<int... >
struct sSeq
@ -92,7 +92,7 @@ struct sGens<0, S...>
template<class Gen, class... Args>
class cIntGenFactory
{
public:
typedef Gen Generator;
@ -101,7 +101,7 @@ public:
m_args(std::make_tuple<Args...>(std::forward<Args>(a_args)...))
{
}
template <class LhsGen>
std::shared_ptr<Gen> construct(LhsGen&& a_Lhs)
{
@ -111,13 +111,13 @@ public:
private:
std::tuple<Args...> m_args;
template <class LhsGen, int... S>
std::shared_ptr<Gen> construct_impl(LhsGen&& a_Lhs, sSeq<S...>)
{
return std::make_shared<Gen>(std::get<S>(m_args)..., std::forward<LhsGen>(a_Lhs));
}
};
template<class T, class RhsGen, class... Args>
@ -1466,7 +1466,3 @@ protected:
Underlying m_Underlying;
Underlying m_Alteration;
};

View File

@ -68,12 +68,12 @@ class cCubicNoise
public:
/** Maximum size of each dimension of the query arrays. */
static const int MAX_SIZE = 512;
/** Creates a new instance with the specified seed. */
cCubicNoise(int a_Seed);
/** Fills a 2D array with the values of the noise. */
void Generate2D(
NOISE_DATATYPE * a_Array, ///< Array to generate into [x + a_SizeX * y]
@ -81,8 +81,8 @@ public:
NOISE_DATATYPE a_StartX, NOISE_DATATYPE a_EndX, ///< Noise-space coords of the array in the X direction
NOISE_DATATYPE a_StartY, NOISE_DATATYPE a_EndY ///< Noise-space coords of the array in the Y direction
) const;
/** Fills a 3D array with the values of the noise. */
void Generate3D(
NOISE_DATATYPE * a_Array, ///< Array to generate into [x + a_SizeX * y + a_SizeX * a_SizeY * z]
@ -91,9 +91,9 @@ public:
NOISE_DATATYPE a_StartY, NOISE_DATATYPE a_EndY, ///< Noise-space coords of the array in the Y direction
NOISE_DATATYPE a_StartZ, NOISE_DATATYPE a_EndZ ///< Noise-space coords of the array in the Z direction
) const;
protected:
/** Noise used for integral random values. */
cNoise m_Noise;
@ -115,8 +115,8 @@ protected:
/** Improved noise, as described by Ken Perlin: http://mrl.nyu.edu/~perlin/paper445.pdf
Implementation adapted from Perlin's Java implementation: http://mrl.nyu.edu/~perlin/noise/ */
/** Improved noise, as described by Ken Perlin: https://mrl.nyu.edu/~perlin/paper445.pdf
Implementation adapted from Perlin's Java implementation: https://mrl.nyu.edu/~perlin/noise/ */
class cImprovedNoise
{
public:
@ -132,8 +132,8 @@ public:
NOISE_DATATYPE a_StartX, NOISE_DATATYPE a_EndX, ///< Noise-space coords of the array in the X direction
NOISE_DATATYPE a_StartY, NOISE_DATATYPE a_EndY ///< Noise-space coords of the array in the Y direction
) const;
/** Fills a 3D array with the values of the noise. */
void Generate3D(
NOISE_DATATYPE * a_Array, ///< Array to generate into [x + a_SizeX * y + a_SizeX * a_SizeY * z]
@ -324,12 +324,3 @@ inline NOISE_DATATYPE ClampedLerp(NOISE_DATATYPE a_Val1, NOISE_DATATYPE a_Val2,
}
return Lerp(a_Val1, a_Val2, a_Ratio);
}

View File

@ -12,7 +12,7 @@
#if defined(_MSC_VER) && defined(_DEBUG)
// Code adapted from MSDN: http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx
// Code adapted from MSDN: https://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx
const DWORD MS_VC_EXCEPTION = 0x406D1388;
#pragma pack(push, 8)
@ -144,7 +144,3 @@ bool cIsThread::Wait(void)
LOGD("Thread %s finished", m_ThreadName.c_str());
return true;
}

View File

@ -35,14 +35,10 @@ void PrintStackTrace(void)
#else
#ifdef __GLIBC__
// Use the backtrace() function to get and output the stackTrace:
// Code adapted from http://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes
// Code adapted from https://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes
void * stackTrace[30];
auto numItems = backtrace(stackTrace, ARRAYCOUNT(stackTrace));
backtrace_symbols_fd(stackTrace, numItems, STDERR_FILENO);
#endif
#endif
}

View File

@ -67,7 +67,7 @@ static const AString & GetCACerts(void)
// Starfield G2 cert
// This is the data of the root certs for Starfield Technologies, the CA that used to sign sessionserver.mojang.com's cert
// Downloaded from http://certs.starfieldtech.com/repository/
// Downloaded from https://certs.starfieldtech.com/repository/
"-----BEGIN CERTIFICATE-----\n"
"MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx\n"
"EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT\n"
@ -118,7 +118,7 @@ static const AString & GetCACerts(void)
"WQPJIrSPnNVeKtelttQKbfi3QBFGmh95DmK/D5fs4C8fF5Q=\n"
"-----END CERTIFICATE-----\n"
);
return Cert;
}
@ -152,7 +152,7 @@ cMojangAPI::sProfile::sProfile(
}
]
*/
// Parse the Textures and TexturesSignature from the Profile:
if (!a_Properties.isArray())
{
@ -272,7 +272,7 @@ AString cMojangAPI::GetUUIDFromPlayerName(const AString & a_PlayerName, bool a_U
{
// Convert the playername to lowercase:
AString lcPlayerName = StrToLower(a_PlayerName);
// Request the cache to query the name if not yet cached:
if (!a_UseOnlyCached)
{
@ -280,7 +280,7 @@ AString cMojangAPI::GetUUIDFromPlayerName(const AString & a_PlayerName, bool a_U
PlayerNames.push_back(lcPlayerName);
CacheNamesToUUIDs(PlayerNames);
}
// Retrieve from cache:
cCSLock Lock(m_CSNameToUUID);
cProfileMap::const_iterator itr = m_NameToUUID.find(lcPlayerName);
@ -300,7 +300,7 @@ AString cMojangAPI::GetPlayerNameFromUUID(const AString & a_UUID, bool a_UseOnly
{
// Normalize the UUID to lowercase short format that is used as the map key:
AString UUID = MakeUUIDShort(a_UUID);
// Retrieve from caches:
{
cCSLock Lock(m_CSUUIDToProfile);
@ -325,7 +325,7 @@ AString cMojangAPI::GetPlayerNameFromUUID(const AString & a_UUID, bool a_UseOnly
CacheUUIDToProfile(UUID);
return GetPlayerNameFromUUID(a_UUID, true);
}
// No value found, none queried. Return an error:
return "";
}
@ -342,13 +342,13 @@ AStringVector cMojangAPI::GetUUIDsFromPlayerNames(const AStringVector & a_Player
{
PlayerNames.push_back(StrToLower(*itr));
} // for itr - a_PlayerNames[]
// Request the cache to populate any names not yet contained:
if (!a_UseOnlyCached)
{
CacheNamesToUUIDs(PlayerNames);
}
// Retrieve from cache:
size_t idx = 0;
AStringVector res;
@ -367,7 +367,7 @@ AStringVector cMojangAPI::GetUUIDsFromPlayerNames(const AStringVector & a_Player
void cMojangAPI::AddPlayerNameToUUIDMapping(const AString & a_PlayerName, const AString & a_UUID)
{
@ -475,7 +475,7 @@ AString cMojangAPI::MakeUUIDShort(const AString & a_UUID)
// Already is a short UUID, only lowercase
return StrToLower(a_UUID);
}
case 36:
{
// Remove the dashes from the string by appending together the parts between them:
@ -507,7 +507,7 @@ AString cMojangAPI::MakeUUIDDashed(const AString & a_UUID)
// Already is a dashed UUID, only lowercase
return StrToLower(a_UUID);
}
case 32:
{
// Insert dashes at the proper positions:
@ -541,7 +541,7 @@ void cMojangAPI::LoadCachesFromDisk(void)
SQLite::Database db("MojangAPI.sqlite", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);
db.exec("CREATE TABLE IF NOT EXISTS PlayerNameToUUID (PlayerName, UUID, DateTime)");
db.exec("CREATE TABLE IF NOT EXISTS UUIDToProfile (UUID, PlayerName, Textures, TexturesSignature, DateTime)");
// Retrieve all entries:
{
SQLite::Statement stmt(db, "SELECT PlayerName, UUID, DateTime FROM PlayerNameToUUID");
@ -587,11 +587,11 @@ void cMojangAPI::SaveCachesToDisk(void)
SQLite::Database db("MojangAPI.sqlite", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);
db.exec("CREATE TABLE IF NOT EXISTS PlayerNameToUUID (PlayerName, UUID, DateTime)");
db.exec("CREATE TABLE IF NOT EXISTS UUIDToProfile (UUID, PlayerName, Textures, TexturesSignature, DateTime)");
// Remove all entries:
db.exec("DELETE FROM PlayerNameToUUID");
db.exec("DELETE FROM UUIDToProfile");
// Save all cache entries - m_PlayerNameToUUID:
Int64 LimitDateTime = time(nullptr) - MAX_AGE;
{
@ -658,7 +658,7 @@ void cMojangAPI::CacheNamesToUUIDs(const AStringVector & a_PlayerNames)
}
} // for itr - a_PlayerNames[]
} // Lock(m_CSNameToUUID)
QueryNamesToUUIDs(NamesToQuery);
}
@ -720,7 +720,7 @@ void cMojangAPI::QueryNamesToUUIDs(AStringVector & a_NamesToQuery)
continue;
}
Response.erase(0, idxHeadersEnd + 4);
// Parse the returned string into Json:
Json::Reader reader;
if (!reader.parse(Response, root, false) || !root.isArray())
@ -729,7 +729,7 @@ void cMojangAPI::QueryNamesToUUIDs(AStringVector & a_NamesToQuery)
LOGD("Response body:\n%s", CreateHexDump(HexDump, Response.data(), Response.size(), 16).c_str());
continue;
}
// Store the returned results into cache:
Json::Value::UInt JsonCount = root.size();
Int64 Now = time(nullptr);
@ -748,7 +748,7 @@ void cMojangAPI::QueryNamesToUUIDs(AStringVector & a_NamesToQuery)
NotifyNameUUID(JsonName, JsonUUID);
} // for idx - root[]
} // cCSLock (m_CSNameToUUID)
// Also cache the UUIDToName:
{
cCSLock Lock(m_CSUUIDToName);
@ -774,7 +774,7 @@ void cMojangAPI::QueryNamesToUUIDs(AStringVector & a_NamesToQuery)
void cMojangAPI::CacheUUIDToProfile(const AString & a_UUID)
{
ASSERT(a_UUID.size() == 32);
// Check if already present:
{
cCSLock Lock(m_CSUUIDToProfile);
@ -783,7 +783,7 @@ void cMojangAPI::CacheUUIDToProfile(const AString & a_UUID)
return;
}
}
QueryUUIDToProfile(a_UUID);
}
@ -796,7 +796,7 @@ void cMojangAPI::QueryUUIDToProfile(const AString & a_UUID)
// Create the request address:
AString Address = m_UUIDToProfileAddress;
ReplaceString(Address, "%UUID%", a_UUID);
// Create the HTTP request:
AString Request;
Request += "GET " + Address + " HTTP/1.0\r\n"; // We need to use HTTP 1.0 because we don't handle Chunked transfer encoding
@ -832,7 +832,7 @@ void cMojangAPI::QueryUUIDToProfile(const AString & a_UUID)
return;
}
Response.erase(0, idxHeadersEnd + 4);
// Parse the returned string into Json:
Json::Reader reader;
Json::Value root;
@ -943,7 +943,3 @@ void cMojangAPI::Update(void)
}
}
}

View File

@ -767,7 +767,7 @@ int cRoot::GetVirtualRAMUsage(void)
}
return -1;
#elif defined(__linux__)
// Code adapted from http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process
// Code adapted from https://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process
std::ifstream StatFile("/proc/self/status");
if (!StatFile.good())
{
@ -785,7 +785,7 @@ int cRoot::GetVirtualRAMUsage(void)
}
return -1;
#elif defined (__APPLE__)
// Code adapted from http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process
// Code adapted from https://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process
struct task_basic_info t_info;
mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
@ -819,7 +819,7 @@ int cRoot::GetPhysicalRAMUsage(void)
}
return -1;
#elif defined(__linux__)
// Code adapted from http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process
// Code adapted from https://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process
std::ifstream StatFile("/proc/self/status");
if (!StatFile.good())
{
@ -837,7 +837,7 @@ int cRoot::GetPhysicalRAMUsage(void)
}
return -1;
#elif defined (__APPLE__)
// Code adapted from http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process
// Code adapted from https://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process
struct task_basic_info t_info;
mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;

View File

@ -21,7 +21,7 @@
AString & AppendVPrintf(AString & str, const char * format, va_list args)
{
ASSERT(format != nullptr);
char buffer[2048];
int len;
#ifdef va_copy
@ -47,7 +47,7 @@ AString & AppendVPrintf(AString & str, const char * format, va_list args)
#ifdef va_copy
va_end(argsCopy);
#endif
// The result did not fit into the static buffer, use a dynamic buffer:
#ifdef _MSC_VER
// for MS CRT, we need to calculate the result length
@ -57,7 +57,7 @@ AString & AppendVPrintf(AString & str, const char * format, va_list args)
return str;
}
#endif // _MSC_VER
// Allocate a buffer and printf into it:
#ifdef va_copy
va_copy(argsCopy, args);
@ -232,7 +232,7 @@ AString TrimString(const AString & str)
{
return "";
}
size_t end = len;
while (end >= start)
{
@ -242,7 +242,7 @@ AString TrimString(const AString & str)
}
--end;
}
return str.substr(start, end - start + 1);
}
@ -396,7 +396,7 @@ AString & RawBEToUTF8(const char * a_RawData, size_t a_NumShorts, AString & a_UT
// UTF-8 conversion code adapted from:
// http://stackoverflow.com/questions/2867123/convert-utf-16-to-utf-8-under-windows-and-linux-in-c
// https://stackoverflow.com/questions/2867123/convert-utf-16-to-utf-8-under-windows-and-linux-in-c
////////////////////////////////////////////////////////////////////////////////
// Begin of Unicode, Inc.'s code / information
@ -524,7 +524,7 @@ std::u16string UTF8ToRawBEUTF16(const AString & a_UTF8)
{
return UTF16;
}
// The cases all fall through. See "Note A" below.
switch (extraBytesToRead)
{
@ -609,7 +609,7 @@ AString & CreateHexDump(AString & a_Out, const void * a_Data, size_t a_Size, siz
char line[512];
char * p;
char * q;
a_Out.reserve(a_Size / a_BytesPerLine * (18 + 6 * a_BytesPerLine));
for (size_t i = 0; i < a_Size; i += a_BytesPerLine)
{
@ -953,7 +953,7 @@ bool SplitZeroTerminatedStrings(const AString & a_Strings, AStringVector & a_Out
a_Output.push_back(a_Strings.substr(start, size - start));
res = true;
}
return res;
}
@ -1000,7 +1000,3 @@ AString StringsConcat(const AStringVector & a_Strings, char a_Separator)
}
return res;
}

View File

@ -30,7 +30,7 @@ all: NoiseTest
# CXX_OPTIONS ... options for the C++ code compiler
# LNK_OPTIONS ... options for the linker
# LNK_LIBS ... libraries to link in
# -- according to http://stackoverflow.com/questions/6183899/undefined-reference-to-dlopen, libs must come after all sources
# -- according to https://stackoverflow.com/questions/6183899/undefined-reference-to-dlopen, libs must come after all sources
# BUILDDIR ... folder where the intermediate object files are built
LNK_LIBS = -lstdc++ -ldl
@ -120,7 +120,7 @@ SHAREDOBJECTS := $(patsubst %.cpp,$(BUILDDIR)%.o,$(SHAREDOBJECTS))
NoiseTest : $(OBJECTS) $(SHAREDOBJECTS)
$(CC) $(LNK_OPTIONS) $(OBJECTS) $(SHAREDOBJECTS) $(LNK_LIBS) -o NoiseTest
clean :
clean :
rm -rf $(BUILDDIR) NoiseTest
@ -136,7 +136,7 @@ clean :
# -MM ... generate a list of includes
$(BUILDDIR)%.o: %.c
@mkdir -p $(dir $@)
@mkdir -p $(dir $@)
$(CC) $(CC_OPTIONS) -x c -c $(INCLUDE) $< -o $@
@$(CC) $(CC_OPTIONS) -x c -MM $(INCLUDE) $< > $(patsubst %.o,%.d,$@)
@mv -f $(patsubst %.o,%.d,$@) $(patsubst %.o,%.d,$@).tmp