From 2b5a171668709aa564509ce90eba41db6fce248d Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sun, 5 Jun 2016 15:09:01 +0200 Subject: [PATCH] Experiments --- .../Modules/AssetInterfaces/IXAnimParts.cpp | 4 +- src/Components/Modules/Download.cpp | 54 +++++++++---------- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/src/Components/Modules/AssetInterfaces/IXAnimParts.cpp b/src/Components/Modules/AssetInterfaces/IXAnimParts.cpp index 70c68c47..977059db 100644 --- a/src/Components/Modules/AssetInterfaces/IXAnimParts.cpp +++ b/src/Components/Modules/AssetInterfaces/IXAnimParts.cpp @@ -238,11 +238,11 @@ namespace Assets if (asset->framecount > 0xFF) { buffer->Align(Utils::Stream::ALIGN_2); - buffer->SaveArray(dest->indices._2, asset->framecount); + buffer->SaveArray(asset->indices._2, asset->indexcount); } else { - buffer->SaveArray(dest->indices._1, asset->framecount); + buffer->SaveArray(asset->indices._1, asset->indexcount); } dest->indices.data = reinterpret_cast(-1); diff --git a/src/Components/Modules/Download.cpp b/src/Components/Modules/Download.cpp index 7cdff5ce..a4f54836 100644 --- a/src/Components/Modules/Download.cpp +++ b/src/Components/Modules/Download.cpp @@ -104,11 +104,11 @@ namespace Components http_message* message = reinterpret_cast(ev_data); - // if (!Download::IsClient(nc)) - // { - // Download::Forbid(nc); - // } - // else +// if (!Download::IsClient(nc)) +// { +// Download::Forbid(nc); +// } +// else { std::string url(message->uri.p, message->uri.len); Utils::Replace(url, "\\", "/"); @@ -157,30 +157,28 @@ namespace Components http_message* message = reinterpret_cast(ev_data); - if (std::string(message->uri.p, message->uri.len) == "/") +// if (std::string(message->uri.p, message->uri.len) == "/") +// { +// mg_printf(nc, +// "HTTP/1.1 200 OK\r\n" +// "Content-Type: text/html\r\n" +// "Connection: close\r\n" +// "\r\n" +// "Hi fella!
You are%s connected to this server!", (Download::IsClient(nc) ? " " : " not")); +// +// Game::client_t* client = Download::GetClient(nc); +// +// if (client) +// { +// mg_printf(nc, "
Hello %s!", client->name); +// } +// } +// else { - mg_printf(nc, - "HTTP/1.1 200 OK\r\n" - "Content-Type: text/html\r\n" - "Connection: close\r\n" - "\r\n" - "Hi fella!
You are%s connected to this server!", (Download::IsClient(nc) ? " " : " not")); - - Game::client_t* client = Download::GetClient(nc); - - if (client) - { - mg_printf(nc, "
Hello %s!", client->name); - } - } - else - { - mg_printf(nc, "%s", - "HTTP/1.1 404 Not Found\r\n" - "Content-Type: text/html\r\n" - "Connection: close\r\n" - "\r\n" - "404 - Not Found"); + std::string path = (Dvar::Var("fs_basepath").Get() + "\\" BASEGAME "\\html"); + mg_serve_http_opts opts = { 0 }; + opts.document_root = path.data(); + mg_serve_http(nc, message, opts); } nc->flags |= MG_F_SEND_AND_CLOSE;