Skip to content

Instantly share code, notes, and snippets.

packet :PacketLogin do |p|
p.string :name
end
packet :PlayerPhysics do |p|
p.uint64 :id
p.matrix :position
p.vector3 :dunno
end
require './packet.rb'
packet_manager = PacketManager.build do
packet :PacketLogin do
string :name
end
packet :PlayerPhysics do
uint64 :id
matrix :position
class PacketLogin : Ekaiyo.Networking.Packet {
public string name;
}
class PlayerPhysics : Ekaiyo.Networking.Packet {
public UInt64 id;
public Matrix position;
public Vector3 dunno;
}
class PlayerMessage : Ekaiyo.Networking.Packet {
public UInt64 id;
class SpawnRequest : Ekaiyo.Networking.Packet {
public override int DecodingSize { get { return 5; } }
public override int EncodingSize { get { return 5; } }
public Int32 unique_id;
public SpawnRequest (Int32 a_unique_id) : base(PacketType.SpawnRequest) {
this.unique_id = a_unique_id
}
}
class MapItem : Ekaiyo.Networking.Packet {
public override int DecodingSize { get { return 69; } }
packet :PartyPokemonDetail do
uint64 :trainer_id
byte :party_index
int16 :species_id
bool :female
int32 :level
byte :status
uint32 :current_hp
uint32 :current_xp
byte :pokerus
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Ekaiyo.sources.networking
{
class Codec
{
#region Encoders
@hugopeixoto
hugopeixoto / regex.rb
Created July 30, 2011 17:53
Regex problem
"EEB".gsub(/(\w)\1/,'\1X\1') # "EXEB"
"EEEB".gsub(/(\w)\1\1/,'\1X\1Z\1') # "EXEZEB"
"EEEEB".gsub(/(\w)\1\1\1/,'\1X\1Z\1X\1') # "EXEZEXEB"
@hugopeixoto
hugopeixoto / geos.rb
Created October 22, 2011 14:58
geos 3.3.1 formula
require 'formula'
class Geos < Formula
url 'http://download.osgeo.org/geos/geos-3.3.1.tar.bz2'
homepage 'http://trac.osgeo.org/geos/'
md5 'b1ceefe205c9ee520b99f2b072c345f7'
def skip_clean? path
path.extname == '.la'
end
@hugopeixoto
hugopeixoto / edgering.diff
Created November 16, 2011 14:56
geos 3.3.1 patch to silence a warning
--- src/operation/polygonize/EdgeRing.cpp 2011-11-16 14:47:02.000000000 +0000
+++ src/operation/polygonize/EdgeRing.cpp 2011-11-16 14:48:14.000000000 +0000
@@ -222,9 +222,9 @@
ring=factory->createLinearRing(*ringPts);
} catch (const std::exception& e) {
// FIXME: print also ringPts
- std::cerr << "EdgeRing::getRingInternal: "
- << e.what()
- << endl;
+ // std::cerr << "EdgeRing::getRingInternal: "
#include "app/controllers/posts.h"
#include "http/request.h"
#include "helpers/core.h"
// views
#include "app/views/posts/index.cc"
#include "app/views/posts/show.cc"
using app::controllers::PostsController;