16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 22:59:19 +02:00

reformat: use auto on certain types

This commit is contained in:
jerrrrycho
2026-07-04 04:04:17 +02:00
parent a4c126b4ea
commit f61068ff89
53 changed files with 200 additions and 201 deletions

View File

@@ -279,8 +279,8 @@ TAnimModel::is_keyword( std::string const &Token ) const {
bool TAnimModel::Load(cParser *parser, bool ter)
{ // rozpoznanie wpisu modelu i ustawienie świateł
std::string name = parser->getToken<std::string>();
std::string texture = parser->getToken<std::string>(false);
auto name = parser->getToken<std::string>();
auto texture = parser->getToken<std::string>(false);
replace_slashes( name );
replace_slashes( texture );
if (!Init( name, texture ))

View File

@@ -293,7 +293,7 @@ std::pair<int, int> TSubModel::Load(cParser &parser, bool dynamic)
if (parser.expectToken("anim:")) // Ra: ta informacja by się przydała!
{ // rodzaj animacji
std::string type = parser.getToken<std::string>();
auto type = parser.getToken<std::string>();
if (type != "false")
{
iFlags |= 0x4000; // jak animacja, to trzeba przechowywać macierz zawsze
@@ -341,7 +341,7 @@ std::pair<int, int> TSubModel::Load(cParser &parser, bool dynamic)
}
parser.ignoreToken(); // zignorowanie nazwy "SelfIllum:"
{
std::string light = parser.getToken<std::string>();
auto light = parser.getToken<std::string>();
if (light == "true")
fLight = 2.0; // zawsze świeci
else if (light == "false")
@@ -407,7 +407,7 @@ std::pair<int, int> TSubModel::Load(cParser &parser, bool dynamic)
if (!parser.expectToken("map:"))
Error("Model map parse failure!");
std::string material = parser.getToken<std::string>();
auto material = parser.getToken<std::string>();
std::replace(material.begin(), material.end(), '\\', '/');
if (material == "none")
{ // rysowanie podanym kolorem
@@ -1179,7 +1179,7 @@ void TSubModel::RaAnimation(glm::mat4 &m, TAnimType a)
case TAnimType::at_Billboard: // obrót w pionie do kamery
{
glm::mat4 mat = glm::make_mat4(OpenGLMatrices.data_array(GL_MODELVIEW));
float3 gdzie = float3(mat[3][0], mat[3][1], mat[3][2]); // początek układu współrzędnych submodelu względem kamery
auto gdzie = float3(mat[3][0], mat[3][1], mat[3][2]); // początek układu współrzędnych submodelu względem kamery
m = glm::mat4(1.0f);
m = glm::translate(m, glm::vec3(gdzie.x, gdzie.y, gdzie.z)); // początek układu zostaje bez zmian
m = glm::rotate(m, (float)atan2(gdzie.x, gdzie.z), glm::vec3(0.0f, 1.0f, 0.0f)); // jedynie obracamy w pionie o kąt
@@ -2338,7 +2338,7 @@ void TSubModel::BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t,
bool TSubModel::HasAnyVertexUserData() const
{
for (const TSubModel *sm = this; sm; sm = sm->Next)
for (auto sm = this; sm; sm = sm->Next)
{
if (m_geometry.handle)
{
@@ -2384,7 +2384,7 @@ TSubModel *TModel3d::AppendChildFromGeometry(const std::string &name, const std:
{
iFlags |= 0x0200;
TSubModel *sm = new TSubModel();
auto sm = new TSubModel();
sm->Parent = AddToNamed(parent.c_str(), sm);
sm->m_geometry.vertex_count = vertices.size();
sm->m_geometry.index_count = indices.size();
@@ -2415,7 +2415,7 @@ void TModel3d::LoadFromTextFile(std::string const &FileName, bool dynamic)
iFlags |= 0x0200; // wczytano z pliku tekstowego (właścicielami tablic są submodle)
cParser parser(FileName, cParser::buffer_FILE); // Ra: tu powinno być "models/"...
TSubModel *SubModel;
std::string token = parser.getToken<std::string>();
auto token = parser.getToken<std::string>();
while (token != "" || parser.eof())
{
std::string parent;

View File

@@ -592,7 +592,7 @@ opengl_texture::load_DDS() {
// while DDS stores it with top-left origin. we need to flip it.
if (Global.dds_upper_origin)
{
char *mipmap = (char*)&data[0];
auto mipmap = (char*)&data[0];
int mapcount = data_mapcount,
width = data_width,
height = data_height;
@@ -771,8 +771,8 @@ opengl_texture::load_TGA() {
// rgb or greyscale image, expand to bgra
unsigned char buffer[ 4 ] = { 255, 255, 255, 255 }; // alpha channel will be white
unsigned int *datapointer = (unsigned int*)&data[0];
unsigned int *bufferpointer = (unsigned int*)&buffer[ 0 ];
auto datapointer = (unsigned int*)&data[0];
auto bufferpointer = (unsigned int*)&buffer[ 0 ];
int const pixelcount = data_width * data_height;
@@ -797,8 +797,8 @@ opengl_texture::load_TGA() {
unsigned char buffer[ 4 ] = { 255, 255, 255, 255 };
const int pixelcount = data_width * data_height;
unsigned int *datapointer = (unsigned int *)&data[0];
unsigned int *bufferpointer = (unsigned int *)&buffer[ 0 ];
auto datapointer = (unsigned int *)&data[0];
auto bufferpointer = (unsigned int *)&buffer[ 0 ];
do {
unsigned char chunkheader = 0;

View File

@@ -339,7 +339,7 @@ opengl_material::deserialize_mapping( cParser &Input, int const Priority, bool c
else if (key.compare(0, 5, "param") == 0) {
key.erase(0, 5);
std::string value = Input.getToken<std::string>( true, "\n\r\t;" );
auto value = Input.getToken<std::string>( true, "\n\r\t;" );
std::istringstream stream(value);
glm::vec4 data;
stream >> data.r;